[libcxx-commits] [PATCH] D77294: [libc++] Fix linking libc++abi in standalone builds

Raul Tambre via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Apr 3 02:39:32 PDT 2020


tambre added a comment.

In D77294#1957900 <https://reviews.llvm.org/D77294#1957900>, @ldionne wrote:

> In D77294#1957868 <https://reviews.llvm.org/D77294#1957868>, @tambre wrote:
>
> > In D77294#1957078 <https://reviews.llvm.org/D77294#1957078>, @ldionne wrote:
> >
> > > LGTM, but is there some documentation about how to build libc++ standalone? How do you build it? Do we have any bots that exercise this code path?
> >
> >
> > I'd be happy to write some documentation for this. I do builds like this for assembling a toolchain at work using an internal tool. Main reason being that I don't want to crosscompile LLVM for my target platform (ARM64), just the libraries (compiler-rt, libunwind, libcxxabi, libcxx).
> >  I'm skeptical that there would be bots for this, as building LLVM with subprojects seems to be the most common setup. But I'm new so I don't know much.
>
>
> Can you please share what exact CMake configuration you're using?


Sure! Here's the whole process with the relevant parts:

1. Host compiler

  cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_BINDINGS=OFF -DLLVM_ENABLE_PLUGINS=OFF -DLLVM_ENABLE_OCAMLDOC=OFF -DLLVM_INCLUDE_BENCHMARKS=OFF -DLLVM_INCLUDE_DOCS=OFF -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_RUNTIMES=OFF -DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_UTILS=OFF -GNinja -S/opt/tools/drive/llvm/llvm -DLLVM_TARGETS_TO_BUILD=AArch64;X86 -DLLVM_ENABLE_PROJECTS=clang;compiler-rt;lld -DCOMPILER_RT_BUILD_LIBFUZZER=OFF -DCOMPILER_RT_BUILD_XRAY=OFF -DCLANG_DEFAULT_LINKER=lld -DCLANG_ENABLE_ARCMT=OFF -DCLANG_PLUGIN_SUPPORT=OFF -DLLVM_TOOL_BUGPOINT_BUILD=OFF -DCMAKE_INSTALL_PREFIX=/opt/tools/drive/host

2. compiler-rt

  cmake -DCMAKE_ASM_COMPILER_TARGET=aarch64-linux-gnu -DLLVM_CONFIG_PATH=/opt/tools/drive/host/bin/llvm-config -DCOMPILER_RT_BUILD_LIBFUZZER=OFF -DCOMPILER_RT_BUILD_XRAY=OFF -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON -DCOMPILER_RT_INCLUDE_TESTS=OFF -DSANITIZER_CXX_ABI=libc++ -DSANITIZER_USE_STATIC_CXX_ABI=ON -DCMAKE_C_COMPILER_TARGET=aarch64-linux-gnu -DCMAKE_CXX_COMPILER_TARGET=aarch64-linux-gnu -DCMAKE_SYSTEM_PROCESSOR=aarch64 -DCMAKE_C_COMPILER=/opt/tools/drive/host/bin/clang -DCMAKE_CXX_COMPILER=/opt/tools/drive/host/bin/clang++ -DCMAKE_AR=/opt/tools/drive/host/bin/llvm-ar -DCMAKE_RANLIB=/opt/tools/drive/host/bin/llvm-ranlib -DCMAKE_C_STANDARD_INCLUDE_DIRECTORIES=/opt/tools/drive/sysroot/opt/drive/sysroot/include -DCMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES=/opt/tools/drive/sysroot/opt/drive/sysroot/include -GNinja -S/opt/tools/drive/llvm/compiler-rt -DCMAKE_INSTALL_PREFIX=/opt/tools/drive/sysroot/opt/drive/sysroot/lib/clang/11.0.0

