Libgobject has undefined symbol g_dir_unref that makes Plots installation fail

I am working on a university cluster (dev node is a 96 core AMD Epyc) with Julia 1.11.3 running Ubuntu 22.04.

When starting from a fresh install, adding Plots consistently leads to errors in precompiling Cairo_jll, Qt6Base_jll, Harfbuzz_jll, libass_jll, Cairo, GR, GR_jll, FFMPEG, and GLFW_jll, among others, with the error being:

Failed to precompile Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80] to "/mnt/home/$ME/.julia/compiled/v1.11/Plots/jl_HGY4gN".
ERROR: LoadError: InitError: could not load library "/mnt/home/$ME/.julia/artifacts/2710f18abd87950eedcef37211b22fb517ee1043/lib/libgobject-2.0.so"
/mnt/home/$ME/.julia/artifacts/2710f18abd87950eedcef37211b22fb517ee1043/lib/libgobject-2.0.so: undefined symbol: g_dir_unref
Stacktrace:
  [1] dlopen(s::String, flags::UInt32; throw_error::Bool)
    @ Base.Libc.Libdl ./libdl.jl:120
  [2] dlopen(s::String, flags::UInt32)
    @ Base.Libc.Libdl ./libdl.jl:119
  [3] macro expansion
    @ ~/.julia/packages/JLLWrappers/GfYNv/src/products/library_generators.jl:63 [inlined]
  [4] __init__()
    @ Glib_jll ~/.julia/packages/Glib_jll/0M5gZ/src/wrappers/x86_64-linux-gnu.jl:43
  [5] run_module_init(mod::Module, i::Int64)
    @ Base ./loading.jl:1378
  [6] register_restored_modules(sv::Core.SimpleVector, pkg::Base.PkgId, path::String)
    @ Base ./loading.jl:1366
  [7] _include_from_serialized(pkg::Base.PkgId, path::String, ocachepath::String, depmods::Vector{Any}, ignore_native::Nothing; register::Bool)
    @ Base ./loading.jl:1254
  [8] _include_from_serialized (repeats 2 times)
    @ ./loading.jl:1210 [inlined]
  [9] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt128, stalecheck::Bool; reasons::Dict{String, Int64}, DEPOT_PATH::Vector{String})
    @ Base ./loading.jl:2057
 [10] _require(pkg::Base.PkgId, env::String)
    @ Base ./loading.jl:2527
 [11] __require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:2388
 [12] #invoke_in_world#3
    @ ./essentials.jl:1089 [inlined]
 [13] invoke_in_world
    @ ./essentials.jl:1086 [inlined]
 [14] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:2375
 [15] macro expansion
    @ ./loading.jl:2314 [inlined]
 [16] macro expansion
    @ ./lock.jl:273 [inlined]
 [17] __require(into::Module, mod::Symbol)
    @ Base ./loading.jl:2271
 [18] #invoke_in_world#3
    @ ./essentials.jl:1089 [inlined]
 [19] invoke_in_world
    @ ./essentials.jl:1086 [inlined]
 [20] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:2260
 [21] include(mod::Module, _path::String)
    @ Base ./Base.jl:557
 [22] top-level scope
    @ ~/.julia/packages/JLLWrappers/GfYNv/src/toplevel_generators.jl:199
 [23] include
    @ ./Base.jl:557 [inlined]
 [24] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::String)
    @ Base ./loading.jl:2881
 [25] top-level scope
    @ stdin:6
during initialization of module Glib_jll
in expression starting at /mnt/home/$ME/.julia/packages/Cairo_jll/9xtvE/src/wrappers/x86_64-linux-gnu.jl:4
in expression starting at /mnt/home/$ME/.julia/packages/Cairo_jll/9xtvE/src/Cairo_jll.jl:2
in expression starting at stdin:6

(Actual username replaced by $ME for privacy.)

I have seen other links on this (see here, here, and here ) but in those cases people typically got good results just deleting their .julia/ folder or the artifacts folder. This does not work in my case.

Looking at the artifact libgobject-2.0.so with nm -gD I see that g_dir_unref is indeed undefined. It is defined in libglib-2.0.so.

Any ideas on how to make this work?

Do you have the variables LD_LIBRARY_PATH or LD_PRELOAD set? Can you please show the output of versioninfo() in the REPL?

versioninfo():

Julia Version 1.11.3
Commit d63adeda50d (2025-01-21 19:42 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 192 × AMD EPYC 9654 96-Core Processor
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, znver4)
Threads: 1 default, 0 interactive, 1 GC (on 192 virtual cores)
Environment:
  LD_LIBRARY_PATH = /opt/software-current/2023.06/x86_64/generic/software/Julia/1.11.3-linux-x86_64/lib:/opt/software-current/2023.06/x86_64/generic/software/Julia/1.11.3-linux-x86_64/lib/julia:

I unset the LD_LIBRARY_PATH environment variable before I ran that versioninfo(). Now precompiling Plots works. Thanks!

Yeah, don’t set LD_LIBRARY_PATH unless you know what you’re doing. If anything, that should be a local setting only when you actually need it, not to be inflicted to all applications.