It does compile on Crystal 1.5.x currently
Any pointers on what I can do would be much appreciated - I’m pulling out some of the less critical shards used for instrumentation etc to see if that has any effect currently
I’d recommend to build the compiler locally and then run with that. It should show more debug info. A meaningful stack trace could help localize the error.
Wow… could you try using a more recent LLVM version? Old LLVM versions were full of bugs. The Crystal team even reported a few of them. This is likely an LLVM bug.
Try to use an LLVM compiled with assertions. Then instead of a segfault we’ll know what went wrong inside LLVM.
Put puts in the methods that are near the end of the backtrace, and report back here with what’s printed, to see if we are clearly doing something wrong.
Now it outputs this when I try to compile any crystal code…
crystal: /llvm-project/llvm/include/llvm/IR/Type.h:389: llvm::Type* llvm::Type::getNonOpaquePointerElementType() const: Assertion `NumContainedTys && "Attempting to get element type of opaque pointer"' failed.
Aborted
That’s after building LLVM with:
cmake -DCMAKE_BUILD_TYPE:STRING=Debug ./llvm
make install
although that made it into crystal 1.5.1 and there are no issues with that version
I noticed that most of our services don’t pass specs when running on crystal 1.6.1
I’m seeing issues like:
Invalid memory access (signal 11) at address 0x7ffdbf0650b0
[0x55d680829ca6] print_backtrace at /usr/share/crystal/src/exception/call_stack/libunwind.cr:100:5
[0x55d68068c5e6] -> at /usr/share/crystal/src/signal.cr:151:5
[0x7f6062743c9f] ?? +140051945372831 in /lib/ld-musl-x86_64.so.1
That occurs running specs using the official crystal lang 1.6.1 image and the 84codes image.
reverting back to crystal 1.5.1 and everything passes (example above is from our rest-api service)
Although I am probably conflating two separate problems
We could revert that commit and see if that fixes the issue. In the end I did that commit in preparation of something else that I never got to do. So reverting it would be harmless.