libGL error: failed to load driver: swrast
Closed this issue · 12 comments
There a number of similar issues to this one, but I wasn't sure where to put this one since it's on Ubuntu and Julia was built from source:
(@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/cLuEl/deps/build.log`
┌ Error: Error building `GLMakie`:
│ libGL error: No matching fbConfigs or visuals found
│ 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:
│ https://nextjournal.com/sdanisch/makie-1.0
│ If you don't have a GPU, there is also a Cairo software backend
│ for Makie which you can use:
│ https://github.com/JuliaPlots/CairoMakie.jl.
│ Please check the below error and open an issue at:
│ https://github.com/JuliaPlots/GLMakie.jl.
│ 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/shelin/.julia/packages/GLMakie/cLuEl/deps/build.jl:63
│ [3] include(::String) at ./client.jl:457
│ [4] top-level scope at none:5
│ in expression starting at /home/shelin/.julia/packages/GLMakie/cLuEl/deps/build.jl:31
│ caused by [exception 1]
│ GLFWError (VERSION_UNAVAILABLE): GLX: Failed to create context: BadMatch
│ Stacktrace:
│ [1] _ErrorCallbackWrapper(::Int32, ::Cstring) at /home/shelin/.julia/packages/GLFW/CBo9c/src/callback.jl:43
│ [2] CreateWindow(::Int64, ::Int64, ::String, ::GLFW.Monitor, ::GLFW.Window) at /home/shelin/.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/shelin/.julia/packages/GLFW/CBo9c/src/glfw3.jl:344
│ [4] top-level scope at /home/shelin/.julia/packages/GLMakie/cLuEl/deps/build.jl:34
│ [5] include(::String) at ./client.jl:457
│ [6] top-level scope at none:5
└ @ Pkg.Operations ~/julia/usr/share/julia/stdlib/v1.5/Pkg/src/Operations.jl:949
System:
julia> versioninfo()
Julia Version 1.5.3
Commit 788b2c77c1 (2020-11-09 13:37 UTC)
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: Intel(R) Xeon(R) CPU E5420 @ 2.50GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-9.0.1 (ORCJIT, penryn)
GPU:
~$ sudo lshw -C display
[sudo] password for shelin:
*-display
description: VGA compatible controller
product: G86 [Quadro NVS 290]
vendor: NVIDIA Corporation
physical id: 0
bus info: pci@0000:02:00.0
version: a1
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress vga_controller bus_master cap_list rom
configuration: driver=nvidia latency=0
resources: irq:36 memory:fa000000-faffffff memory:d0000000-dfffffff memory:f8000000-f9ffffff ioport:dc80(size=128) memory:c0000-dffff
That sounds like you have no gpu drivers installed or not not installed them correctly ;)
Make sure to install nvidia drivers & make sure that glxinfo | grep OpenGL
spits out OpenGL > 3.3
I think the correct drivers are already installed:
~$ ubuntu-drivers devices
== /sys/devices/pci0000:00/0000:00:05.0/0000:02:00.0 ==
modalias : pci:v000010DEd0000042Fsv000010DEsd00000492bc03sc00i00
vendor : NVIDIA Corporation
model : G86 [Quadro NVS 290]
driver : nvidia-340 - distro non-free recommended
driver : xserver-xorg-video-nouveau - distro free builtin
~$ sudo apt-get install nvidia-340
Reading package lists... Done
Building dependency tree
Reading state information... Done
nvidia-340 is already the newest version (340.108-0ubuntu2).
0 upgraded, 0 newly installed, 0 to remove and 8 not upgraded.
and I can see that OpenGL is ≥ 3.3 (but not > 3.3):
glxinfo | grep "OpenGL version"
OpenGL version string: 3.3.0 NVIDIA 340.108
yet, I still run into the same problem:
(@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/cLuEl/deps/build.log`
┌ Error: Error building `GLMakie`:
│ libGL error: No matching fbConfigs or visuals found
│ libGL error: failed to load driver: swrast
│ init error of GLFW
...
So do I need the version of OpenGL to be higher than, but not equal to, 3.3.0?
Do you have any special setup in place? E.g. running this headless (without monitor) or something?
No, this was on a Ubuntu with Gnome (newest LTS with all the normal things). But I've switched it to Debian Buster (so not the latest) with just i3, to see if it was something Ubuntu related. The hardware this is on is a bit dated (2008) and nvidia-detect
said I needed buster for the correct nvidia driver. I still have OpenGL 3.3 and the driver for the Nvidia card is 340.108. I've now tried to use the Julia binaries instead of building from source (in order to test the workaround mentioned in #198), and now the error is slightly different:
(@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/cLuEl/deps/build.log`
┌ Error: Error building `GLMakie`:
│ init error of GLFW
...
As reported elsewhere trying to build GLFW
doesn't output anything at all. installing libglfw3
didn't help either.
So something must be up since this isn't working in either Ubuntu nor Debian...
I don't see the error :D
Try:
using GLFW; GLFW.Window()
For a simple test!
Gladly:
julia> using GLFW; GLFW.Window()
ERROR: GLFWError (API_UNAVAILABLE): GLX: No GLXFBConfigs returned
Stacktrace:
[1] _ErrorCallbackWrapper(::Int32, ::Cstring) at /home/shelin/.julia/packages/GLFW/CBo9c/src/callback.jl:43
[2] CreateWindow(::Int64, ::Int64, ::String, ::GLFW.Monitor, ::GLFW.Window) at /home/shelin/.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/shelin/.julia/packages/GLFW/CBo9c/src/glfw3.jl:344
[4] GLFW.Window() at /home/shelin/.julia/packages/GLFW/CBo9c/src/glfw3.jl:316
[5] top-level scope at REPL[4]:1
@yakir12, would you mind trying the following?
LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6 julia
It's been long enough for all of these problems to have resolved themselves by now... So I think we can close this because, currently, I can't even reproduce the errors I reported here.
Both setting and not setting LD_PRELOAD
when running
using GLFW; GLFW.Window()
works (i.e. no errors and a new window is created).
Let me know if there is anything additional you want me to test. For reference:
julia> versioninfo()
Julia Version 1.8.0-beta1
Commit 7b711ce699 (2022-02-23 15:09 UTC)
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 32 × AMD Ryzen Threadripper 2950X 16-Core Processor
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-13.0.1 (ORCJIT, znver1)
Threads: 1 on 32 virtual cores
It's been long enough for all of these problems to have resolved themselves by now...
Unfortunately, it's happening on my system. (That's why I found this issue).
So I think we can close this
Sure. I agree, since the root cause is JuliaLang/julia#34276, which is not fixed but closed at the time of writing.
Is this releated? Using the newest ubuntu release 22.04 I get
julia> using GLFW; GLFW.Window()
libGL error: MESA-LOADER: failed to open iris: /usr/lib/dri/iris_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libGL error: failed to load driver: iris
libGL error: MESA-LOADER: failed to open iris: /usr/lib/dri/iris_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libGL error: failed to load driver: iris
libGL error: MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libGL error: failed to load driver: swrast
ERROR: GLFWError (VERSION_UNAVAILABLE): GLX: Failed to create context: GLXBadFBConfig
Stacktrace:
[1] _ErrorCallbackWrapper(code::Int32, description::Cstring)
@ GLFW ~/.julia/packages/GLFW/BWxfF/src/callback.jl:43
[2] CreateWindow(width::Int64, height::Int64, title::String, monitor::GLFW.Monitor, share::GLFW.Window)
@ GLFW ~/.julia/packages/GLFW/BWxfF/src/glfw3.jl:499
[3] GLFW.Window(; name::String, resolution::Tuple{Int64, Int64}, debugging::Bool, major::Int64, minor::Int64, windowhints::Vector{Tuple{UInt32, Int64}}, contexthints::Vector{Tuple{UInt32, Integer}}, visible::Bool, focus::Bool, fullscreen::Bool, monitor::Nothing, share::GLFW.Window)
@ GLFW ~/.julia/packages/GLFW/BWxfF/src/glfw3.jl:344
[4] GLFW.Window()
@ GLFW ~/.julia/packages/GLFW/BWxfF/src/glfw3.jl:316
[5] top-level scope
@ REPL[3]:1
``
@hofmannmartin, use the workaround described in #198 (comment) on 22.04.
I think it is, @hofmannmartin. I am using the same distribution (ubuntu 22.04) and got the same error. The workaround
LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6 julia
works.