3. libunwind

  cmake -DCMAKE_ASM_COMPILER_TARGET=aarch64-linux-gnu -DLIBUNWIND_ENABLE_PIC=ON -DLIBUNWIND_ENABLE_SHARED=OFF -DLIBUNWIND_USE_COMPILER_RT=ON -DLLVM_ENABLE_LIBCXX=ON -DCMAKE_C_COMPILER_TARGET=aarch64-linux-gnu -DCMAKE_CXX_COMPILER_TARGET=aarch64-linux-gnu -DCMAKE_SYSTEM_PROCESSOR=aarch64 -DCMAKE_C_COMPILER=/opt/tools/drive/host/bin/clang -DCMAKE_CXX_COMPILER=/opt/tools/drive/host/bin/clang++ -DCMAKE_AR=/opt/tools/drive/host/bin/llvm-ar -DCMAKE_RANLIB=/opt/tools/drive/host/bin/llvm-ranlib -DCMAKE_C_STANDARD_INCLUDE_DIRECTORIES=/opt/tools/drive/sysroot/opt/drive/sysroot/include -DCMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES=/opt/tools/drive/sysroot/opt/drive/sysroot/include -DLLVM_PATH=/opt/tools/drive/llvm/llvm -GNinja -S/opt/tools/drive/llvm/libunwind -DCMAKE_INSTALL_PREFIX=/opt/tools/drive/libunwind

4. libc++abi

  cmake -DLIBCXXABI_ENABLE_SHARED=OFF -DLIBCXXABI_USE_COMPILER_RT=ON -DLIBCXXABI_INCLUDE_TESTS=OFF -DLIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS=OFF -DLIBCXXABI_USE_LLVM_UNWINDER=ON -DLIBCXXABI_ENABLE_STATIC_UNWINDER=ON -DCMAKE_C_COMPILER_TARGET=aarch64-linux-gnu -DCMAKE_CXX_COMPILER_TARGET=aarch64-linux-gnu -DCMAKE_SYSTEM_PROCESSOR=aarch64 -DCMAKE_C_COMPILER=/opt/tools/drive/host/bin/clang -DCMAKE_CXX_COMPILER=/opt/tools/drive/host/bin/clang++ -DCMAKE_AR=/opt/tools/drive/host/bin/llvm-ar -DCMAKE_RANLIB=/opt/tools/drive/host/bin/llvm-ranlib -DCMAKE_C_STANDARD_INCLUDE_DIRECTORIES=/opt/tools/drive/sysroot/opt/drive/sysroot/include -DCMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES=/opt/tools/drive/sysroot/opt/drive/sysroot/include -DLLVM_PATH=/opt/tools/drive/llvm/llvm -DLIBCXXABI_UNWIND_LIBRARY_PATH=/opt/tools/drive/libunwind/lib -GNinja -S/opt/tools/drive/llvm/libcxxabi -DCMAKE_INSTALL_PREFIX=/opt/tools/drive/libcxxabi

5. libc++, packaging for the target machine

  cmake -DLIBCXX_ABI_UNSTABLE=ON -DLIBCXX_CXX_ABI=libcxxabi -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON -DLIBCXX_INCLUDE_BENCHMARKS=OFF -DLIBCXX_USE_COMPILER_RT=ON -DCMAKE_C_COMPILER_TARGET=aarch64-linux-gnu -DCMAKE_CXX_COMPILER_TARGET=aarch64-linux-gnu -DCMAKE_SYSTEM_PROCESSOR=aarch64 -DCMAKE_C_COMPILER=/opt/tools/drive/host/bin/clang -DCMAKE_CXX_COMPILER=/opt/tools/drive/host/bin/clang++ -DCMAKE_AR=/opt/tools/drive/host/bin/llvm-ar -DCMAKE_RANLIB=/opt/tools/drive/host/bin/llvm-ranlib -DCMAKE_C_STANDARD_INCLUDE_DIRECTORIES=/opt/tools/drive/sysroot/opt/drive/sysroot/include -DCMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES=/opt/tools/drive/sysroot/opt/drive/sysroot/include -DLLVM_PATH=/opt/tools/drive/llvm/llvm -DLIBCXX_CXX_ABI_INCLUDE_PATHS=/opt/tools/drive/llvm/libcxxabi/include -DLIBCXX_CXX_ABI_LIBRARY_PATH=/opt/tools/drive/libcxxabi/lib -GNinja -S/opt/tools/drive/llvm/libcxx -DCMAKE_INSTALL_PREFIX=/opt/tools/drive/sysroot/opt/drive/sysroot

6. IR PGO compiler, profile
7. CSIR PGO compiler, profile
8. Final compiler.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77294/new/

https://reviews.llvm.org/D77294





More information about the libcxx-commits mailing list