# Makie GLFWError

**URL:** <https://discourse.julialang.org/t/makie-glfwerror/51006>\
**Category:** New to Julia\
**Created:** [November 30, 2020, 7:01pm UTC](https://discourse.julialang.org/t/makie-glfwerror/51006 "2020-11-30T19:01:21Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![arnief3](https://avatars.discourse-cdn.com/v4/letter/a/a698b9/32.png) [@arnief3](https://discourse.julialang.org/u/arnief3)\
**Post date:** [November 30, 2020, 7:01pm UTC](https://discourse.julialang.org/t/makie-glfwerror/51006/1 "2020-11-30T19:01:21Z")

</div>

I am attempting to use Makie for the first time but I am getting the following error:

```julia
ERROR: GLFWError (VERSION_UNAVAILABLE): GLX: Failed to create context: BadValue

```

I have tried to run some of the Makie examples and a minimal example consisting of just:

```julia
using Makie
scene = Scene()

```

I am running:  
Ubuntu 18.04.5  
Makie v0.11.1  
julia-1.5.3 (same result with julia-1.5.2)

Here is the full stack trace:

```julia
Error showing value of type Scene:
ERROR: GLFWError (VERSION_UNAVAILABLE): GLX: Failed to create context: BadValue
Stacktrace:
 [1] _ErrorCallbackWrapper(::Int32, ::Cstring) at /home/arnie/.julia/packages/GLFW/CBo9c/src/callback.jl:43
 [2] CreateWindow(::Int64, ::Int64, ::String, ::GLFW.Monitor, ::GLFW.Window) at /home/arnie/.julia/packages/GLFW/CBo9c/src/glfw3.jl:499
 [3] GLFW.Window(; name::String, resolution::Tuple{Int64,Int64}, debugging::Bool, major::Int64, minor::Int64, windowhints::Array{Tuple{UInt32,Integer},1}, contexthints::Array{Tuple{UInt32,Integer},1}, visible::Bool, focus::Bool, fullscreen::Bool, monitor::Nothing, share::GLFW.Window) at /home/arnie/.julia/packages/GLFW/CBo9c/src/glfw3.jl:344
 [4] GLMakie.Screen(; resolution::Tuple{Int64,Int64}, visible::Bool, title::String, kw_args::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/arnie/.julia/packages/GLMakie/Pway1/src/screen.jl:317
 [5] Screen at /home/arnie/.julia/packages/GLMakie/Pway1/src/screen.jl:291 [inlined]
 [6] global_gl_screen at /home/arnie/.julia/packages/GLMakie/Pway1/src/screen.jl:363 [inlined]
 [7] global_gl_screen(::Tuple{Int64,Int64}, ::Bool, ::Int64) at /home/arnie/.julia/packages/GLMakie/Pway1/src/screen.jl:373
 [8] global_gl_screen at /home/arnie/.julia/packages/GLMakie/Pway1/src/screen.jl:372 [inlined]
 [9] backend_display at /home/arnie/.julia/packages/GLMakie/Pway1/src/gl_backend.jl:57 [inlined]
 [10] display(::AbstractPlotting.PlotDisplay, ::Scene) at /home/arnie/.julia/packages/AbstractPlotting/JCbJs/src/display.jl:45
 [11] display(::Any) at ./multimedia.jl:328
 [12] #invokelatest#1 at ./essentials.jl:710 [inlined]
 [13] invokelatest at ./essentials.jl:709 [inlined]
 [14] print_response(::IO, ::Any, ::Bool, ::Bool, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:238
 [15] print_response(::REPL.AbstractREPL, ::Any, ::Bool, ::Bool) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:223
 [16] (::REPL.var"#do_respond#54"{Bool,Bool,REPL.var"#64#73"{REPL.LineEditREPL,REPL.REPLHistoryProvider},REPL.LineEditREPL,REPL.LineEdit.Prompt})(::Any, ::Any, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:822
 [17] #invokelatest#1 at ./essentials.jl:710 [inlined]
 [18] invokelatest at ./essentials.jl:709 [inlined]
 [19] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/LineEdit.jl:2355
 [20] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:1144
 [21] (::REPL.var"#38#42"{REPL.LineEditREPL,REPL.REPLBackendRef})() at ./task.jl:356

```

---

<div class="post-metadata">

**Author:** ![arnief3](https://avatars.discourse-cdn.com/v4/letter/a/a698b9/32.png) [@arnief3](https://discourse.julialang.org/u/arnief3)\
**Post date:** [November 30, 2020, 7:53pm UTC](https://discourse.julialang.org/t/makie-glfwerror/51006/2 "2020-11-30T19:53:57Z")

</div>

Problem solved: I updated my display driver (Nvidia) and I am now in business.

---

<div class="post-metadata">

**Author:** ![DoktorMike](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/doktormike/32/2736_2.png) [@DoktorMike](https://discourse.julialang.org/u/DoktorMike)\
**Post date:** [November 30, 2020, 8:55pm UTC](https://discourse.julialang.org/t/makie-glfwerror/51006/3 "2020-11-30T20:55:22Z")

</div>

I get this error often with the version of julia downloaded from the website. But if I build it myself from source it works like a charm. Never could figure out why it cannot find the right drivers with the downloaded precompiled tar archive.

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [December 20, 2020, 3:03pm UTC](https://discourse.julialang.org/t/makie-glfwerror/51006/4 "2020-12-20T15:03:18Z")

</div>

> [@DoktorMike](#):
>
> Never could figure out why it cannot find the right drivers with the downloaded precompiled tar archive.

> <https://github.com/JuliaGL/GLFW.jl/issues/198>
>
> Hi,
> GLFW.jl is affected by the outdated libstdc++ issue. It's a problem that ha…s been affecting several projects and has been documented in \[at least one Discourse thread\](https://discourse.julialang.org/t/glibcxx-3-4-26-not-found-in-rcall/29113/11). What happens is that Julia ships with an old version of libstdc++, and something in the linking process fails on systems that expect a newer version of libstdc++. If you run a GLFW.jl function with the \`LIBGL\_DEBUG=verbose\` environment variable set, you get an error message like \`libGL: MESA-LOADER: failed to open /usr/lib/dri/radeonsi\_dri.so: /home/alex/pkgs/julia-1.3.0/bin/../lib/julia/libstdc++.so.6: version \`GLIBCXX\_3.4.26' not found (required by /usr/lib/libLLVM-9.so)\`. The libstdc++ shipped with Julia 1.3 is version 3.4.24. 
> 
> \[There's an open issue on the main Julia repo\](https://github.com/JuliaLang/julia/issues/34276). Other packages like RCall have been adding notices in their docs with workarounds in the meantime. The error message GLFW.jl gives right now is especially lacking. Without the \`LIGBL\_DEBUG=verbose\`, on my machine it is:
> \`\`\`Julia
> libGL error: MESA-LOADER: failed to open radeonsi (search paths /usr/lib/dri)
> libGL error: failed to load driver: radeonsi
> libGL error: MESA-LOADER: failed to open radeonsi (search paths /usr/lib/dri)
> libGL error: failed to load driver: radeonsi
> libGL error: MESA-LOADER: failed to open swrast (search paths /usr/lib/dri)
> libGL error: failed to load driver: swrast
> ERROR: GLFWError (VERSION\_UNAVAILABLE): GLX: Failed to create context: BadValue
> Stacktrace:
> \[1\] \_ErrorCallbackWrapper(::Int32, ::Cstring) at /home/alex/.julia/packages/GLFW/g1nX6/src/callback.jl:43
> \[2\] CreateWindow(::Int64, ::Int64, ::String, ::GLFW.Monitor, ::GLFW.Window) at /home/alex/.julia/packages/GLFW/g1nX6/src/glfw3.jl:487 (repeats 2 times)
> \[3\] top-level scope at REPL\[3\]:1
> \`\`\` 
> The workaround right now is to:
> 1) Delete \`julia-1.3.0/lib/julia/libstdc++.so.6\`
> 2) Find the system libstdc++ with \`whereis libstdc++\`
> 3) Link that location to \`julia-1.3.0/lib/julia-libstdc++.so.6\` using \`ln\`.
> 
> I think it'd be worthwhile to put a notice up on the README that this issue is occurring. I encountered the problem while trying to use Makie, and this repo was one of the first places I went to debug it since the error comes from this library. It's probably worthwhile to put a notice up in Makie too.

---

<div class="post-metadata">

**Author:** ![anon92994695](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@anon92994695](https://discourse.julialang.org/u/anon92994695)\
**Post date:** [December 20, 2020, 3:09pm UTC](https://discourse.julialang.org/t/makie-glfwerror/51006/5 "2020-12-20T15:09:27Z")

</div>

Can confirm @giordano’s link fixed the issue for me. I just had to do something like the following:

in bash:  
`export LD_PRELOAD=/lib/x86_64-linux-gnu/libstdc++.so.6`  
Note: find your own path with something like: `/sbin/ldconfig -p | grep stdc++`

in julia:

```julia
ENV["DISPLAY"] = ":0"
using GLFW
...

```

Thanks Mose!

---

<div class="post-metadata">

**Author:** ![anon92994695](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@anon92994695](https://discourse.julialang.org/u/anon92994695)\
**Post date:** [December 20, 2020, 3:49pm UTC](https://discourse.julialang.org/t/makie-glfwerror/51006/6 "2020-12-20T15:49:15Z")

</div>

Also you can set this in your VSCode until 1.6 rolls around(bug is fixed there) by editing your settings.json like the following:

```julia
    "terminal.integrated.env.linux": {
        "LD_PRELOAD": "/lib/x86_64-linux-gnu/libstdc++.so.6"
    },

```

(thanks @pfitzseb)

---

<div class="post-metadata">

**Author:** ![DoktorMike](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/doktormike/32/2736_2.png) [@DoktorMike](https://discourse.julialang.org/u/DoktorMike)\
**Post date:** [December 21, 2020, 8:40am UTC](https://discourse.julialang.org/t/makie-glfwerror/51006/7 "2020-12-21T08:40:55Z")

</div>

Awesome, thanks @giordano!
