Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libGL error: failed to load driver: swrast #211

Closed
yakir12 opened this issue Dec 9, 2020 · 12 comments
Closed

libGL error: failed to load driver: swrast #211

yakir12 opened this issue Dec 9, 2020 · 12 comments

Comments

@yakir12
Copy link

yakir12 commented Dec 9, 2020

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:5in 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
@SimonDanisch
Copy link
Member

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

@yakir12
Copy link
Author

yakir12 commented Dec 10, 2020

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?

@SimonDanisch
Copy link
Member

Do you have any special setup in place? E.g. running this headless (without monitor) or something?

@yakir12
Copy link
Author

yakir12 commented Dec 10, 2020

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...

@SimonDanisch
Copy link
Member

I don't see the error :D
Try:

using GLFW; GLFW.Window()

For a simple test!

@yakir12
Copy link
Author

yakir12 commented Dec 10, 2020

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

@yashi
Copy link

yashi commented Mar 9, 2022

@yakir12, would you mind trying the following?

LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6 julia

@yakir12
Copy link
Author

yakir12 commented Mar 10, 2022

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

@yakir12 yakir12 closed this as completed Mar 10, 2022
@yashi
Copy link

yashi commented Mar 14, 2022

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.

@hofmannmartin
Copy link

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
``

@t-bltg
Copy link

t-bltg commented May 18, 2022

@hofmannmartin, use the workaround described in #198 (comment) on 22.04.

@alxmz2
Copy link

alxmz2 commented Mar 7, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants