I recently updated the Plots
package in my working environment just to find that I couldn’t plot anymore as the installation was suddenly broken.
> using Plots
...
WARNING: Method definition airyai(ColorTypes.Color{T, 1} where T) in module ColorVectorSpace at /home/gzagatti/.julia/packages/ColorVectorSpace/QI5vM/src/ColorVectorSpace.jl:315 overwritten in module SpecialFunctionsExt at /home/gzagatti/.julia/packages/ColorVectorSpace/tLy1N/ext/SpecialFunctionsExt.jl:15.
** incremental compilation may be fatally broken for this module **
...
> plot(1)
GKS: libtiff.so.6: cannot open shared object file: No such file or directory
I found out the issue was that when Plots
was updated so was Libtiff_jll
. Now Libtiff_jll
links to version 4.5
of libtiff
which is not available on the official apt
repositories for Ubuntu 22 as you can see from here.
I considered the following options, but I am not completely satisfied with any of them.
-
Add a compat entry to my
Project.toml
environment as described in this discourse thread.It is annoying to add a
compat
entry to every single project that depends onPlots
. Thecompat
entry is only specific to my development environment and not to the project itself. Therefore, I would not like to block upstream updates because my machine does not have access to the right dynamic library.Package resolution should also take into account the dynamic libraries when determining the dependencies it needs. It is weird that version
4.5
ofLibtiff_jll
was selected when in fact the system does not satisfy its requirements.If Julia cannot determine whether non-Julia dependencies are available on the system, I would like to at least have a local-only
compat
entry to tell Julia about the limitations of my system. Similar to adding an entry to.git/info/exclude
when I want to exclude local files from my git repo but don’t want to commit them to.gitignore
. -
Install
libtiff
with Homebrew and modifyENV
instartup.jl
:# startup.jl if isfile("/home/linuxbrew/.linuxbrew/lib/libtiff.so.6") libtiff = dirname(realpath("/home/linuxbrew/.linuxbrew/lib/libtiff.so.6")) ld_library_path = get(ENV, "LD_LIBRARY_PATH", "") ld_library_path = length(ld_library_path) > 0 ? ":$ld_library_path" : "" ENV["LD_LIBRARY_PATH"] = "$libtiff$ld_library_path" end
This didn’t work. Despite the modification to
ENV["LD_LIBRARY_PATH"]
at the very beginning ofstartup.jl
, Julia would still complain.GKS: libtiff.so.6: cannot open shared object file: No such file or directory
- Install
libtiff
with Homebrew and start julia with a modifiedLD_LIBRARY_PATH
.
LD_LIBRARY_PATH=/home/linuxbrew/.linuxbrew/Cellar/libtiff/4.5.1/lib:${LIBRARY_PATH} julia
This worked. However, it does not feel elegant to start julia with a hacked
LD_LIBRARY_PATH
, especially whenldconfig -v
points tolibtiff.so.6
installed via Homebrew.ldconfig
is installed as part ofglibc
with Homebrew and exposed in my path via/home/linuxbrew/.linuxbrew/sbin
.If I have to modify
LD_LIBRARY_PATH
, I would prefer to useLD_LIBRARY_PATH=/home/linux/.linuxbrew/lib:${LIBRARY_PATH}
since this is where Homebrew exposes its dynamic libraries to the system. However, I get a different error:InitError: could not load library "/home/gzagatti/.julia/artifacts/57a2adf6148eab124016172e61e7850ec8bcc217/lib/libpangocairo-1.0.so" /home/linuxbrew/.linuxbrew/lib/libpangoft2-1.0.so.0: undefined symbol: hb_font_set_synthetic_slant during initialization of module Pango_jll
Now,
Pango_jll
is complaining. - Install
At the end I went for option (3) because that is what worked and I didn’t need to modify every single Project.toml
that I came accross. However, I would prefer to go for option (2) because at least everything remains within Julia. It would be great if Julia could pick the modifications in ENV
at startup.
Even better, it would be great to have a file in ~/.julia/config
that tells Julia about our local development constraints.
It would be great to hear your thoughts on this issue. Perhaps someone has a better solution or I have missed some obvious configuration.
Thanks for all the great work on BinaryBuilder.jl
and Yggdrasil
which I had no idea it existed until I came across this error.