[libcxx-dev] Build error: X86 32-bit version of libc++abi.so

Riyaz Puthiyapurayil via libcxx-dev libcxx-dev at lists.llvm.org
Mon Mar 2 11:34:52 PST 2020


This is on the master branch of LLVM (11.0.0). I am using clang-7.1.0 to make the build on a CentOS6.6 machine. The complete cmake command line is also below. Any hints on how to resolve this build failure? Note that I am using: -DLIBCXXABI_USE_COMPILER_RT=ON -DLIBCXXABI_USE_LLVM_UNWINDER=ON as I am creating a self-contained clang toolchain that does not depend on libgcc. The 64-bit version builds fine (only 32-bit fails).

The problem seems to be that in 32-bit builds, clang now generates a call to __udivdi3 in cxa_demangle.cpp.o but when linking libc++abi.so results in an the undefined symbol. I am not sure if getting libc++abi.so to be linked with libclang_rt.builtins (which contains the definition of __udivdi3) is the correct fix. I haven't looked at why -DLIBCXXABI_USE_COMPILER_RT=ON  doesn't result in libc++abi.so to be linked with compiler-rt builtins. Can anyone familiar with this stuff comment on this?

projects/libcxxabi/src/CMakeFiles/cxxabi_shared.dir/cxa_demangle.cpp.o: In function `(anonymous namespace)::itanium_demangle::SyntheticTemplateParamName::printLeft((anonymous namespace)::itanium_demangle::OutputStream&) const':                                             cxa_demangle.cpp:(.text._ZNK12_GLOBAL__N_116itanium_demangle26SyntheticTemplateParamName9printLeftERNS0_12OutputStreamE+0x12a): undefined reference to `__udivdi3'

cmake -G Ninja -DLLVM_PATH=/u/riyaz/src/llvm-project/llvm \
-DLLVM_ENABLE_PROJECTS=clang;clang-tools-extra;compiler-rt;libcxx;libcxxabi;libunwind;mlir;openmp \
-DLLVM_TARGETS_TO_BUILD=X86 \
-DLLVM_BUILD_32_BITS=ON \
-DLLVM_ENABLE_ZLIB=OFF \
-DLLVM_ENABLE_LIBCXX=ON \
-DLIBCXXABI_USE_COMPILER_RT=ON \
-DLIBCXXABI_USE_LLVM_UNWINDER=ON \
-DLIBCXXABI_ENABLE_SHARED=ON \
-DLIBCXX_USE_COMPILER_RT=ON \
-DLIBCXX_ENABLE_SHARED=ON \
-DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=ON \
-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=OFF \
-DCOMPILER_RT_USE_BUILTINS_LIBRARY=ON \
-DSANITIZER_USE_COMPILER_RT=ON \
-DSANITIZER_CXX_ABI=libc++ \
-DLIBOMP_USE_COMPILER_RT=ON \
-DCMAKE_INSTALL_PREFIX=/u/tools/llvm-11.0.0/linux \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_EXE_LINKER_FLAGS="-rtlib=compiler-rt" \
-DCMAKE_SHARED_LINKER_FLAGS="-rtlib=compiler-rt" \
-DCMAKE_MODULE_LINKER_FLAGS="-rtlib=compiler-rt" \
-DCMAKE_CXX_COMPILER=/u/tools/llvm-7.1.0/linux64/bin/clang++ \
-DCMAKE_C_COMPILER=/u/tools/llvm-7.1.0/linux64/bin/clang \
-DLIBOMP_COPY_EXPORTS=FALSE \
-DLIBOMP_CFLAGS=-stdlib=libc++ \
/u/riyaz/src/llvm-project/llvm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/libcxx-dev/attachments/20200302/795acbe8/attachment.html>


More information about the libcxx-dev mailing list