Could not load library libGL.so.1

GR.jl depends on GR_jll.jl depends on Qt_jll.jl

I am getting an error when I try to make a sysimage in a CentOS 7 container (x86_64 gnu linux) while behind a firewall, seemingly from this line:

ERROR: InitError: could not load library "/root/.julia/artifacts/d293cd24045ea10c3c6c81ca2dddd060feca711c/lib/libQt53DAnimation.so"
libGL.so.1: cannot open shared object file: No such file or directory
Stacktrace:
 [1] dlopen(::String, ::UInt32; throw_error::Bool) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Libdl/src/Libdl.jl:109
 [2] dlopen(::String, ::UInt32) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Libdl/src/Libdl.jl:109
 [3] macro expansion at /root/.julia/packages/JLLWrappers/KuIwt/src/products/library_generators.jl:61 [inlined]
 [4] __init__() at /root/.julia/packages/Qt_jll/CXLZo/src/wrappers/x86_64-linux-gnu-cxx11.jl:63
 [5] _include_from_serialized(::String, ::Array{Any,1}) at ./loading.jl:697
 [6] _require_from_serialized(::String) at ./loading.jl:749
 [7] _require(::Base.PkgId) at ./loading.jl:1040
 [8] require(::Base.PkgId) at ./loading.jl:928
 [9] require(::Module, ::Symbol) at ./loading.jl:923
during initialization of module Qt_jll

--- long import statement ---

Stacktrace:
 [1] pipeline_error at ./process.jl:525 [inlined]
 [2] read(::Cmd) at ./process.jl:412
 [3] read(::Cmd, ::Type{String}) at ./process.jl:421
 [4] do_ensurecompiled(::String, ::Array{String,1}, ::String) at /root/.julia/packages/PackageCompiler/KeZOk/src/PackageCompiler.jl:194
 [5] create_sysimg_object_file(::String, ::Array{String,1}; project::String, base_sysimage::String, precompile_execution_file::Array{String,1}, precompile_statements_file::Array{String,1}, cpu_target::String, script::Nothing, isapp::Bool) at /root/.julia/packages/PackageCompiler/KeZOk/src/PackageCompiler.jl:261
 [6] create_sysimage(::Array{Symbol,1}; sysimage_path::Nothing, project::String, precompile_execution_file::String, precompile_statements_file::Array{String,1}, incremental::Bool, filter_stdlibs::Bool, replace_default::Bool, cpu_target::String, script::Nothing, base_sysimage::Nothing, isapp::Bool) at /root/.julia/packages/PackageCompiler/KeZOk/src/PackageCompiler.jl:443
...

I think that libQt53DAnimations.so depends on libGL.so.1, which is included in Libglvnd_jll.jl and is not part of the Qt_jll.jl artifacts tree, right?

Is this just a dependency bug?

Yes. @barche :slightly_smiling_face:

So it works if you add Libglvnd_jll manually then? If so, we should probably add this as a real dependency instead of a build dependency. My assumption when building Qt was that it would always be used on a system that has an OpenGL driver installed. I’m not sure anymore if this causes problems at runtime on Linux systems that do have a proper OpenGL setup, though.

Note that the OpenGL stuff is needed only for QML.jl, not for GR, but Qt is a monolithic package so all of this stuff gets dragged in anyway.

A few weeks ago this caused me quite some headaches trying to understand what was going on in a system without opengl already installed: `LibraryProduct` doesn't point to library with soname · Issue #23 · JuliaPackaging/JLLWrappers.jl · GitHub

I added this to my dockerfile before the sysimage build to install libGL.so.

RUN yum install -y mesa-libGL-devel.x86_64

This fixed it, so not through the normal Julia mechanism but I think it would have the same effect.

If you have time, could you try pkg-adding https://github.com/barche/Qt_jll.jl.git instead of installing mesa? It works for me, but my understanding is that libglvnd will dispatch to the underlying system libraries, so it may just postpone the problem. For GR this should be fine, since no OpenGL is actually used.

This also worked for me!

1 Like