PackageCompiler.jl
PackageCompiler.jl copied to clipboard
Crash while building sysimage
Building an sysimage with Julia 1.4.2 on Ubuntu 20.04 fails with the following output:
julia> versioninfo()
Julia Version 1.4.2
Commit 44fa15b150* (2020-05-23 18:35 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-8.0.1 (ORCJIT, skylake)
Environment:
JULIA_NUM_THREADS = 1
julia> using PackageCompiler
julia> PackageCompiler.create_sysimage([:ApproxFun,:Plots], precompile_execution_file="precompile_approxfun.jl", replace_default=true)
[ Info: PackageCompiler: creating system image object file, this might take a while...
Two passes with the same argument (-LowerPTLS) attempted to be registered!
signal (11): Segmentation fault
in expression starting at REPL[2]:1
_ZN4llvm14PassNameParser13passEnumerateEPKNS_8PassInfoE at /home/mocar/julia-1.4.2/bin/../lib/julia/libLLVM-8jl.so (unknown line)
Allocations: 11949240 (Pool: 11945748; Big: 3492); GC: 13
I have been playing around with PackageCompiler, too, trying to figure out what it does since the manual instructions are not quite complete or working.
In any case, one thing I have been doing is setting ENV["JULIA_DEBUG"]="all"
previous to using PackageCompiler and, then, it prints out a lot of information; this information along with having PackageCompiler.jl
opened in an editor and you may figure out what is going wrong.
I'm not sure how this happens. If possible, it would be good to try to reduce it a bit to see if it is some specific package that causes it to happen.
I get the same exact error when running e.g. create_sysimage(:Pipe; sysimage_path="Test.so")
:
[ Info: PackageCompiler: creating system image object file, this might take a while...
Two passes with the same argument (-LowerPTLS) attempted to be registered!
signal (11): Segmentation fault
in expression starting at REPL[4]:1
_ZN4llvm14PassNameParser13passEnumerateEPKNS_8PassInfoE at /sw/easybuild/software/Julia/1.5.1-linux-x86_64/bin/../lib/julia/libLLVM-9jl.so (unknown line)
Allocations: 4411211 (Pool: 4409368; Big: 1843); GC: 5
Segmentation fault (core dumped)
when I'm running in a secure environment (i.e. no internet access) on CentOS Linux release 7.9.2009 (Core).
I have tried both Julia 1.4.2 and Julia 1.5.1. (Newer versions are not available in that environment.) PackageCompiler is v1.2.5.
I have also tried a couple of packages, without precompile scripts:
- Pipe v1.3.0
- Compat v3.25.0
- DocOpt v0.4.2
For both Julia versions and all packages, the crashes are identical.
Here's the versioninfo()
Julia Version 1.5.1
Commit 697e782ab8 (2020-08-25 20:08 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Xeon(R) CPU E5-2660 v3 @ 2.60GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-9.0.1 (ORCJIT, haswell)
On the other hand, everything works well for me with Julia 1.5.1 running on another computer with Ubuntu 20.04.
Hence, as a workaround I can build on the other computer using create_sysimage(...; cpu_target="generic;sandybridge,-xsaveopt,clone_all;haswell,-rdrnd,base(1)")
. Maybe this workaround is useful for someone else too.
this happens to me even for just the PackageCompiler example OhMyREPL on julia 1.6 PackageCompiler 1.2.5
julia> PackageCompiler.create_sysimage(:OhMyREPL;sysimage_path="julia_code/")
[ Info: PackageCompiler: creating system image object file, this might take a while...
Two passes with the same argument (-LowerPTLS) attempted to be registered!
signal (4): Illegal instruction: 4
in expression starting at REPL[5]:1
_ZN4llvm14PassNameParser14passRegisteredEPKNS_8PassInfoE at /Users/roger/.ion/packages/Julia-1.6.app/Contents/Resources/julia/lib/julia/libLLVM.dylib (unknown line)
_ZN4llvm12PassRegistry12registerPassERKNS_8PassInfoEb at /Users/roger/.ion/packages/Julia-1.6.app/Contents/Resources/julia/lib/julia/libLLVM.dylib (unknown line)
_GLOBAL__sub_I_llvm_ptls.cpp at /Users/roger/.ion/packages/Julia-1.6.app/Contents/Resources/julia/lib/julia/libjulia-internal.dylib (unknown line)
Allocations: 10310292 (Pool: 10306208; Big: 4084); GC: 13
[1] 72353 illegal hardware instruction julia
my Julia version info
julia> versioninfo()
Julia Version 1.6.1
Commit 6aaedecc44 (2021-04-23 05:59 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: AMD Ryzen 9 3900X 12-Core Processor
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-11.0.1 (ORCJIT, znver2)
I have gotten this error as well (except it manifests with LLVM ERROR: out of memory
) within a Singularity container based off of CentOS 7's official Docker image.
My issue may also be due to genuinely not enough memory, see also #384 and #412.
[ Info: PackageCompiler: creating system image object file, this might take a while...
Two passes with the same argument (-LowerPTLS) attempted to be registered!
LLVM ERROR: out of memory
signal (6): Aborted
in expression starting at none:1
gsignal at /lib64/libc.so.6 (unknown line)
abort at /lib64/libc.so.6 (unknown line)
_ZN4llvm22report_bad_alloc_errorEPKcb at /JULIA_DIST/lib/julia/libLLVM-11jl.so (unknown line)
_ZN4llvm14PassNameParser14passRegisteredEPKNS_8PassInfoE at /JULIA_DIST/lib/julia/libLLVM-11jl.so (unknown line)
_ZN4llvm12PassRegistry12registerPassERKNS_8PassInfoEb at /JULIA_DIST/lib/julia/libLLVM-11jl.so (unknown line)
RegisterPass at /buildworker/worker/package_linux64/build/usr/include/llvm/PassSupport.h:101 [inlined]
__static_initialization_and_destruction_0 at /buildworker/worker/package_linux64/build/src/llvm-ptls.cpp:275 [inlined]
_GLOBAL__sub_I_llvm_ptls.cpp at /buildworker/worker/package_linux64/build/src/llvm-ptls.cpp:287
_dl_init at /lib64/ld-linux-x86-64.so.2 (unknown line)
dl_open_worker at /lib64/ld-linux-x86-64.so.2 (unknown line)
_dl_catch_error at /lib64/ld-linux-x86-64.so.2 (unknown line)
_dl_open at /lib64/ld-linux-x86-64.so.2 (unknown line)
dlopen_doit at /lib64/libdl.so.2 (unknown line)
_dl_catch_error at /lib64/ld-linux-x86-64.so.2 (unknown line)
_dlerror_run at /lib64/libdl.so.2 (unknown line)
dlopen at /lib64/libdl.so.2 (unknown line)
jl_load_dynamic_library at /buildworker/worker/package_linux64/build/src/dlload.c:257
#dlopen#3 at ./libdl.jl:114
dlopen at ./libdl.jl:114 [inlined]
dlopen at ./libdl.jl:114 [inlined]
dlpath at ./libdl.jl:237
create_sysimg_from_object_file at /DOTJULIA/packages/PackageCompiler/ztq60/src/PackageCompiler.jl:497
After debugging this for a while on our CI system, I discovered that the fundamental error in our case was that LD_LIBRARY_PATH
was set to include a different Julia installation's library directory. This caused Julia's internal lookup of libjulia-internal
's path (via dlpath("libjulia-internal")
) to actually load a second libjulia-internal
, which causes the LLVM error. If you're facing this error, ensure that you don't have LD_LIBRARY_PATH
set.
I had this error because my libjulia.so.1 and libjulia.so were different files (not symlinks). Not sure how they got like that but it was easy enough to fix.