Cxx.jl
Cxx.jl copied to clipboard
Build fails because path to libLLVM hard coded
The build fails on Arch Linux because the LLVM lib used by Julia is the system library while in the build, the path is hardcoded. The error I get is
$ PREBUILT_CI_BINARIES=1 julia -e 'Pkg.build("Cxx")'
INFO: Building Cxx
--2017-03-19 15:05:56-- https://s3.amazonaws.com/julia-cxx/llvm-linux-3.9.1.tgz
Loaded CA certificate '/etc/ssl/certs/ca-certificates.crt'
Resolving s3.amazonaws.com... 52.216.0.43
Connecting to s3.amazonaws.com|52.216.0.43|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 230366074 (220M) [application/x-tar]
Saving to: ‘llvm-linux-3.9.1.tgz’
llvm-linux-3.9.1.tgz 100%[=====================================================================================================>] 219.69M 660KB/s in 5m 47s
2017-03-19 15:11:44 (648 KB/s) - ‘llvm-linux-3.9.1.tgz’ saved [230366074/230366074]
writing path.jl file
Tuning for julia installation at /usr/bin with sources possibly at /usr/bin/../..
INFO: Building julia binary build
make: *** No rule to make target '/usr/bin/../lib/julia/libLLVM.so', needed by 'build/bootstrap.o'. Stop.
========================================================================================[ ERROR: Cxx ]========================================================================================
LoadError: failed process: Process(`make -j8 -f BuildBootstrap.Makefile BASE_JULIA_BIN=/usr/bin BASE_JULIA_SRC=/usr/bin/../..`, ProcessExited(2)) [2]
while loading /home/blegat/.julia/v0.5/Cxx/deps/build.jl, in expression starting on line 54
==============================================================================================================================================================================================
=======================================================================================[ BUILD ERRORS ]=======================================================================================
WARNING: Cxx had build errors.
- packages with build errors remain installed in /home/blegat/.julia/v0.5
- build the package(s) and all dependencies with `Pkg.build("Cxx")`
- build a single package by running its `deps/build.jl` script
==============================================================================================================================================================================================
Note that the current julia package of Arch Linux does not include any LLVM file so it fails earlier with Libdl.dlpath(llvm_path)
. For this reason I have filed this bug and the julia package in community-testing now uses the LLVM system library.
@blegat have you managed to circumvent/fix this bug?
Not really :( If you just want a hack for it to work for you you can hardcode it to the path to libLLVM on your machine.
That's a pity. I had to compile julia from source to get this package to work.
@pwl you can change deps/BuildBootstrap.Makefile Line 161:
LIB_DEPENDENCY += $(LIBDIR)/lib$(LLVM_LIB_NAME).$(SHLIB_EXT)
to
LIB_DEPENDENCY += /usr/lib/libLLVM.so
if you use archlinux.
On Arch Linux, I actually had to change deps/BuildBootstrap.Makefile:161 from
LIB_DEPENDENCY += $(LIBDIR)/lib$(LLVM_LIB_NAME).$(SHLIB_EXT)
to
LIB_DEPENDENCY += /usr/lib/libLLVM-4.0.so
and, deps/build.jl:37 from
llvm_path = is_apple[...]"libLLVM-$(Base.libllvm_version)"
to
llvm_path = "libLLVM-4.0"
It then proceeds to happily build (for quite a while) after Pkg.build("Cxx"). Hope this helps someone.
Is this only with the Julia package in AUR or do you get the same behavior using the official Linux binaries downloaded from https://julialang.org/downloads?
Not sure if it is the same issue.
I'm using Debian Testing (Bullseye), and I encounter LoadError complaining about missing libLLVM-8.0.1.so
ERROR: LoadError: could not load library "libLLVM-8.0.1"
But I'm pretty sure I have one in /usr/lib/llvm-8/lib
and that /lib
is symlinked to /usr/lib
.
julia> versioninfo()
Julia Version 1.3.0
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-8.0.1 (ORCJIT, skylake)
(jlHEP) pkg> build Cxx
Building Cxx → `~/.julia/packages/Cxx/UZsgx/deps/build.log`
┌ Error: Error building `Cxx`:
│ ERROR: LoadError: could not load library "libLLVM-8.0.1"
│ libLLVM-8.0.1.so: cannot open shared object file: No such file or directory
│ Stacktrace:
│ [1] #dlopen#3(::Bool, ::typeof(dlopen), ::String, ::UInt32) at /build/julia-UlDvzA/julia-1.3.0+dfsg/usr/share/julia/stdlib/v1.3/Libdl/src/Libdl.jl:109
│ [2] dlopen at /build/julia-UlDvzA/julia-1.3.0+dfsg/usr/share/julia/stdlib/v1.3/Libdl/src/Libdl.jl:109 [inlined] (repeats 2 times)
│ [3] dlpath(::String) at /build/julia-UlDvzA/julia-1.3.0+dfsg/usr/share/julia/stdlib/v1.3/Libdl/src/Libdl.jl:232
│ [4] top-level scope at /home/shamrock/.julia/packages/Cxx/UZsgx/deps/build.jl:35
│ [5] include at ./boot.jl:328 [inlined]
│ [6] include_relative(::Module, ::String) at ./loading.jl:1105
│ [7] include(::Module, ::String) at ./Base.jl:31
│ [8] include(::String) at ./client.jl:424
│ [9] top-level scope at none:5
│ in expression starting at /home/shamrock/.julia/packages/Cxx/UZsgx/deps/build.jl:35
│ writing path.jl file
│ Tuning for julia installation at /usr/bin with sources possibly at /usr/bin/../..
└ @ Pkg.Operations /build/julia-UlDvzA/julia-1.3.0+dfsg/usr/share/julia/stdlib/v1.3/Pkg/src/backwards_compatible_isolation.jl:649
I have the same problem (on arch linux, using the binary package). Temporary fix that worked for me is a symlink in /lib
:
sudo ln -s libLLVM-10.0.0.so libLLVM-8.0.1.so
Btw.: This bug affected me as well https://github.com/JuliaInterop/Cxx.jl/issues/464 (I downgraded julia to 1.3 to make it work).