ldc-developers / ldc

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

failled to build ldc 1.15.0 with llvm/8.0.0 and clang++ #3063

Closed bioinfornatics closed 5 years ago

bioinfornatics commented 5 years ago

Dear,

I installed LLVM/8.0.0 with clang++ and tried to build ldc2.

But the phobos compilation imply a segmentation fault from ldc2

export LDFLAGS+=" -lc++ -lLLVM -Wl,-z,relro -Wl,-z,now -Wl,--as-needed"
export CC="$(which clang)"
export CXX="$(which clang++)"
pushd build
    cmake -DCMAKE_INSTALL_PREFIX:PATH="${PREFIX}" \
          -DINCLUDE_INSTALL_DIR:PATH="${PREFIX}"/include/d  \
          -DSYSCONF_INSTALL_DIR:PATH="${PREFIX}"/etc \
          -DMULTILIB:BOOL=OFF \
          -DBUILD_SHARED_LIBS:BOOL=ON \
          -DLLVM_ROOT_DIR:PATH="${LLVM_ROOT}" \
          -DD_COMPILER:PATH="${DMD_EXEDIR}/dmd" \
          -DCMAKE_BUILD_TYPE=Release \
          --enable-optimized \
          .. | grep -Eiv 'errors.d'
    make ${_smp_mflags}  VERBOSE=2
