Skip to content

Build on i386 fails with "no suitable unwinder library" #143620

@lrvick

Description

@lrvick

So I start with live-bootstrap which is a i386 full source bootstrapped LFS-style distro.

I then build libunwind 1.8.1 and install it like so:

  export CFLAGS="-L/lib -L/usr/lib -latomic -llzma -lucontext"
  autoreconf -i
  ./configure \
    --prefix=/usr \
    --host=i386-linux-musl \
    --enable-cxx-exceptions
  make install
  install -c -m644 src/libunwind.* /usr/lib/

I then configure and build llvm:

cmake \
    -B build \
    -S llvm \
    -Wno-dev \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_VERBOSE_MAKEFILE=ON \
    -DENABLE_LINKER_BUILD_ID=ON \
    -DLLVM_TARGET_ARCH="X86" \
    -DLLVM_TARGETS_TO_BUILD="X86" \
    -DLLVM_HOST_TRIPLE="i386-linux-musl" \
    -DLLVM_RUNTIME_TARGETS="i386-linux-musl" \
    -DLLVM_BUILTIN_TARGETS="i386-linux-musl" \
    -DLLVM_ENABLE_PROJECTS="clang;lld" \
    -DLLVM_ENABLE_RUNTIMES="compiler-rt;libcxx;libcxxabi;libunwind" \
    -DLLVM_ENABLE_LIBCXX=ON \
    -DLLVM_ENABLE_RTTI=ON \
    -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON \
    -DLLVM_INSTALL_UTILS=ON \
    -DLLVM_ENABLE_LLD=OFF \
    -DLLVM_ENABLE_LIBXML2=OFF \
    -DLLVM_ENABLE_LIBEDIT=OFF \
    -DLLVM_ENABLE_LIBPFM=OFF \
    -DLLVM_BUILD_LLVM_DYLIB=ON \
    -DLLVM_LINK_LLVM_DYLIB=ON \
    -DCLANG_DEFAULT_CXX_STDLIB=libc++ \
    -DCLANG_DEFAULT_UNWINDLIB=libunwind \
    -DCLANG_DEFAULT_RTLIB=compiler-rt \
    -DLIBUNWIND_USE_COMPILER_RT=ON \
    -DCOMPILER_RT_DEFAULT_TARGET_TRIPLE="i386-linux-musl" \
    -DCOMPILER_RT_BUILD_SANITIZERS=OFF \
    -DCOMPILER_RT_BUILD_XRAY=OFF \
    -DCOMPILER_RT_BUILD_LIBFUZZER=OFF \
    -DCOMPILER_RT_BUILD_PROFILE=OFF \
    -DCOMPILER_RT_BUILD_MEMPROF=OFF \
    -DCOMPILER_RT_BUILD_CTX_PROFILE=OFF \
    -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON \
    -DCOMPILER_RT_USE_BUILTINS_LIBRARY=ON \
    -DCOMPILER_RT_USE_LLVM_UNWINDER=ON \
    -DLIBCXX_CXX_ABI=libcxxabi \
    -DLIBCXX_USE_COMPILER_RT=ON \
    -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=OFF \
    -DLIBCXX_HAS_MUSL_LIBC=ON \
    -DLIBCXX_HARDENING_MODE=fast \
    -DLIBCXXABI_USE_COMPILER_RT=ON \
    -DLIBCXXABI_USE_LLVM_UNWINDER=ON \
    -DLIBCXXABI_ENABLE_STATIC_UNWINDER=OFF
cmake --build build -v --parallel $(nproc)

Tried many combinations of cmake flags, but it always fails to find either the system or in-tree version of libunwind:

