I used the following commands:
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release \
-S ${LLVM_SRC} \
-B llvm-build \
-DCMAKE_CXX_COMPILER=${GCC_TOOLCHAIN}/bin/g++ \
-DCMAKE_C_COMPILER=${GCC_TOOLCHAIN}/bin/gcc \
-DLLVM_ENABLE_PROJECTS="clang" \
-DLLVM_ENABLE_RUNTIMES="compiler-rt;libcxx;libcxxabi;libunwind" \
-DLLVM_RUNTIME_TARGETS="x86_64-unknown-linux-gnu"
ninja -C llvm-build runtimes
But libc++abi.so.1
, libc++.so.1
. and libunwind.so.1
have a dependency on libgcc_s.so.1
(as reported by ldd) and libc++.so.1
has a dependency on libatomic.so.1
as well.
I was able to do this in LLVM 10 (not exactly the same cmake as above, but with all the changes that have gone in how runtimes are built, what I used to do will not work anymore, various errors that I will not go into; I had raised those issues in other threads and was asked to use the bootstrapping method above). How does one make a bootstrapping build of runtime that uses compiler-rt and not libgcc and libatomic from the GCC toolchain?
I have a related question. libc++ is compiled using a newly built clang. builtins are built when compiler-rt is listed in LLVM_ENABLE_RUNTIMES. But some components of compiler-rt contain C++ files that require libc++. So how is this cycle handled in the build?
NOTE: I have also tried using a previously built clang 10
instead ${GCC_TOOLCHAIN}/bin/g++
as the host compiler but I get the same results. The newly built clang (stage 1) does not use compiler-rt to build the runtimes and I couldnât figure out a way to force it.
NOTE: Using llvm release/14.x