# 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

**URL:** <https://discourse.julialang.org/t/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/68289>\
**Category:** General Usage\
**Tags:** question, artifacts, juliacall, glib\_jll\
**Created:** [September 16, 2021, 11:10pm UTC](https://discourse.julialang.org/t/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/68289 "2021-09-16T23:10:26Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![mkarikom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkarikom/32/7096_2.png) [@mkarikom](https://discourse.julialang.org/u/mkarikom)\
**Post date:** [September 16, 2021, 11:10pm UTC](https://discourse.julialang.org/t/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/68289/1 "2021-09-16T23:10:26Z")

</div>

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.

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

```

---

<div class="post-metadata">

**Author:** ![appleparan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/appleparan/32/3802_2.png) [@appleparan](https://discourse.julialang.org/u/appleparan)\
**Post date:** [October 24, 2021, 2:08pm UTC](https://discourse.julialang.org/t/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/68289/2 "2021-10-24T14:08:19Z")

</div>

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

---

<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:** [October 24, 2021, 4:52pm UTC](https://discourse.julialang.org/t/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/68289/3 "2021-10-24T16:52:26Z")

</div>

Copying here same request I made in [it's not working while using Gtk.jl on centos8 · Issue #588 · JuliaGraphics/Gtk.jl · GitHub](https://github.com/JuliaGraphics/Gtk.jl/issues/588#issuecomment-945214423)

> After you get this error, in the same session could you please run the commands
> 
> ```julia
> using Libdl
> filter!(lib -> occursin("glib", lib), dllist())
> 
> ```
> 
> and copy here the output?

---

<div class="post-metadata">

**Author:** ![appleparan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/appleparan/32/3802_2.png) [@appleparan](https://discourse.julialang.org/u/appleparan)\
**Post date:** [November 7, 2021, 12:41am UTC](https://discourse.julialang.org/t/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/68289/4 "2021-11-07T00:41:06Z")

</div>

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

```julia
/libgobject-2.0.so: undefined symbol: g_uri_ref

```

Just

```julia
String[]

```

Even when `precompile` failed. [Here](https://gist.github.com/appleparan/eba5e84de3e90bae9f3a2545151ff422) is my `strace.log` file after setting `ENV["LD_DEBUG"]=all`

---

<div class="post-metadata">

**Author:** ![alexjaffray](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alexjaffray/32/30607_2.png) [@alexjaffray](https://discourse.julialang.org/u/alexjaffray)\
**Post date:** [November 8, 2021, 10:34pm UTC](https://discourse.julialang.org/t/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/68289/5 "2021-11-08T22:34:46Z")

</div>

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”

---

<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:** [November 8, 2021, 10:52pm UTC](https://discourse.julialang.org/t/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/68289/6 "2021-11-08T22:52:56Z")

</div>

What if you start Julia with

```julia
LD_LIBRARY_PATH="" julia

```

?

---

<div class="post-metadata">

**Author:** ![alexjaffray](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alexjaffray/32/30607_2.png) [@alexjaffray](https://discourse.julialang.org/u/alexjaffray)\
**Post date:** [November 8, 2021, 11:02pm UTC](https://discourse.julialang.org/t/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/68289/7 "2021-11-08T23:02:09Z")

</div>

It still gives the error. The output is:

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

```

---

<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:** [November 8, 2021, 11:07pm UTC](https://discourse.julialang.org/t/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/68289/8 "2021-11-08T23:07:46Z")

</div>

So if you start julia with

```julia
LD_LIBRARY_PATH="" LD_PRELOAD="" julia

```

then the output of

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

```

is still

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

```

?

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

---

<div class="post-metadata">

**Author:** ![alexjaffray](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alexjaffray/32/30607_2.png) [@alexjaffray](https://discourse.julialang.org/u/alexjaffray)\
**Post date:** [November 8, 2021, 11:21pm UTC](https://discourse.julialang.org/t/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/68289/9 "2021-11-08T23:21:37Z")

</div>

If I start Julia with:

`LD_LIBRARY_PATH="" LD_PRELOAD="" Julia`

then the output of:

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

```

is:

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

---

<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:** [November 8, 2021, 11:23pm UTC](https://discourse.julialang.org/t/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/68289/10 "2021-11-08T23:23:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Sixzero](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sixzero/32/28737_2.png) [@Sixzero](https://discourse.julialang.org/u/Sixzero)\
**Post date:** [December 3, 2021, 6:09pm UTC](https://discourse.julialang.org/t/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/68289/11 "2021-12-03T18:09:22Z")

</div>

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

> [@real-time camera acquisition and processing, howto](https://discourse.julialang.org/t/real-time-camera-acquisition-and-processing-howto/20398/8):
>
> Indeed! This is the Makie approach I arrived at, with dummy data generated by rand!() and an efficient downsampling approach for lower resolution previews. Also there’s a preview scalefactor speed testing example below which demonstrates that on my setup downsampling is only beneficial at lower than a ~0.5 preview scale factor using Random #For generating fake live video data using Makie, ImageTransformations, Interpolations, Colors, FixedPointNumbers nframes = 500 previewscalefactor = 0.2 …
