JuliaGeo / NetCDF.jl

NetCDF support for the julia programming language
http://juliageo.org/NetCDF.jl/
MIT License
115 stars 28 forks source link

Failing precompilation (MbedTLS) on Arch Linux #144

Closed adigitoleo closed 2 years ago

adigitoleo commented 3 years ago

Hi! Thanks for the package.

I'm currently failing to precompile it on Arch Linux, info below:

julia> versioninfo()
Julia Version 1.6.2
Commit 1b93d53fc4* (2021-07-14 15:36 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-8705G CPU @ 3.10GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, skylake)

I get the following error (emphasis added):

julia> using NetCDF
[ Info: Precompiling NetCDF [30363a11-5582-574a-97bb-aa9a979735b9]
ERROR: LoadError: InitError: could not load library "/home/admin/.julia/artifacts/0a7f440ba143b238cc3dd0def2956d34d76755f3/lib/libnetcdf.so"
**libmbedcrypto.so.5: cannot open shared object file: No such file or directory**
Stacktrace:
 [1] dlopen(s::String, flags::UInt32)
   @ Base.Libc.Libdl ./libdl.jl:114
 [2] macro expansion
   @ ~/.julia/packages/JLLWrappers/bkwIo/src/products/library_generators.jl:54 [inlined]
 [3] __init__()
   @ NetCDF_jll ~/.julia/packages/NetCDF_jll/xjKDT/src/wrappers/x86_64-linux-gnu.jl:14
 [4] top-level scope (repeats 2 times)
   @ none:1
during initialization of module NetCDF_jll
in expression starting at /home/admin/.julia/packages/NetCDF/QftOe/src/NetCDF.jl:1
ERROR: Failed to precompile NetCDF [30363a11-5582-574a-97bb-aa9a979735b9] to /home/admin/.julia/compiled/v1.6/NetCDF/jl_Dp9kFL.
Stacktrace:
 [1] compilecache(pkg::Base.PkgId, path::String, internal_stderr::Base.TTY, internal_stdout::Base.TTY, ignore_loaded_modules::Bool)
   @ Base ./loading.jl:1385

It seems like I have a newer version of that library:

❯ ls /usr/lib/libmbedcrypto.so.7
/usr/lib/libmbedcrypto.so.7

❯ ls /usr/lib/libmbedcrypto.so
/usr/lib/libmbedcrypto.so

❯ ls /usr/lib/libmbedcrypto.so.5
ls: cannot access '/usr/lib/libmbedcrypto.so.5': No such file or directory

I'm not yet familiar with how Julia handles shared libraries at all, but I found a related issue on the Julia tracker. Indeed, my standard library MbedTLS is patched to not use versioned sonames:

❮ grep -n 'libmbedcrypto.so' /usr/share/julia/stdlib/v1.6/MbedTLS_jll/src/MbedTLS_jll.jl
34:    const libmbedcrypto = "libmbedcrypto.so"

So, is there a way to tell this package to use that recipe instead of its own? Should that be happening by default? I haven't yet been able to follow where this package loads its mbedtls from.

Thanks again.

adigitoleo commented 3 years ago

My current workaround was just to create a symlink:

ln -s /usr/lib/libmbedcrypto.so /usr/lib/libmbedcrypto.so.5

All tests are passing with the unversioned .so file.

ghost commented 3 years ago

Same thing happened to me. A workaround is using the julia-bin from aur.

prittjam commented 2 years ago

I have the same problem :(

adigitoleo commented 2 years ago

This is really a problem with the Arch linux package. A similar issue in another Julia package was closed because it works with official Julia binaries. I've moved to using julia-bin for now, but for anyone else who has this issue @prittjam you might want to notify the Arch packagers. There are some prior trackers of interest:

They seem to have been closed, but I just tried with community/julia again and I still get the error.