ldc-developers / ldc

The LLVM-based D Compiler.
http://wiki.dlang.org/LDC
Other
1.22k stars 262 forks source link

segfault when building with musl as libc #3211

Open streaksu opened 5 years ago

streaksu commented 5 years ago

When building ldc from source using musl as its libc on Void Linux I keep facing several segfaults such as:

make[2]: *** [runtime/CMakeFiles/ldc-jit-rt.dir/build.make:70: runtime/objects/ldc/dynamic_compile.o] Segmentation fault (core dumped)

and

make[2]: *** [runtime/CMakeFiles/druntime-ldc-debug-shared.dir/build.make:321: runtime/objects-debug-shared/core/atomic.o] Segmentation fault (core dumped)
make[1]: *** [CMakeFiles/Makefile2:1025: runtime/CMakeFiles/druntime-ldc-debug-shared.dir/all] Error 2
make[2]: *** [runtime/CMakeFiles/phobos2-ldc-common.dir/build.make:363: runtime/objects/etc/c/curl.o] Segmentation fault (core dumped)
make[1]: *** [CMakeFiles/Makefile2:576: runtime/CMakeFiles/phobos2-ldc-common.dir/all] Error 2
make[2]: *** [runtime/CMakeFiles/druntime-ldc-shared.dir/build.make:321: runtime/objects-shared/core/atomic.o] Segmentation fault (core dumped)
make[1]: *** [CMakeFiles/Makefile2:759: runtime/CMakeFiles/druntime-ldc-shared.dir/all] Error 2
make: *** [Makefile:163: all] Error 2

Here is a travis log, it may be helpful.

kinke commented 5 years ago

This can be caused by a problematic host compiler, as LDC is linked against its druntime etc. I see you're using DMD 2.088.1, can you give another one a shot, preferably a prior version of LDC or GDC?

moon-chilled commented 4 years ago

@streaksu any updates on this? Were you able to resolve the issue?

ahesford commented 4 years ago

Setting CMAKE_BUILD_TYPE=RelWithDebInfo (as is done on Alpine) seems to fix this. Not sure about other build types, but the crash definitely occurs if a type is not specifically set.