Building Julia works ok if I am using the correct incantations in Makefile.user (using dports gcc-6.3.0 and llvm-3.9.1). I haven’t looked at libunwind yet, so libunwind is unfortunately disabled.
The build fails when compiling precompile.jl:
/scratch/makx/julia/base/precompile.jl
Assertion failed: (castIsValid(op, S, Ty) && "Invalid cast!"), function Create, file /construction/devel/llvm39/llvm-3.9.1.src/lib/IR/Instructions.cpp, line 2648.
signal (6): Abort trap
Generally the way to debug this is to attach a debugger and see what cast it was attempting to do. From there you can usually find out why the cast was illegal and fix it appropriately.
Thanks for the suggestion. I tried running the julia process in gdb, but am not really able to make sense of what is happening; the backtrace is as follows, and there doesn’t seem anything to inspect:
#4 0x0000000801ed3474 in llvm::CastInst::Create(llvm::Instruction::CastOps, llvm::Value*, llvm::Type*, llvm::Twine const&, llvm::Instruction*) () from /usr/local/llvm39/lib/libLLVM-3.9.so
#5 0x00000008028d4e48 in ?? () from /usr/local/llvm39/lib/libLLVM-3.9.so
#6 0x00000008028d54a3 in ?? () from /usr/local/llvm39/lib/libLLVM-3.9.so
#7 0x00000008028e2b4b in ?? () from /usr/local/llvm39/lib/libLLVM-3.9.so
#8 0x00000008028e62f5 in ?? () from /usr/local/llvm39/lib/libLLVM-3.9.so
#9 0x00000008028e77e5 in llvm::SROA::runOnAlloca(llvm::AllocaInst&) () from /usr/local/llvm39/lib/libLLVM-3.9.so
#10 0x00000008028e8f63 in llvm::SROA::runImpl(llvm::Function&, llvm::DominatorTree&, llvm::AssumptionCache&) () from /usr/local/llvm39/lib/libLLVM-3.9.so
#11 0x00000008028ead25 in ?? () from /usr/local/llvm39/lib/libLLVM-3.9.so
#12 0x0000000801eeb0de in llvm::FPPassManager::runOnFunction(llvm::Function&) () from /usr/local/llvm39/lib/libLLVM-3.9.so
#13 0x0000000802aa3e10 in ?? () from /usr/local/llvm39/lib/libLLVM-3.9.so
#14 0x0000000801eead01 in llvm::legacy::PassManagerImpl::run(llvm::Module&) () from /usr/local/llvm39/lib/libLLVM-3.9.so
#15 0x000000080075c6d6 in jl_dump_native (bc_fname=<optimized out>, unopt_bc_fname=<optimized out>, obj_fname=<optimized out>, sysimg_data=0x865400000 "\003\005u\244", sysimg_len=89199684)
at /home/makx/dev/julia/src/jitlayers.cpp:1220
#16 0x00000008006e2ad1 in jl_write_compiler_output () at /home/makx/dev/julia/src/precompile.c:84
#17 0x00000008006b2745 in jl_atexit_hook (exitcode=exitcode@entry=0) at /home/makx/dev/julia/src/init.c:238
#18 0x000000000040152c in main (argc=<optimized out>, argv=<optimized out>) at /home/makx/dev/julia/ui/repl.c:252
I would really prefer not to compile LLVM myself.
If I build julia-debug everything works fine (but I guess performance will be lacking). If I try using sys.o as built with julia-debug I get the following error:
Two passes with the same argument (-juliaO0) attempted to be registered!
UNREACHABLE executed at /construction/devel/llvm39/llvm-3.9.1.src/include/llvm/IR/LegacyPassNameParser.h:74!
fish: “/home/makx/dev/julia/usr/bin/ju…” terminated by signal SIGABRT (Abort)
(I admit I am trying something desperate here.
So is the only solution to go and compile LLVM and hope it gives me better debug-info?
Whether or not the provided LLVM version will work depends on whether the distribution ships accumulated bug fixes or is has a new enough versions. Sometimes those bugs merely degrade performance, sometimes they cause crashes. It is infeasible for us to determine which systems ship usable LLVM versions. Same situation with the other dependencies as well.
Is there any released LLVM version that works? Neither 3.9.1 nor 4.0.1 (give the same error) nor 5 (julia doesn’t even compile) work for various reasons.
The 3.9 that comes inside the Julia repository does not build on my system, either.
I think LLVM 5 has most of our bug fixes, but nobody has done the work yet to adjust to whatever API changes they introduced. As a result, I suspect the answer is no right now, until somebody does that. Several distributions to ship patched releases though that include some of our patches.
Building with the julia LLVM 3.9 + DragonFly (dports) patches yields a useable Julia which I will now run tests on.
What would be the process to get my port into mainline, if at all possible? Do you have buildbot support so I could notice if this port breaks more quickly?