# Libgobject has undefined symbol g\_dir\_unref that makes Plots installation fail

**URL:** https://discourse.julialang.org/t/libgobject-has-undefined-symbol-g-dir-unref-that-makes-plots-installation-fail/130755
**Category:** Package Management
**Created:** [July 15, 2025, 6:03pm UTC](https://discourse.julialang.org/t/libgobject-has-undefined-symbol-g-dir-unref-that-makes-plots-installation-fail/130755 "2025-07-15T18:03:50Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![psammetichus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/psammetichus/32/405_2.png) [@psammetichus](https://discourse.julialang.org/u/psammetichus)
#### Post date: [July 15, 2025, 6:03pm UTC](https://discourse.julialang.org/t/libgobject-has-undefined-symbol-g-dir-unref-that-makes-plots-installation-fail/130755/1 "2025-07-15T18:03:50Z")

</div>

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:

```julia
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](https://discourse.julialang.org/t/libgobject-2-0-so-0-undefined-symbol-g-dir-unref/112301), [here](https://discourse.julialang.org/t/plots-failed-to-precompile-due-to-error-in-libgobject-2-0-so-and-libqt5concurrent-so/89890), and [here](https://github.com/JuliaPlots/Plots.jl/issues/4921) ) 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?

---

<div class="post-metadata">

### Author: ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)
#### Post date: [July 15, 2025, 6:43pm UTC](https://discourse.julialang.org/t/libgobject-has-undefined-symbol-g-dir-unref-that-makes-plots-installation-fail/130755/2 "2025-07-15T18:43:25Z")

</div>

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

---

<div class="post-metadata">

### Author: ![psammetichus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/psammetichus/32/405_2.png) [@psammetichus](https://discourse.julialang.org/u/psammetichus)
#### Post date: [July 15, 2025, 9:40pm UTC](https://discourse.julialang.org/t/libgobject-has-undefined-symbol-g-dir-unref-that-makes-plots-installation-fail/130755/3 "2025-07-15T21:40:55Z")

</div>

versioninfo():

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

```

---

<div class="post-metadata">

### Author: ![psammetichus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/psammetichus/32/405_2.png) [@psammetichus](https://discourse.julialang.org/u/psammetichus)
#### Post date: [July 15, 2025, 9:46pm UTC](https://discourse.julialang.org/t/libgobject-has-undefined-symbol-g-dir-unref-that-makes-plots-installation-fail/130755/4 "2025-07-15T21:46:52Z")

</div>

I unset the LD\_LIBRARY\_PATH environment variable before I ran that versioninfo(). Now precompiling Plots works. Thanks!

---

<div class="post-metadata">

### Author: ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)
#### Post date: [July 15, 2025, 9:48pm UTC](https://discourse.julialang.org/t/libgobject-has-undefined-symbol-g-dir-unref-that-makes-plots-installation-fail/130755/5 "2025-07-15T21:48:20Z")

</div>

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.
