OpenGL/GLFW error building GLMakie

Hello, I wanted to give a try to Makie but I got the following error while trying to install it:

(@v1.5) pkg> build GLMakie
   Building ModernGL → `~/.julia/packages/ModernGL/rVuW2/deps/build.log`
   Building FFTW ────→ `~/.julia/packages/FFTW/DMUbN/deps/build.log`
   Building GLMakie ─→ `~/.julia/packages/GLMakie/4EXKe/deps/build.log`
┌ Error: Error building `GLMakie`: 
│ libGL error: MESA-LOADER: failed to open iris (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri)
│ libGL error: failed to load driver: iris
│ libGL error: MESA-LOADER: failed to open iris (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri)
│ libGL error: failed to load driver: iris
│ libGL error: MESA-LOADER: failed to open swrast (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri)
│ libGL error: failed to load driver: swrast
│ init error of GLFW
│ ERROR: LoadError: OpenGL/GLFW wasn't installed correctly. This likely means,
│ you don't have an OpenGL capable Graphic Card,
│ you don't have the newest video driver installed,
│ or the GLFW build failed. If you're on linux and `]build` GLFW failed,
│ try manually adding `sudo apt-get install libglfw3` and then `]build GLMakie`.
│ If you're on a headless server, you still need to install x-server and
│ proper GPU drivers. You can take inspiration from this article
│ on how to get Makie running on a headless system:
│ If you don't have a GPU, there is also a Cairo software backend
│ for Makie which you can use:
│ Please check the below error and open an issue at:
│ After you fixed your OpenGL install, please run `]build GLMakie` again!
│ GLMakie will still load, but will be disabled as a default backend for Makie
│ Stacktrace:
│  [1] error(::String) at ./error.jl:33
│  [2] top-level scope at /home/lobianco/.julia/packages/GLMakie/4EXKe/deps/build.jl:63
│  [3] include(::String) at ./client.jl:457
│  [4] top-level scope at none:5
│ in expression starting at /home/lobianco/.julia/packages/GLMakie/4EXKe/deps/build.jl:31
│ caused by [exception 1]
│ GLFWError (VERSION_UNAVAILABLE): GLX: Failed to create context: GLXBadFBConfig
│ Stacktrace:
│  [1] _ErrorCallbackWrapper(::Int32, ::Cstring) at /home/lobianco/.julia/packages/GLFW/CBo9c/src/callback.jl:43
│  [2] CreateWindow(::Int64, ::Int64, ::String, ::GLFW.Monitor, ::GLFW.Window) at /home/lobianco/.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,Int64},1}, contexthints::Array{Tuple{UInt32,Integer},1}, visible::Bool, focus::Bool, fullscreen::Bool, monitor::Nothing, share::GLFW.Window) at /home/lobianco/.julia/packages/GLFW/CBo9c/src/glfw3.jl:344
│  [4] top-level scope at /home/lobianco/.julia/packages/GLMakie/4EXKe/deps/build.jl:34
│  [5] include(::String) at ./client.jl:457
│  [6] top-level scope at none:5
└ @ Pkg.Operations /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Pkg/src/Operations.jl:942

I am on a recent Ubuntu 20.04 Laptop with Intel graphical card and I do already have libglfw3 to the newest version (3.3.2-1).
(and I don’t know nothing of graphical terms… OpenGL, GLX, GLFW, Cairo…)

Edit: cmake, xorg-dev, build-essential, cmake, mesa-utils, libxrandr-dev, libxinerama-dev, libxcursor-dev, ffmpeg are all installed

My setup is quite different but I saw similar error before, so just in case…

I have Windows machines, and whenever I use Remote Desktop to connect to another Windows machine and build GLMakie on that remote machine, I’ll get error message that says “… This likely means, you don’t have an OpenGL capable Graphic Card, …”

I don’t have this error if I build on that same machine through a local login (i.e. sitting in front of that computer), or use TeamViewer for remote connection.

I never tried other ways of remote connection and build (e.g. SSH, VNC…), and not sure if this experience applies to Ubuntu.

No, I think here the situation is connected with this bug report: Julia loading Julia's libstdc++ instead of system, causes inscrutable errors · Issue #198 · JuliaGL/GLFW.jl · GitHub.

I solved by removing julia-1.5.0/lib/julia/ but I hope it will not create problems in other things…


Thanks. I solved this problem by replacing julia-1.5.x/lib/julia/ with a link to system

1 Like

By the way, I think this is now finally fixed in Julia 1.6!

1 Like

I’d say alleviated rather than completely fixed. People may have problems again in the future if we don’t update the version of libstdc++ shipped with julia, or if they’ll use v1.6 in a few years

Julia 1.6.7 has just been released as LTS version, and problem still persists: I am not able to run code based on VideoIO/GLMakie on a remote computer, only at the local one.

I mean, that’s literally what I said in the message just before yours:

The trick is also always the same: copy system libstdc++ to the directory where is the one shipped by Julia.

1 Like

Or start Julia with the system stdlib preloaded, like

$ LD_PRELOAD=/usr/lib64/ julia

I you don’t know which to choose you may start with the command:

$ locate

Afterwards, you start julia as described above, in my case “ubuntu 22.04” the right one was:

LD_PRELOAD=/usr/lib/x86_64-linux-gnu/ julia

After the command:

import Pkg; Pkg.precompile()

GLMakie was also one time operational inside VScode, but it turns out this is not reproducible on my machine.
Now comes the question, what do I need to add to my “startup.jl”, to enable GLMakie inside VScode.

Note that there’s no need to manually preload libstdc++ in Julia 1.8.4+, Julia will automatically use system libstdc++ if more recent than the one it ships.

1 Like

good news :slight_smile: !!!
It would also be nice, if GLMakie would be operational in JuliaLTS the same way.