/tmp/d-llvm-1.15.0/build/bin/ldc2 -c --output-o -conf= -w -g -link-defaultlib-debug -relocation-model=pic -d-version=Shared -I/tmp/d-llvm-1.15.0/runtime/druntime/src -od=/tmp/d-llvm-1.15.0/build/runtime/objects-debug-shared -op core/atomic.d core/attribute.d core/bitop.d core/checkedint.d core/cpuid.d core/demangle.d core/exception.d core/internal/abort.d core/internal/arrayop.d core/internal/convert.d core/internal/dassert.d core/internal/hash.d core/internal/parseoptions.d core/internal/spinlock.d core/internal/string.d core/internal/traits.d core/internal/utf.d core/lifetime.d core/math.d core/memory.d core/runtime.d core/simd.d core/stdc/assert_.d core/stdc/complex.d core/stdc/config.d core/stdc/ctype.d core/stdc/errno.d core/stdc/fenv.d core/stdc/float_.d core/stdc/inttypes.d core/stdc/limits.d core/stdc/locale.d core/stdc/math.d core/stdc/signal.d core/stdc/stdarg.d core/stdc/stddef.d core/stdc/stdint.d core/stdc/stdio.d core/stdc/stdlib.d core/stdc/string.d core/stdc/tgmath.d core/stdc/time.d core/stdc/wchar_.d core/stdc/wctype.d core/sync/barrier.d core/sync/condition.d core/sync/config.d core/sync/exception.d core/sync/mutex.d core/sync/rwmutex.d core/sync/semaphore.d core/thread.d core/time.d core/vararg.d gc/bits.d gc/config.d gc/gcinterface.d gc/impl/conservative/gc.d gc/impl/manual/gc.d gc/impl/proto/gc.d gc/os.d gc/pooltable.d gc/proxy.d gc/registry.d ldc/asan.d ldc/attributes.d ldc/dcompute.d ldc/eh_msvc.d ldc/sanitizer_common.d ldc/sanitizers_optionally_linked.d object.d rt/aApply.d rt/aApplyR.d rt/aaA.d rt/adi.d rt/arrayassign.d rt/arraycast.d rt/arraycat.d rt/backtrace/dwarf.d rt/backtrace/elf.d rt/backtrace/macho.d rt/cast_.d rt/cmath2.d rt/config.d rt/cover.d rt/critical_.d rt/deh.d rt/deh_win32.d rt/deh_win64_posix.d rt/dmain2.d rt/dwarfeh.d rt/ehalloc.d rt/invariant.d rt/lifetime.d rt/mach_utils.d rt/memory.d rt/memset.d rt/minfo.d rt/monitor_.d rt/obj.d rt/profilegc.d rt/qsort.d rt/sections.d rt/sections_android.d rt/sections_elf_shared.d rt/sections_ldc.d rt/sections_osx_x86.d rt/sections_osx_x86_64.d rt/sections_solaris.d rt/sections_win32.d rt/sections_win64.d rt/tlsgc.d rt/trace.d rt/tracegc.d rt/typeinfo/ti_Acdouble.d rt/typeinfo/ti_Acfloat.d rt/typeinfo/ti_Acreal.d rt/typeinfo/ti_Adouble.d rt/typeinfo/ti_Afloat.d rt/typeinfo/ti_Ag.d rt/typeinfo/ti_Aint.d rt/typeinfo/ti_Along.d rt/typeinfo/ti_Areal.d rt/typeinfo/ti_Ashort.d rt/typeinfo/ti_C.d rt/typeinfo/ti_byte.d rt/typeinfo/ti_cdouble.d rt/typeinfo/ti_cent.d rt/typeinfo/ti_cfloat.d rt/typeinfo/ti_char.d rt/typeinfo/ti_creal.d rt/typeinfo/ti_dchar.d rt/typeinfo/ti_delegate.d rt/typeinfo/ti_double.d rt/typeinfo/ti_float.d rt/typeinfo/ti_idouble.d rt/typeinfo/ti_ifloat.d rt/typeinfo/ti_int.d rt/typeinfo/ti_ireal.d rt/typeinfo/ti_long.d rt/typeinfo/ti_n.d rt/typeinfo/ti_ptr.d rt/typeinfo/ti_real.d rt/typeinfo/ti_short.d rt/typeinfo/ti_ubyte.d rt/typeinfo/ti_ucent.d rt/typeinfo/ti_uint.d rt/typeinfo/ti_ulong.d rt/typeinfo/ti_ushort.d rt/typeinfo/ti_void.d rt/typeinfo/ti_wchar.d rt/unwind.d rt/util/array.d rt/util/container/array.d rt/util/container/common.d rt/util/container/hashtab.d rt/util/container/treap.d rt/util/random.d rt/util/typeinfo.d core/sys/posix/aio.d core/sys/posix/arpa/inet.d core/sys/posix/config.d core/sys/posix/dirent.d core/sys/posix/dlfcn.d core/sys/posix/fcntl.d core/sys/posix/grp.d core/sys/posix/iconv.d core/sys/posix/inttypes.d core/sys/posix/libgen.d core/sys/posix/mqueue.d core/sys/posix/net/if_.d core/sys/posix/netdb.d core/sys/posix/netinet/in_.d core/sys/posix/netinet/tcp.d core/sys/posix/poll.d core/sys/posix/pthread.d core/sys/posix/pwd.d core/sys/posix/sched.d core/sys/posix/semaphore.d core/sys/posix/setjmp.d core/sys/posix/signal.d core/sys/posix/spawn.d core/sys/posix/stdio.d core/sys/posix/stdlib.d core/sys/posix/sys/filio.d core/sys/posix/sys/ioccom.d core/sys/posix/sys/ioctl.d core/sys/posix/sys/ipc.d core/sys/posix/sys/mman.d core/sys/posix/sys/msg.d core/sys/posix/sys/resource.d core/sys/posix/sys/select.d core/sys/posix/sys/shm.d core/sys/posix/sys/socket.d core/sys/posix/sys/stat.d core/sys/posix/sys/statvfs.d core/sys/posix/sys/time.d core/sys/posix/sys/ttycom.d core/sys/posix/sys/types.d core/sys/posix/sys/uio.d core/sys/posix/sys/un.d core/sys/posix/sys/utsname.d core/sys/posix/sys/wait.d core/sys/posix/syslog.d core/sys/posix/termios.d core/sys/posix/time.d core/sys/posix/ucontext.d core/sys/posix/unistd.d core/sys/posix/utime.d core/sys/linux/config.d core/sys/linux/dlfcn.d core/sys/linux/elf.d core/sys/linux/epoll.d core/sys/linux/errno.d core/sys/linux/execinfo.d core/sys/linux/fcntl.d core/sys/linux/ifaddrs.d core/sys/linux/link.d core/sys/linux/netinet/in_.d core/sys/linux/netinet/tcp.d core/sys/linux/sched.d core/sys/linux/stdio.d core/sys/linux/sys/auxv.d core/sys/linux/sys/eventfd.d core/sys/linux/sys/file.d core/sys/linux/sys/inotify.d core/sys/linux/sys/mman.d core/sys/linux/sys/netinet/tcp.d core/sys/linux/sys/prctl.d core/sys/linux/sys/signalfd.d core/sys/linux/sys/socket.d core/sys/linux/sys/sysinfo.d core/sys/linux/sys/time.d core/sys/linux/sys/xattr.d core/sys/linux/termios.d core/sys/linux/time.d core/sys/linux/timerfd.d core/sys/linux/tipc.d core/sys/linux/unistd.d core/sys/bionic/fcntl.d core/sys/bionic/unistd.d
 #0 0x00007fda96075eb2 llvm::sys::PrintStackTrace(llvm::raw_ostream&) /tmp/llvm-8.0.0/llvm/lib/Support/Unix/Signals.inc:495:13
 #1 0x00007fda96075eb2 PrintStackTraceSignalHandler(void*) /tmp/llvm-8.0.0/llvm/lib/Support/Unix/Signals.inc:558:0
 #2 0x00007fda96073d8c llvm::sys::RunSignalHandlers() /tmp/llvm-8.0.0/llvm/lib/Support/Signals.cpp:70:18
 #3 0x00007fda960761b1 SignalHandler(int) /tmp/llvm-8.0.0/llvm/lib/Support/Unix/Signals.inc:348:3
 #4 0x00007fda9582f5d0 __restore_rt (/lib64/libpthread.so.0+0xf5d0)
 #5 0x0000000000883334 Target::_init(Param const&) (/tmp/d-llvm-1.15.0/build/bin/ldc2+0x883334)
 #6 0x0000000000776d9a mars_mainBody(Param&, Array<char const*>&, Array<char const*>&) (/tmp/d-llvm-1.15.0/build/bin/ldc2+0x776d9a)
 #7 0x00000000008cf75b cppmain(int, char**) (/tmp/d-llvm-1.15.0/build/bin/ldc2+0x8cf75b)
 #8 0x000000000082ff09 _Dmain (/tmp/d-llvm-1.15.0/build/bin/ldc2+0x82ff09)
 #9 0x0000000000bb5140 _D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv (/tmp/d-llvm-1.15.0/build/bin/ldc2+0xbb5140)
#10 0x0000000000bb4fd0 _D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ7tryExecMFMDFZvZv (/tmp/d-llvm-1.15.0/build/bin/ldc2+0xbb4fd0)
#11 0x0000000000bb50af _D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZv (/tmp/d-llvm-1.15.0/build/bin/ldc2+0xbb50af)
#12 0x0000000000bb4fd0 _D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ7tryExecMFMDFZvZv (/tmp/d-llvm-1.15.0/build/bin/ldc2+0xbb4fd0)
#13 0x0000000000bb4f3b _d_run_main (/tmp/d-llvm-1.15.0/build/bin/ldc2+0xbb4f3b)
#14 0x00007fda9484a3d5 __libc_start_main (/lib64/libc.so.6+0x223d5)
#15 0x00000000005f4632 _start (/tmp/d-llvm-1.15.0/build/bin/ldc2+0x5f4632)
Segmentation fault (core dumped)
kinke commented 5 years ago

Did you build LLVM 8.0.0 yourself? With which clang version? And did you use the same clang version when compiling LDC? - I'm asking because the clang team f*cked up badly with clang v7.0.x (ABI bug, fixed in 8.x and 7.1.x).

bioinfornatics commented 5 years ago

Thanks @kinke for your quick answer. I am using LLVM 8.0.0 built myself. I think the problem comes from LLVM itself and not the ldc build procedure. So I will close this ticket and I will come back if I get more information.

Thanks and have a nice day

bioinfornatics commented 5 years ago

@kinke did you try to build this ldc release with llvm8 and clang?

kinke commented 5 years ago

All of our latest prebuilt packages ship with LLVM 8.0.0. clang (v8.0.0) is used for the prebuilt Windows packages (LLVM + LDC), and the macOS packages use AppleClang v10.0.0. The Linux packages use gcc.