dslm4515 / CMLFS

Clang-Built Musl Linux From Scratch
MIT License
99 stars 18 forks source link

Libcxx, __divti3: symbol not found #1

Closed dslm4515 closed 3 years ago

dslm4515 commented 3 years ago

when checking libc++.so.1.0 with ldd:

$ LD_LIBRARY_PATH=/cgnutools/lib ldd build/lib/libc++.so.1.0 
        ldd (0x7fd1cf4b8000)
        libc.so => ldd (0x7fd1cf4b8000)
        libunwind.so.1 => /cgnutools/lib/libunwind.so.1 (0x7fd1cf30c000)
        libc++abi.so.1 => /cgnutools/lib/libc++abi.so.1 (0x7fd1cf2b6000)
Error relocating build/lib/libc++.so.1.0: __divti3: symbol not found

What provides __divti3 ?

dslm4515 commented 3 years ago

Found it. __divti3 is provided by libgcc_s.so.1 GCC

$ LD_PRELOAD=/usr/lib/libgcc_s.so.1 \
> LD_LIBRARY_PATH=/cgnutools/lib \
> ldd /cgnutools/lib/libc++.so.1.0 
        ldd (0x7fbc901e8000)
        /usr/lib/libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x7fbc90034000)
        libc.so => ldd (0x7fbc901e8000)
        libunwind.so.1 => /cgnutools/lib/libunwind.so.1 (0x7fbc90022000)
        libc++abi.so.1 => /cgnutools/lib/libc++abi.so.1 (0x7fbc8ffcc000)

Strange as libcxx was configured with -DLIBCXX_HAS_GCC_S_LIB=OFF

dslm4515 commented 3 years ago

This issue is from an old method of build: build libunwind, libcxxabi, and libcxx before building clang with compiler-rt & lld.