Failing to build Julia 1.0.0 with llvm 6.0.1

Not sure if “Usage” is the right category for this. Mods, feel free to move if there’s a better spot.

I’ve been attempting to package Julia 1.0.0 for Void Linux, but I’m running into some issues that I’m assuming are caused by the fact that the system llvm I’m attempting to link against is 6.0.1 rather than the 6.0.0 used when llvm is vendored into Julia. I’ve applied what I believe all the patches are that didn’t make it into 6.0.1 (see this commit), but I’m still getting an error when building (see link to build logs at the end of this post). I’ve determined that this must be a problem with llvm by having all other dependencies vendored in and still get the same error.

The command I used to build was make prefix=/usr sysconfdir=/etc USE_SYSTEM_LLVM=1 USE_LLVM_SHLIB=1. Output from command is at this gist, where you can see the following error at the end:

Sysimage built. Summary:
Total ─────── 120.935331 seconds
Base: ───────  29.056861 seconds 24.0268%
Stdlibs: ────  91.876007 seconds 75.9712%
Warning: git information unavailable; versioning information limited
    JULIA usr/lib/julia/sys-o.a
Generating precompile statements... 762 generated in  49.129458 seconds
Illegal inttoptr
    %scevgep9 = ptrtoint i32 addrspace(13)* %scevgep to i64
Illegal inttoptr
    %scevgep1011 = ptrtoint i32 addrspace(13)* %scevgep10 to i64

signal (6): Aborted
in expression starting at no file:0
__libc_signal_restore_set at /builddir/glibc-2.26/signal/../sysdeps/unix/sysv/linux/nptl-signals.h:80 [inlined]
raise at /builddir/glibc-2.26/signal/../sysdeps/unix/sysv/linux/raise.c:48
abort at /builddir/glibc-2.26/stdlib/abort.c:90
runOnFunction at /builddir/julia/src/llvm-gc-invariant-verifier.cpp:178
_ZN4llvm13FPPassManager13runOnFunctionERNS_8FunctionE at /usr/lib/libLLVM-6.0.so (unknown line)
_ZN4llvm13FPPassManager11runOnModuleERNS_6ModuleE at /usr/lib/libLLVM-6.0.so (unknown line)
_ZN4llvm6legacy15PassManagerImpl3runERNS_6ModuleE at /usr/lib/libLLVM-6.0.so (unknown line)
operator() at /builddir/julia/src/jitlayers.cpp:1182 [inlined]
jl_dump_native at /builddir/julia/src/jitlayers.cpp:1191
jl_write_compiler_output at /builddir/julia/src/precompile.c:84
jl_atexit_hook at /builddir/julia/src/init.c:233
main at /builddir/julia/ui/repl.c:234
__libc_start_main at /builddir/glibc-2.26/csu/../csu/libc-start.c:308
unknown function (ip: 0x55ff9b610609)
Allocations: 57625263 (Pool: 57614339; Big: 10924); GC: 126
/bin/sh: line 1: 19625 Aborted                 /builddir/julia/usr/bin/julia -O3 -C "x86-64" --output-o /builddir/julia/usr/lib/julia/sys-o.a.tmp --starte /builddir/julia/usr/lib/julia/sys.ji /builddir/julia/contrib/generate_precompile.jl /builddir/julia/usr/lib/julia/sys.ji
*** This error is usually fixed by running `make clean`. If the error persists, try `make cleanall`. ***
make[1]: *** [Makefile:216: /builddir/julia/usr/lib/julia/sys-o.a] Error 1
make: *** [Makefile:78: julia-sysimg-release] Error 2

I appreciate any help or insight anyone can give on this. Has anyone successfully built Julia 1.0.0 against LLVM 6.0.1? I don’t think packaging both LLVM 6.0.0 and 6.0.1 is really an option for most distros, and there’s obviously a strong preference to not have Julia vendoring in as large of a dependency as LLVM 6.0.0 especially when 6.0.1 is already packaged.

Julia applies a lot of patches to LLVM. AFAIK, using system llvm will not work in general.

Here is a list of patches applied to the dependencies:

1 Like

Yep. I’ve applied those patches.

Hmm. I could try building with LLVM 6.0.1 real quick and seeing what happens.

It looks like master is already on LLVM 6.01:
https://github.com/JuliaLang/julia/commit/8ba726e44e1739f3cd16677f685ef4d298d4dc28
https://github.com/JuliaLang/julia/commit/f7733f8f6042c12a541af071fce21ac6d5aa5195

1 Like

Good find. Looking at the referenced PR, I’m guessing this is what I’m missing: upgrade to LLVM 6.0.1 by vchuravy · Pull Request #28745 · JuliaLang/julia · GitHub. Thanks!

EDIT: They actually reference the same issue I’m running into on the PR comment chain. This is definitely it. Thanks so much! upgrade to LLVM 6.0.1 by vchuravy · Pull Request #28745 · JuliaLang/julia · GitHub

1 Like