Juliacall cant use a package that builds fine outside juliacall <random file path ending in "artifacts">/libgobject-2.0.so: undefined symbol: g_uri_ref

This code has been working without issue on hpc (also using JuliaCall) but when I tried to call it locally I get this error (also julia 1.6.0 to match the cluster environment, even though I have 1.6.1) this :

Note that the package builds fine in native julia regardless of the environment, JuliaCall only chokes locally.

> JuliaCall::julia_library("CompletionEstep")
Error: Error happens in Julia.
InitError: could not load library "/home/au/.julia/artifacts/e086922a5a3c20ca3e6866a33e42d8ec4689553e/lib/libgobject-2.0.so"
/home/au/.julia/artifacts/e086922a5a3c20ca3e6866a33e42d8ec4689553e/lib/libgobject-2.0.so: undefined symbol: g_uri_ref
Stacktrace:
  [1] dlopen(s::String, flags::UInt32; throw_error::Bool)
    @ Base.Libc.Libdl ./libdl.jl:114
  [2] dlopen(s::String, flags::UInt32)
    @ Base.Libc.Libdl ./libdl.jl:114
  [3] macro expansion
    @ ~/.julia/packages/JLLWrappers/bkwIo/src/products/library_generators.jl:54 [inlined]
  [4] __init__()
    @ Glib_jll ~/.julia/packages/Glib_jll/nSLTF/src/wrappers/x86_64-linux-gnu.jl:36
  [5] _include_from_serialized(path::String, depmods::Vector{Any})
    @ Base ./loading.jl:674
  [6] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String)
    @ Base ./loading.jl:760
  [7] _tryrequire_from_serialized(modkey::Base.PkgId, build_id::UInt64, modpath::String)
    @ Base ./loading.jl:689
  [8] _require_

I have a same problem when precompiling Plots.jl, especially Glib_jll. What’s your “Local” environment? I’m using WSL2 + Ubuntu 20.04 in Windows 11 now.

The real problem is that the symbol g_uri_ref can be found in libgobject-2.0.so by nm command

Copying here same request I made in it's not working while using Gtk.jl on centos8 · Issue #588 · JuliaGraphics/Gtk.jl · GitHub

After you get this error, in the same session could you please run the commands

using Libdl
filter!(lib -> occursin("glib", lib), dllist())

and copy here the output?

For me, nothing. I have reset WSL2 & Ubuntu, but it doesn’t resolve the problem.

In my case, I was precompiling Plots and got same error message

/libgobject-2.0.so: undefined symbol: g_uri_ref

Just

String[]

Even when precompile failed. Here is my strace.log file after setting ENV["LD_DEBUG"]=all

I have the same error.

The output of the command @giordano wants (for me) is:

“/lib/x86_64-linux-gnu/libglib-2.0.so.0”

What if you start Julia with

LD_LIBRARY_PATH="" julia

?

It still gives the error. The output is:

InitError: could not load library "/home/ajaffray/.julia/artifacts/e086922a5a3c20ca3e6866a33e42d8ec4689553e/lib/libgio-2.0.so"
/home/ajaffray/.julia/artifacts/e086922a5a3c20ca3e6866a33e42d8ec4689553e/lib/libgobject-2.0.so.0: undefined symbol: g_uri_ref
Stacktrace:
  [1] dlopen(s::String, flags::UInt32; throw_error::Bool)
    @ Base.Libc.Libdl ./libdl.jl:114
  [2] dlopen(s::String, flags::UInt32)
    @ Base.Libc.Libdl ./libdl.jl:114
  [3] macro expansion
    @ ~/.julia/packages/JLLWrappers/bkwIo/src/products/library_generators.jl:54 [inlined]
  [4] __init__()
    @ Glib_jll ~/.julia/packages/Glib_jll/nSLTF/src/wrappers/x86_64-linux-gnu.jl:18
  [5] _include_from_serialized(path::String, depmods::Vector{Any})
    @ Base ./loading.jl:696
  [6] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String)
    @ Base ./loading.jl:782
  [7] _tryrequire_from_serialized(modkey::Base.PkgId, build_id::UInt64, modpath::String)
    @ Base ./loading.jl:711
  [8] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String)
    @ Base ./loading.jl:771
  [9] _tryrequire_from_serialized(modkey::Base.PkgId, build_id::UInt64, modpath::String)
    @ Base ./loading.jl:711
 [10] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String)
    @ Base ./loading.jl:771
 [11] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1020
 [12] require(uuidkey::Base.PkgId)
    @ Base ./loading.jl:936
 [13] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:923
during initialization of module Glib_jll

So if you start julia with

LD_LIBRARY_PATH="" LD_PRELOAD="" julia

then the output of

using Libdl
filter!(lib -> occursin("glib", lib), dllist())

is still

"/lib/x86_64-linux-gnu/libglib-2.0.so.0"

?

Can you please explain what are you doing to reproduce this error?

If I start Julia with:

LD_LIBRARY_PATH="" LD_PRELOAD="" Julia

then the output of:

using Libdl
filter!(lib -> occursin("glib", lib), dllist())

is:

String[]

This is consistent with what should happen when clearing the LD_LIBRARY_PATH env variable. I have discovered the reason why I was getting the error before. The LD_LIBRARY_PATH variable was being set improperly (or not at all). Prepending /lib to LD_LIBRARY_PATH solved my problem.

Yes, immediately after starting Julia I wouldn’t expect libglib to be loaded at all, that’s fine. You should check after you get the error, that I don’t know how you’re triggering

I copied the snipet from here, and also received this error: