Installing julia ImageView

I’m try to install the Julia ImageView package within the Julia environment. This has a compilation stage which fails with missing libraries when trying to execute gdk-pixbuf-query-loaders which I think it has built itself.

I’m using this nix-shell command to set up an environment:

nix-shell -p julia-bin gdk-pixbuf-xlib gdk-pixbuf gtk2-x11 gtk2 gtk3 glfw glib glib.out libGL gnome2.GConf gnome2.gdk_pixbuf

Here’s the Julia failure:

julia> using ImageView
[ Info: Precompiling ImageView [86fae568-95e7-573e-a6b2-d8a6b900c9ef]
ERROR: LoadError: InitError: IOError: could not spawn `/home/jk/.julia/artifacts/95045289183d1ae3c119c957404678bfa2dc8ed2/bin/gdk-pixbuf-query-loaders`: no such file or directory (ENOENT)

and here are the missing libraries:

[nix-shell:~]$ ldd .julia/artifacts/95045289183d1ae3c119c957404678bfa2dc8ed2/bin/gdk-pixbuf-query-loaders
	linux-vdso.so.1 (0x00007fffe8963000)
	libglib-2.0.so.0 => not found
	libgobject-2.0.so.0 => not found
	libgmodule-2.0.so.0 => not found
	libgio-2.0.so.0 => not found
	libpthread.so.0 => /nix/store/4nlgxhb09sdr51nc9hdm8az5b08vzkgx-glibc-2.35-163/lib/libpthread.so.0 (0x00007f7505eeb000)
	libc.so.6 => /nix/store/4nlgxhb09sdr51nc9hdm8az5b08vzkgx-glibc-2.35-163/lib/libc.so.6 (0x00007f7505ce0000)
	/lib64/ld-linux-x86-64.so.2 => /nix/store/4nlgxhb09sdr51nc9hdm8az5b08vzkgx-glibc-2.35-163/lib64/ld-linux-x86-64.so.2 (0x00007f7505ef2000)

These all look like very basic gnome libraries - so I need to be actually running gnome to build stuff that uses its libraries? I’m using i3.

You only need glib, not entirety of gnome. Either try setting LD_LIBRARY_PATH or patchelf.

Nix-ld: A clean solution for issues with pre-compiled executables on Nixos might be of interest here too.

Note that ldd doesn’t give an accurate output for julia packages. Julia packages distribute binary libraries in so called “artifacts” where they are wrapped into JLL modules which instruct dlopen where to find them. See GitHub - JuliaPackaging/JLLWrappers.jl

nix-ld does not work for interpreter but read this for a workaround: GitHub - Mic92/nix-ld: Run unpatched dynamic binaries on NixOS