#24 961.8 /llvm-project-20.1.6.src/llvm/include/llvm/Transforms/IPO/FunctionImport.h: In constructor ‘llvm::FunctionImporter::ImportListsTy::ImportListsTy()’:
#24 961.8 /llvm-project-20.1.6.src/llvm/include/llvm/Transforms/IPO/FunctionImport.h:273:33: warning: member ‘llvm::FunctionImporter::ImportListsTy::ImportIDs’ is used uninitialized [-Wuninitialized]
#24 961.8   273 |     ImportListsTy() : EmptyList(ImportIDs) {}
#24 961.8       |                                 ^~~~~~~~~
#24 961.8 /llvm-project-20.1.6.src/llvm/include/llvm/Transforms/IPO/FunctionImport.h: In constructor ‘llvm::FunctionImporter::ImportListsTy::ImportListsTy(size_t)’:
#24 961.8 /llvm-project-20.1.6.src/llvm/include/llvm/Transforms/IPO/FunctionImport.h:274:44: warning: member ‘llvm::FunctionImporter::ImportListsTy::ImportIDs’ is used uninitialized [-Wuninitialized]
#24 961.8   274 |     ImportListsTy(size_t Size) : EmptyList(ImportIDs), ListsImpl(Size) {}
#24 961.8       |                                            ^~~~~~~~~
#24 962.2 In file included from /llvm-project-20.1.6.src/llvm/include/llvm/LTO/LTO.h:32,
#24 962.2                  from /llvm-project-20.1.6.src/lld/ELF/LTO.cpp:26:
#24 962.2 /llvm-project-20.1.6.src/llvm/include/llvm/Transforms/IPO/FunctionImport.h: In constructor ‘llvm::FunctionImporter::ImportListsTy::ImportListsTy()’:
#24 962.2 /llvm-project-20.1.6.src/llvm/include/llvm/Transforms/IPO/FunctionImport.h:273:33: warning: member ‘llvm::FunctionImporter::ImportListsTy::ImportIDs’ is used uninitialized [-Wuninitialized]
#24 962.2   273 |     ImportListsTy() : EmptyList(ImportIDs) {}
#24 962.2       |                                 ^~~~~~~~~
#24 962.2 /llvm-project-20.1.6.src/llvm/include/llvm/Transforms/IPO/FunctionImport.h: In constructor ‘llvm::FunctionImporter::ImportListsTy::ImportListsTy(size_t)’:
#24 962.2 /llvm-project-20.1.6.src/llvm/include/llvm/Transforms/IPO/FunctionImport.h:274:44: warning: member ‘llvm::FunctionImporter::ImportListsTy::ImportIDs’ is used uninitialized [-Wuninitialized]
#24 962.2   274 |     ImportListsTy(size_t Size) : EmptyList(ImportIDs), ListsImpl(Size) {}
#24 962.2       |                                            ^~~~~~~~~
#24 962.8 /llvm-project-20.1.6.src/lld/ELF/Writer.cpp: In instantiation of ‘void {anonymous}::Writer<ELFT>::finalizeAddressDependentContent() [with ELFT = llvm::object::ELFType<llvm::endianness::little, false>]’:
#24 962.8 /llvm-project-20.1.6.src/lld/ELF/Writer.cpp:2118:3:   required from ‘void {anonymous}::Writer<ELFT>::finalizeSections() [with ELFT = llvm::object::ELFType<llvm::endianness::little, false>]’
#24 962.8 /llvm-project-20.1.6.src/lld/ELF/Writer.cpp:325:3:   required from ‘void {anonymous}::Writer<ELFT>::run() [with ELFT = llvm::object::ELFType<llvm::endianness::little, false>]’
#24 962.8 /llvm-project-20.1.6.src/lld/ELF/Writer.cpp:98:24:   required from ‘void lld::elf::writeResult(Ctx&) [with ELFT = llvm::object::ELFType<llvm::endianness::little, false>]’
#24 962.8 /llvm-project-20.1.6.src/lld/ELF/Writer.cpp:3020:46:   required from here
#24 962.8 /llvm-project-20.1.6.src/lld/ELF/Writer.cpp:1555:33: warning: possibly dangling reference to a temporary [-Wdangling-reference]
#24 962.8  1555 |               const Relocation &reloc = elem.inputSec->relocs()[elem.relocIdx];
#24 962.8       |                                 ^~~~~
#24 962.8 /llvm-project-20.1.6.src/lld/ELF/Writer.cpp:1555:33: note: the temporary was destroyed at the end of the full expression ‘((const lld::elf::InputSectionBase*)elem.lld::elf::RelativeReloc::inputSec)->lld::elf::InputSectionBase::relocs().llvm::ArrayRef<lld::elf::Relocation>::operator[](((size_t)elem.lld::elf::RelativeReloc::relocIdx))’
#24 962.8 /llvm-project-20.1.6.src/lld/ELF/Writer.cpp: In instantiation of ‘void {anonymous}::Writer<ELFT>::finalizeAddressDependentContent() [with ELFT = llvm::object::ELFType<llvm::endianness::big, false>]’:
#24 962.8 /llvm-project-20.1.6.src/lld/ELF/Writer.cpp:2118:3:   required from ‘void {anonymous}::Writer<ELFT>::finalizeSections() [with ELFT = llvm::object::ELFType<llvm::endianness::big, false>]’
#24 962.8 /llvm-project-20.1.6.src/lld/ELF/Writer.cpp:325:3:   required from ‘void {anonymous}::Writer<ELFT>::run() [with ELFT = llvm::object::ELFType<llvm::endianness::big, false>]’
#24 962.8 /llvm-project-20.1.6.src/lld/ELF/Writer.cpp:98:24:   required from ‘void lld::elf::writeResult(Ctx&) [with ELFT = llvm::object::ELFType<llvm::endianness::big, false>]’
#24 962.8 /llvm-project-20.1.6.src/lld/ELF/Writer.cpp:3021:46:   required from here
#24 962.8 /llvm-project-20.1.6.src/lld/ELF/Writer.cpp:1555:33: warning: possibly dangling reference to a temporary [-Wdangling-reference]
#24 962.8 /llvm-project-20.1.6.src/lld/ELF/Writer.cpp:1555:33: note: the temporary was destroyed at the end of the full expression ‘((const lld::elf::InputSectionBase*)elem.lld::elf::RelativeReloc::inputSec)->lld::elf::InputSectionBase::relocs().llvm::ArrayRef<lld::elf::Relocation>::operator[](((size_t)elem.lld::elf::RelativeReloc::relocIdx))’
#24 962.9 /llvm-project-20.1.6.src/lld/ELF/Writer.cpp: In instantiation of ‘void {anonymous}::Writer<ELFT>::finalizeAddressDependentContent() [with ELFT = llvm::object::ELFType<llvm::endianness::little, true>]’:
#24 962.9 /llvm-project-20.1.6.src/lld/ELF/Writer.cpp:2118:3:   required from ‘void {anonymous}::Writer<ELFT>::finalizeSections() [with ELFT = llvm::object::ELFType<llvm::endianness::little, true>]’
#24 962.9 /llvm-project-20.1.6.src/lld/ELF/Writer.cpp:325:3:   required from ‘void {anonymous}::Writer<ELFT>::run() [with ELFT = llvm::object::ELFType<llvm::endianness::little, true>]’
#24 962.9 /llvm-project-20.1.6.src/lld/ELF/Writer.cpp:98:24:   required from ‘void lld::elf::writeResult(Ctx&) [with ELFT = llvm::object::ELFType<llvm::endianness::little, true>]’
#24 962.9 /llvm-project-20.1.6.src/lld/ELF/Writer.cpp:3022:46:   required from here
#24 962.9 /llvm-project-20.1.6.src/lld/ELF/Writer.cpp:1555:33: warning: possibly dangling reference to a temporary [-Wdangling-reference]
#24 962.9 /llvm-project-20.1.6.src/lld/ELF/Writer.cpp:1555:33: note: the temporary was destroyed at the end of the full expression ‘((const lld::elf::InputSectionBase*)elem.lld::elf::RelativeReloc::inputSec)->lld::elf::InputSectionBase::relocs().llvm::ArrayRef<lld::elf::Relocation>::operator[](((size_t)elem.lld::elf::RelativeReloc::relocIdx))’
#24 962.9 /llvm-project-20.1.6.src/lld/ELF/Writer.cpp: In instantiation of ‘void {anonymous}::Writer<ELFT>::finalizeAddressDependentContent() [with ELFT = llvm::object::ELFType<llvm::endianness::big, true>]’:
#24 962.9 /llvm-project-20.1.6.src/lld/ELF/Writer.cpp:2118:3:   required from ‘void {anonymous}::Writer<ELFT>::finalizeSections() [with ELFT = llvm::object::ELFType<llvm::endianness::big, true>]’
#24 962.9 /llvm-project-20.1.6.src/lld/ELF/Writer.cpp:325:3:   required from ‘void {anonymous}::Writer<ELFT>::run() [with ELFT = llvm::object::ELFType<llvm::endianness::big, true>]’
#24 962.9 /llvm-project-20.1.6.src/lld/ELF/Writer.cpp:98:24:   required from ‘void lld::elf::writeResult(Ctx&) [with ELFT = llvm::object::ELFType<llvm::endianness::big, true>]’
#24 962.9 /llvm-project-20.1.6.src/lld/ELF/Writer.cpp:3023:46:   required from here
#24 962.9 /llvm-project-20.1.6.src/lld/ELF/Writer.cpp:1555:33: warning: possibly dangling reference to a temporary [-Wdangling-reference]
#24 962.9 /llvm-project-20.1.6.src/lld/ELF/Writer.cpp:1555:33: note: the temporary was destroyed at the end of the full expression ‘((const lld::elf::InputSectionBase*)elem.lld::elf::RelativeReloc::inputSec)->lld::elf::InputSectionBase::relocs().llvm::ArrayRef<lld::elf::Relocation>::operator[](((size_t)elem.lld::elf::RelativeReloc::relocIdx))’
#24 967.2 /llvm-project-20.1.6.src/clang/tools/libclang/CXStoredDiagnostic.cpp: In member function ‘virtual CXString clang::CXStoredDiagnostic::getFixIt(unsigned int, CXSourceRange*) const’:
#24 967.2 /llvm-project-20.1.6.src/clang/tools/libclang/CXStoredDiagnostic.cpp:103:20: warning: possibly dangling reference to a temporary [-Wdangling-reference]
#24 967.2   103 |   const FixItHint &Hint = Diag.fixit_begin()[FixIt];
#24 967.2       |                    ^~~~
#24 967.2 /llvm-project-20.1.6.src/clang/tools/libclang/CXStoredDiagnostic.cpp:103:51: note: the temporary was destroyed at the end of the full expression ‘(&((const clang::CXStoredDiagnostic*)this)->clang::CXStoredDiagnostic::Diag)->clang::StoredDiagnostic::fixit_begin().__gnu_cxx::__normal_iterator<const clang::FixItHint*, std::vector<clang::FixItHint, std::allocator<clang::FixItHint> > >::operator[](((__gnu_cxx::__normal_iterator<const clang::FixItHint*, std::vector<clang::FixItHint, std::allocator<clang::FixItHint> > >::difference_type)FixIt))’
#24 967.2   103 |   const FixItHint &Hint = Diag.fixit_begin()[FixIt];
#24 967.2       |                                                   ^
#24 994.2 In file included from /llvm-project-20.1.6.src/clang/tools/c-index-test/c-index-test.c:11:
#24 994.2 /llvm-project-20.1.6.src/llvm/include/llvm/Support/AutoConvert.h:58:1: warning: C++ style comments are not allowed in ISO C90
#24 994.2    58 | // Get the the tag ccsid for a file name or a file descriptor.
#24 994.2       | ^
#24 994.2 /llvm-project-20.1.6.src/llvm/include/llvm/Support/AutoConvert.h:58:1: note: (this will be reported only once per input file)
#24 1002.0 CMake Deprecation Warning at /llvm-project-20.1.6.src/cmake/Modules/CMakePolicy.cmake:6 (cmake_policy):
#24 1002.0   The OLD behavior for policy CMP0116 will be removed from a future version
#24 1002.0   of CMake.
#24 1002.0 
#24 1002.0   The cmake-policies(7) manual explains that the OLD behaviors of all
#24 1002.0   policies are deprecated and that a policy should be set to OLD only under
#24 1002.0   specific short-term circumstances.  Projects should be ported to the NEW
#24 1002.0   behavior and not rely on setting a policy to OLD.
#24 1002.0 Call Stack (most recent call first):
#24 1002.0   CMakeLists.txt:12 (include)
#24 1002.0 
#24 1002.0 
#24 1002.7 CMake Warning (dev) at /usr/share/cmake-3.31/Modules/GNUInstallDirs.cmake:253 (message):
#24 1002.7   Unable to determine default CMAKE_INSTALL_LIBDIR directory because no
#24 1002.7   target architecture is known.  Please enable at least one language before
#24 1002.7   including GNUInstallDirs.
#24 1002.7 Call Stack (most recent call first):
#24 1002.7   cmake/base-config-ix.cmake:9 (include)
#24 1002.7   CMakeLists.txt:42 (include)
#24 1002.7 This warning is for project developers.  Use -Wno-dev to suppress it.
#24 1002.7 
#24 1003.1 CMake Warning at cmake/Modules/CompilerRTUtils.cmake:335 (message):
#24 1003.1   LLVMTestingSupport not found in LLVM_AVAILABLE_LIBS
#24 1003.1 Call Stack (most recent call first):
#24 1003.1   CMakeLists.txt:69 (load_llvm_config)
#24 1003.1 
#24 1003.1 
#24 1005.2 CMake Deprecation Warning at /llvm-project-20.1.6.src/cmake/Modules/CMakePolicy.cmake:6 (cmake_policy):
#24 1005.2   The OLD behavior for policy CMP0116 will be removed from a future version
#24 1005.2   of CMake.
#24 1005.2 
#24 1005.2   The cmake-policies(7) manual explains that the OLD behaviors of all
#24 1005.2   policies are deprecated and that a policy should be set to OLD only under
#24 1005.2   specific short-term circumstances.  Projects should be ported to the NEW
#24 1005.2   behavior and not rely on setting a policy to OLD.
#24 1005.2 Call Stack (most recent call first):
#24 1005.2   CMakeLists.txt:18 (include)
#24 1005.2 
#24 1005.2 
#24 1016.7 CMake Deprecation Warning at /llvm-project-20.1.6.src/cmake/Modules/CMakePolicy.cmake:6 (cmake_policy):
#24 1016.7   The OLD behavior for policy CMP0116 will be removed from a future version
#24 1016.7   of CMake.
#24 1016.7 
#24 1016.7   The cmake-policies(7) manual explains that the OLD behaviors of all
#24 1016.7   policies are deprecated and that a policy should be set to OLD only under
#24 1016.7   specific short-term circumstances.  Projects should be ported to the NEW
#24 1016.7   behavior and not rely on setting a policy to OLD.
#24 1016.7 Call Stack (most recent call first):
#24 1016.7   /llvm-project-20.1.6.src/compiler-rt/CMakeLists.txt:12 (include)
#24 1016.7 
#24 1016.7 
#24 1030.5 CMake Error at /llvm-project-20.1.6.src/compiler-rt/lib/scudo/standalone/CMakeLists.txt:168 (message):
#24 1030.5   No suitable unwinder library
#24 1030.5 
#24 1030.5 
#24 1030.5 make[2]: *** [runtimes/CMakeFiles/runtimes-i386-linux-musl-configure.dir/build.make:79: runtimes/runtimes-i386-linux-musl-stamps/runtimes-i386-linux-musl-configure] Error 1
#24 1030.5 make[1]: *** [CMakeFiles/Makefile2:147048: runtimes/CMakeFiles/runtimes-i386-linux-musl-configure.dir/all] Error 2
#24 1030.5 make: *** [Makefile:159: all] Error 2
#24 1030.5 + :
#24 1030.5 + cmake --build build -v
#24 1039.4 CMake Deprecation Warning at /llvm-project-20.1.6.src/cmake/Modules/CMakePolicy.cmake:6 (cmake_policy):
#24 1039.4   The OLD behavior for policy CMP0116 will be removed from a future version
#24 1039.4   of CMake.
#24 1039.4 
#24 1039.4   The cmake-policies(7) manual explains that the OLD behaviors of all
#24 1039.4   policies are deprecated and that a policy should be set to OLD only under
#24 1039.4   specific short-term circumstances.  Projects should be ported to the NEW
#24 1039.4   behavior and not rely on setting a policy to OLD.
#24 1039.4 Call Stack (most recent call first):
#24 1039.4   CMakeLists.txt:18 (include)
#24 1039.4 
#24 1039.4 
#24 1040.3 CMake Deprecation Warning at /llvm-project-20.1.6.src/cmake/Modules/CMakePolicy.cmake:6 (cmake_policy):
#24 1040.3   The OLD behavior for policy CMP0116 will be removed from a future version
#24 1040.3   of CMake.
#24 1040.3 
#24 1040.3   The cmake-policies(7) manual explains that the OLD behaviors of all
#24 1040.3   policies are deprecated and that a policy should be set to OLD only under
#24 1040.3   specific short-term circumstances.  Projects should be ported to the NEW
#24 1040.3   behavior and not rely on setting a policy to OLD.
#24 1040.3 Call Stack (most recent call first):
#24 1040.3   /llvm-project-20.1.6.src/compiler-rt/CMakeLists.txt:12 (include)
#24 1040.3 
#24 1040.3 
#24 1040.7 CMake Error at /llvm-project-20.1.6.src/compiler-rt/lib/scudo/standalone/CMakeLists.txt:168 (message):
#24 1040.7   No suitable unwinder library
#24 1040.7 
#24 1040.7 
#24 1040.7 make[2]: *** [runtimes/CMakeFiles/runtimes-i386-linux-musl-configure.dir/build.make:79: runtimes/runtimes-i386-linux-musl-stamps/runtimes-i386-linux-musl-configure] Error 1
#24 1040.7 make[1]: *** [CMakeFiles/Makefile2:147048: runtimes/CMakeFiles/runtimes-i386-linux-musl-configure.dir/all] Error 2
#24 1040.7 make: *** [Makefile:159: all] Error 2
#24 1040.7 + :
#24 DONE 1041.2s

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions