Build problem in LLVM

Hi all,

I have a problem in building LLVM with these parameter.
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" -DLLVM_ABI_BREAKING_CHECKS=FORCE_OFF -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=OFF -DBUILD_SHARED_LIBS=True -DCMAKE_INSTALL_PREFIX=$LLVM_PREFIX -DLLVM_BUILD_TESTS=False -DDEFAULT_SYSROOT=$RISCV_TOOLCHAIN_PATH/riscv32-unknown-elf -DLLVM_DEFAULT_TARGET_TRIPLE="riscv32-unknown-elf" -DLLVM_TARGETS_TO_BUILD="RISCV" ../llvm

riscv-toolchain-path is build by this project.

The problem that I face during build process is that it can not link library lib/libLLVMObject.so. The error log is:

`[0/5] Performing configure step for ‘runtimes’
– Could NOT find Terminfo (missing: Terminfo_LIBRARIES Terminfo_LINKABLE)
– Could NOT find ZLIB (missing: ZLIB_LIBRARY) (found version “1.2.11”)
– Could NOT find Terminfo (missing: Terminfo_LIBRARIES Terminfo_LINKABLE)
– Could NOT find ZLIB (missing: ZLIB_LIBRARY) (found version “1.2.11”)
CMake Warning at /home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/llvm/cmake/modules/HandleLLVMOptions.cmake:277 (message):
-fPIC is not supported.
Call Stack (most recent call first):
/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/llvm/cmake/modules/HandleLLVMOptions.cmake:324 (add_flag_or_print_warning)
CMakeLists.txt:149 (include)

– Using libunwind testing configuration: /home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/libunwind/test/configs/llvm-libunwind-shared.cfg.in
CMake Error at /home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/libunwind/src/CMakeLists.txt:109 (message):
Compiler doesn’t support generation of unwind tables if exception support
is disabled. Building libunwind DSO with runtime dependency on C++ ABI
library is not supported.

– Configuring incomplete, errors occurred!
See also “/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/runtimes/runtimes-bins/CMakeFiles/CMakeOutput.log”.
See also “/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/runtimes/runtimes-bins/CMakeFiles/CMakeError.log”.
FAILED: runtimes/runtimes-stamps/runtimes-configure
cd /home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/runtimes/runtimes-bins && /usr/bin/cmake -DCMAKE_C_COMPILER=/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/./bin/clang -DCMAKE_CXX_COMPILER=/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/./bin/clang++ -DCMAKE_ASM_COMPILER=/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/./bin/clang -DCMAKE_AR=/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/./bin/llvm-ar -DCMAKE_RANLIB=/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/./bin/llvm-ranlib -DCMAKE_NM=/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/./bin/llvm-nm -DCMAKE_OBJDUMP=/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/./bin/llvm-objdump -DCMAKE_OBJCOPY=/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/./bin/llvm-objcopy -DCMAKE_STRIP=/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/./bin/llvm-strip -DCMAKE_READELF=/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/./bin/llvm-readelf -DCMAKE_C_COMPILER_TARGET=riscv32-unknown-elf -DCMAKE_CXX_COMPILER_TARGET=riscv32-unknown-elf -DCMAKE_ASM_COMPILER_TARGET=riscv32-unknown-elf -DCMAKE_INSTALL_PREFIX=/home/homidi/Desktop/research/projects/llvm-riscv -DLLVM_BINARY_DIR=/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build -DLLVM_CONFIG_PATH=/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/bin/llvm-config -DLLVM_ENABLE_WERROR=OFF -DLLVM_HOST_TRIPLE=x86_64-unknown-linux-gnu -DLLVM_HAVE_LINK_VERSION_SCRIPT=1 -DLLVM_USE_RELATIVE_PATHS_IN_DEBUG_INFO=OFF -DLLVM_USE_RELATIVE_PATHS_IN_FILES=OFF -DLLVM_LIT_ARGS=-sv -DLLVM_SOURCE_PREFIX= -DPACKAGE_VERSION=15.0.4 -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM=/usr/bin/ninja -DCMAKE_C_COMPILER_LAUNCHER= -DCMAKE_CXX_COMPILER_LAUNCHER= -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCOMPILER_RT_BUILD_BUILTINS=Off -DLLVM_INCLUDE_TESTS=OFF -DLLVM_DEFAULT_TARGET_TRIPLE=riscv32-unknown-elf -DLLVM_ENABLE_PROJECTS_USED=ON -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON -DLLVM_BUILD_TOOLS=ON -DCMAKE_C_COMPILER_WORKS=ON -DCMAKE_CXX_COMPILER_WORKS=ON -DCMAKE_ASM_COMPILER_WORKS=ON -DHAVE_LLVM_LIT=ON “-DLLVM_ENABLE_RUNTIMES=libcxx;libcxxabi;libunwind” -GNinja /home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/llvm/runtimes/…/…/runtimes && /usr/bin/cmake -E touch /home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/runtimes/runtimes-stamps//runtimes-configure
ninja: build stopped: subcommand failed.`

I do not have any idea about the problem and how solve this because everything seems to be ok. Is there anybody who has an idea how I can solve this issue?

Hi,

you should try to build the runtimes separately. clang/LLVM is build with RTTI/EH disabled by default. I guess that these settings are propagated to the runtime build which does not work. (I’m no export in building the runtimes - just a guess from the error messages.)

Kai