Julia LLVM issue

My distro (Antergos; x86_64 Linux 4.12.13-1-ARCH) recently updated to LLVM 5 and my julia installation (https://aur.archlinux.org/packages/julia-mkl/) stopped working since it was searching for LLVM 4 libs. I removed the package and installed the julia version from the arch repo (Arch Linux - julia 2:1.7.3-3 (x86_64)).
After this switch I encountered a strange segfault which I could not reproduce on another system. I tried recompiling all the packages and the system image, but it didn’t help.
The error looks like this:

signal (11): Segmentation fault
while loading /run/media/user/Windows/Users/sebastian/Documents/Physics/Projects/Nuclear_surface_vibrations/classical/src/plot_poincare.jl, in expression starting on line 86
unknown function (ip: 0x7f55a08de761)
unknown function (ip: 0x7f55a08e05d4)
_ZN4llvm12RegAllocBase16postOptimizationEv at /usr/bin/../lib/libLLVM-3.9.so (unknown line)
unknown function (ip: 0x7f55a0a2f1d7)
_ZN4llvm19MachineFunctionPass13runOnFunctionERNS_8FunctionE at /usr/bin/../lib/libLLVM-3.9.so (unknown line)
_ZN4llvm13FPPassManager13runOnFunctionERNS_8FunctionE at /usr/bin/../lib/libLLVM-3.9.so (unknown line)
_ZN4llvm13FPPassManager11runOnModuleERNS_6ModuleE at /usr/bin/../lib/libLLVM-3.9.so (unknown line)
_ZN4llvm6legacy15PassManagerImpl3runERNS_6ModuleE at /usr/bin/../lib/libLLVM-3.9.so (unknown line)
unknown function (ip: 0x7f55a3b5799d)
unknown function (ip: 0x7f55a3b5d34f)
unknown function (ip: 0x7f55a3b5de27)
unknown function (ip: 0x7f55a3b109b1)
unknown function (ip: 0x7f55a3b4dc07)
jl_apply_generic at /usr/bin/../lib/libjulia.so.0.6 (unknown line)
#nlsolve at ./<missing>:0
#call#17 at /home/user/.julia/v0.6/DiffEqCallbacks/src/manifold.jl:40
unknown function (ip: 0x7f5565c7a21d)
jl_apply_generic at /usr/bin/../lib/libjulia.so.0.6 (unknown line)
ManifoldProjection at /home/user/.julia/v0.6/DiffEqCallbacks/src/manifold.jl:87
apply_discrete_callback! at /home/user/.julia/v0.6/OrdinaryDiffEq/src/callbacks.jl:183 [inlined]
handle_callbacks! at /home/user/.julia/v0.6/OrdinaryDiffEq/src/integrators/integrator_utils.jl:308
loopfooter! at /home/user/.julia/v0.6/OrdinaryDiffEq/src/integrators/integrator_utils.jl:271
solve! at /home/user/.julia/v0.6/OrdinaryDiffEq/src/solve.jl:323
unknown function (ip: 0x7f5565c65002)
jl_apply_generic at /usr/bin/../lib/libjulia.so.0.6 (unknown line)
#solve#1832 at /home/user/.julia/v0.6/OrdinaryDiffEq/src/solve.jl:7
unknown function (ip: 0x7f558b2b9166)
jl_apply_generic at /usr/bin/../lib/libjulia.so.0.6 (unknown line)
jl_invoke at /usr/bin/../lib/libjulia.so.0.6 (unknown line)
#solve at ./<missing>:0
#poincareSection!#1 at /run/media/user/Windows/Users/sebastian/Documents/Physics/Projects/Nuclear_surface_vibrations/classical/src/poincare.jl:21
unknown function (ip: 0x7f558b2b7b73)
jl_apply_generic at /usr/bin/../lib/libjulia.so.0.6 (unknown line)
#poincareSection! at ./<missing>:0
unknown function (ip: 0x7f558b2b680c)
jl_apply_generic at /usr/bin/../lib/libjulia.so.0.6 (unknown line)
#createMap#7 at /run/media/user/Windows/Users/sebastian/Documents/Physics/Projects/Nuclear_surface_vibrations/classical/src/poincare.jl:96
unknown function (ip: 0x7f558b276ea9)
jl_apply_generic at /usr/bin/../lib/libjulia.so.0.6 (unknown line)
createMap at /run/media/user/Windows/Users/sebastian/Documents/Physics/Projects/Nuclear_surface_vibrations/classical/src/poincare.jl:85
unknown function (ip: 0x7f558b2768d3)
jl_apply_generic at /usr/bin/../lib/libjulia.so.0.6 (unknown line)
unknown function (ip: 0x7f55a3ac051f)
unknown function (ip: 0x7f55a3abf64e)
unknown function (ip: 0x7f55a3ac0453)
unknown function (ip: 0x7f55a3ad8585)
unknown function (ip: 0x7f55a3ab4ec6)
jl_load at /usr/bin/../lib/libjulia.so.0.6 (unknown line)
include_from_node1 at ./loading.jl:569
unknown function (ip: 0x7f559c3c87fb)
jl_apply_generic at /usr/bin/../lib/libjulia.so.0.6 (unknown line)
include at ./sysimg.jl:14
unknown function (ip: 0x7f559c26c38b)
jl_apply_generic at /usr/bin/../lib/libjulia.so.0.6 (unknown line)
process_options at ./client.jl:305
_start at ./client.jl:371
unknown function (ip: 0x7f559c3d4318)
jl_apply_generic at /usr/bin/../lib/libjulia.so.0.6 (unknown line)
unknown function (ip: 0x558ed4e5dc4b)
unknown function (ip: 0x558ed4e5d652)
__libc_start_main at /usr/bin/../lib/libc.so.6 (unknown line)
unknown function (ip: 0x558ed4e5d709)
Allocations: 46266621 (Pool: 46254919; Big: 11702); GC: 91
[1]    23041 segmentation fault (core dumped)  julia plot_poincare.jl

Here is a gist with 3 files

  • segfault.ipynb is with the output from my machine, and the kernel crashes
  • segfault.txt is with what happens if I download the above as .jl and run it
  • segfault_remote.ipynb is with the output from a remote server where everything is working as expected

https://gist.github.com/SebastianM-C/16343e6869b303b609e51bef090f208b

Would reinstalling julia (again) help? If so how should I properly do this?

The arch package appears to be using unpatched system llvm 3.9.1. This is not a supported LLVM version and requires a lot of patches. Given that you see a crash in llvm this can easily be the reason.

You have a few options.

  1. Just use the official precompiled binary. You can make a julia-bin package from that too if you want.
  2. Compile your own llvm 3.9. The working Arch PKGBUILD for julia compatible llvm I maintain is in the archlinuxcn repo. It is at 5.0 now so you’ll need to fetch and build an old version. You can find it here https://github.com/archlinuxcn/repo/tree/2eb10e13d950f3c876c05dc2595704daa9827b03/llvm-julia
  3. Compile your own compatilbe llvm 4.0 binary. The bare version might work without crashes on julia 0.6 but almost certainly with some performance issues. The llvm-julia version is also available. The ArchLinuxCN server caches the last version so you can find the binary here Index of /x86_64/ It conflicts with llvm package though so you’ll need to either manually patch the package or compile one you own.
  4. The julia-git package from archlinuxcn repo should also work, it’s nightly version though so I won’t recommend it unless you are willing to deal with breakage from nightly.

Thanks for the detailed reply!
I have some questions regarding options 2 and 3: Does julia need to be rebuilt if I were to use the newer llvm-julia (version 5) from archlinuxcn? Would it be safe to replace the system llvm (which is also version 5) with llvm-julia?
Also, if I were to use the 3.9 version you linked, from the PKGBUILD I see that it would conflict with the llvm package. I have both a llvm & llvm-libs packages (system) and llvm39-libs (installed by the arch repo julia package).

It looks like I have only llvm39-libs, but not llvm39. Could the combination of llvm5 & llvm39-libs be part of the problem?

Yes, also I don’t think 0.6 supports LLVM 5.0

You only need llvm{,39}-libs the llvm package is only for compilation (static libs, tools, headers). If you want to compile your non-5.0 LLVM package, you’ll need to modify the PKGBUILD based on llvm39-libs so that it doesn’t conflict with llvm package anymore.

I don’t have any experience with modifying PKGBUILDs. Could you please tell me how should it be modified or where to find an example? Or do you think that it would be better to use the precompiled binaries (solution 1.)?

If you don’t have any experience with making your own package, it’s better to just use precompiled binaries. The modification mainly involve changing package name, changing provides, changing conflicts, removing conflicting files etc.

@yuyichao If you are a regular Archlinux user, could I ask you to put a line of warning to the international archlinux wiki for this issue?
I could also do it, what should we write to it?
Maybe something more informative than what is stated on the julia website (eg. “It is strongly recommended that the official generic linux binaries from the downloads page be used to install Julia.”)