-- Linker detection: GNU ld -- Performing Test HAS_WERROR_GLOBAL_CTORS -- Performing Test HAS_WERROR_GLOBAL_CTORS - Failed -- Looking for __x86_64__ -- Looking for __x86_64__ - found -- Looking for __aarch64__ -- Looking for __aarch64__ - not found -- Found Git: /usr/bin/git (found version "2.25.1") -- Targeting AArch64 -- Targeting AMDGPU -- Targeting ARM -- Targeting AVR -- Targeting BPF -- Targeting Hexagon -- Targeting Lanai -- Targeting Mips -- Targeting MSP430 -- Targeting NVPTX -- Targeting PowerPC -- Targeting RISCV -- Targeting Sparc -- Targeting SystemZ -- Targeting VE -- Targeting WebAssembly -- Targeting X86 -- Targeting XCore
可以考虑在构建配置加上
1
-DLLVM_TARGETS_TO_BUILD="host"
此外,如果你是 64 位系统,考虑加上
1
-DLLVM_LIBDIR_SUFFIX="64"
如果想以动态库形式构建,加上
1
-DLLVM_BUILD_LLVM_DYLIB=On -DBUILD_SHARED_LIBS=On
现在看看配置结果
1 2 3 4 5 6 7 8 9 10 11 12
-- Linker detection: GNU ld -- Performing Test HAS_WERROR_GLOBAL_CTORS -- Performing Test HAS_WERROR_GLOBAL_CTORS - Failed -- Looking for __x86_64__ -- Looking for __x86_64__ - found -- Looking for __aarch64__ -- Looking for __aarch64__ - not found -- Found Git: /usr/bin/git (found version "2.25.1") -- Targeting X86 -- Looking for sys/resource.h -- Looking for sys/resource.h - found -- Clang version: 15.0.0
即使只是构建 X86 Target,编译过程也很占系统资源,尤其当 COMPILE_JOBS > 1 时,oom-kill happened!
[3548/3706] Performing configure step for 'runtimes' -- The C compiler identification is Clang 15.0.0 -- The CXX compiler identification is Clang 15.0.0 -- The ASM compiler identification is Clang -- Found assembler: /home/luc/gh/llvm-project/build/./bin/clang -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Could NOT find LLVM (missing: LLVM_DIR) -- Could NOT find Clang (missing: Clang_DIR) -- Performing Test LLVM_RUNTIMES_LINKING_WORKS -- Performing Test LLVM_RUNTIMES_LINKING_WORKS - Success -- Performing Test CXX_SUPPORTS_NOSTDLIBXX_FLAG -- Performing Test CXX_SUPPORTS_NOSTDLIBXX_FLAG - Success -- Performing Test CXX_SUPPORTS_NOSTDINCXX_FLAG -- Performing Test CXX_SUPPORTS_NOSTDINCXX_FLAG - Success -- Linker detection: GNU Gold -- Performing Test CXX_SUPPORTS_CUSTOM_LINKER -- Performing Test CXX_SUPPORTS_CUSTOM_LINKER - Success -- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG -- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG - Success -- Using libc++abi testing configuration: /home/luc/gh/llvm-project/libcxxabi/test/configs/llvm-libc++abi-shared.cfg.in -- Looking for fopen in c -- Looking for fopen in c - found -- Looking for __gcc_personality_v0 in gcc_s -- Looking for __gcc_personality_v0 in gcc_s - found -- Looking for __aeabi_uldivmod in gcc -- Looking for __aeabi_uldivmod in gcc - not found -- Performing Test C_SUPPORTS_COMMENT_LIB_PRAGMA -- Performing Test C_SUPPORTS_COMMENT_LIB_PRAGMA - Success -- Looking for dladdr in dl -- Looking for dladdr in dl - found -- Looking for pthread_once in pthread -- Looking for pthread_once in pthread - found -- Looking for __cxa_thread_atexit_impl in c -- Looking for __cxa_thread_atexit_impl in c - found -- Looking for write in System -- Looking for write in System - not found -- Performing Test CXX_SUPPORTS_WERROR_EQ_RETURN_TYPE_FLAG -- Performing Test CXX_SUPPORTS_WERROR_EQ_RETURN_TYPE_FLAG - Success -- Performing Test CXX_SUPPORTS_W_FLAG -- Performing Test CXX_SUPPORTS_W_FLAG - Success -- Performing Test CXX_SUPPORTS_WALL_FLAG -- Performing Test CXX_SUPPORTS_WALL_FLAG - Success -- Performing Test CXX_SUPPORTS_WCHAR_SUBSCRIPTS_FLAG -- Performing Test CXX_SUPPORTS_WCHAR_SUBSCRIPTS_FLAG - Success -- Performing Test CXX_SUPPORTS_WCONVERSION_FLAG -- Performing Test CXX_SUPPORTS_WCONVERSION_FLAG - Success -- Performing Test CXX_SUPPORTS_WMISMATCHED_TAGS_FLAG -- Performing Test CXX_SUPPORTS_WMISMATCHED_TAGS_FLAG - Success -- Performing Test CXX_SUPPORTS_WMISSING_BRACES_FLAG -- Performing Test CXX_SUPPORTS_WMISSING_BRACES_FLAG - Success -- Performing Test CXX_SUPPORTS_WNEWLINE_EOF_FLAG -- Performing Test CXX_SUPPORTS_WNEWLINE_EOF_FLAG - Success -- Performing Test CXX_SUPPORTS_WUNUSED_FUNCTION_FLAG -- Performing Test CXX_SUPPORTS_WUNUSED_FUNCTION_FLAG - Success -- Performing Test CXX_SUPPORTS_WSHADOW_FLAG -- Performing Test CXX_SUPPORTS_WSHADOW_FLAG - Success -- Performing Test CXX_SUPPORTS_WSHORTEN_64_TO_32_FLAG -- Performing Test CXX_SUPPORTS_WSHORTEN_64_TO_32_FLAG - Success -- Performing Test CXX_SUPPORTS_WSIGN_COMPARE_FLAG -- Performing Test CXX_SUPPORTS_WSIGN_COMPARE_FLAG - Success -- Performing Test CXX_SUPPORTS_WSIGN_CONVERSION_FLAG -- Performing Test CXX_SUPPORTS_WSIGN_CONVERSION_FLAG - Success -- Performing Test CXX_SUPPORTS_WSTRICT_ALIASING_EQ_2_FLAG -- Performing Test CXX_SUPPORTS_WSTRICT_ALIASING_EQ_2_FLAG - Success -- Performing Test CXX_SUPPORTS_WSTRICT_OVERFLOW_EQ_4_FLAG -- Performing Test CXX_SUPPORTS_WSTRICT_OVERFLOW_EQ_4_FLAG - Success -- Performing Test CXX_SUPPORTS_WUNUSED_PARAMETER_FLAG -- Performing Test CXX_SUPPORTS_WUNUSED_PARAMETER_FLAG - Success -- Performing Test CXX_SUPPORTS_WUNUSED_VARIABLE_FLAG -- Performing Test CXX_SUPPORTS_WUNUSED_VARIABLE_FLAG - Success -- Performing Test CXX_SUPPORTS_WWRITE_STRINGS_FLAG -- Performing Test CXX_SUPPORTS_WWRITE_STRINGS_FLAG - Success -- Performing Test CXX_SUPPORTS_WUNDEF_FLAG -- Performing Test CXX_SUPPORTS_WUNDEF_FLAG - Success -- Performing Test CXX_SUPPORTS_WNO_SUGGEST_OVERRIDE_FLAG -- Performing Test CXX_SUPPORTS_WNO_SUGGEST_OVERRIDE_FLAG - Success -- Performing Test CXX_SUPPORTS_WNO_ERROR_FLAG -- Performing Test CXX_SUPPORTS_WNO_ERROR_FLAG - Success -- Performing Test CXX_SUPPORTS_WX_FLAG -- Performing Test CXX_SUPPORTS_WX_FLAG - Failed -- Performing Test CXX_SUPPORTS_PEDANTIC_FLAG -- Performing Test CXX_SUPPORTS_PEDANTIC_FLAG - Success -- Performing Test CXX_SUPPORTS_FSTRICT_ALIASING_FLAG -- Performing Test CXX_SUPPORTS_FSTRICT_ALIASING_FLAG - Success -- Performing Test CXX_SUPPORTS_EHSC_FLAG -- Performing Test CXX_SUPPORTS_EHSC_FLAG - Failed -- Performing Test C_SUPPORTS_FUNWIND_TABLES_FLAG -- Performing Test C_SUPPORTS_FUNWIND_TABLES_FLAG - Success -- Could not find ParallelSTL, libc++abi will not attempt to use it but the build may fail if the libc++ in use needs it to be available. -- Using libc++ testing configuration: /home/luc/gh/llvm-project/libcxx/test/configs/llvm-libc++-shared.cfg.in -- Performing Test CXX_SUPPORTS_UNWINDLIB_EQ_NONE_FLAG -- Performing Test CXX_SUPPORTS_UNWINDLIB_EQ_NONE_FLAG - Success -- Looking for fopen in c -- Looking for fopen in c - found -- Looking for __gcc_personality_v0 in gcc_s -- Looking for __gcc_personality_v0 in gcc_s - found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Looking for ccos in m -- Looking for ccos in m - found -- Looking for clock_gettime in rt -- Looking for clock_gettime in rt - found -- Looking for __atomic_fetch_add_8 in atomic -- Looking for __atomic_fetch_add_8 in atomic - found -- Performing Test CXX_SUPPORTS_FALIGNED_ALLOCATION_FLAG -- Performing Test CXX_SUPPORTS_FALIGNED_ALLOCATION_FLAG - Success -- Performing Test CXX_SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG -- Performing Test CXX_SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG - Success -- Performing Test CXX_SUPPORTS_FVISIBILITY_EQ_HIDDEN_FLAG -- Performing Test CXX_SUPPORTS_FVISIBILITY_EQ_HIDDEN_FLAG - Success -- Performing Test CXX_SUPPORTS_WEXTRA_FLAG -- Performing Test CXX_SUPPORTS_WEXTRA_FLAG - Success -- Performing Test CXX_SUPPORTS_WNO_UNUSED_PARAMETER_FLAG -- Performing Test CXX_SUPPORTS_WNO_UNUSED_PARAMETER_FLAG - Success -- Performing Test CXX_SUPPORTS_WNO_LONG_LONG_FLAG -- Performing Test CXX_SUPPORTS_WNO_LONG_LONG_FLAG - Success -- Performing Test CXX_SUPPORTS_WEXTRA_SEMI_FLAG -- Performing Test CXX_SUPPORTS_WEXTRA_SEMI_FLAG - Success -- Performing Test CXX_SUPPORTS_WFORMAT_NONLITERAL_FLAG -- Performing Test CXX_SUPPORTS_WFORMAT_NONLITERAL_FLAG - Success -- Performing Test CXX_SUPPORTS_WNO_USER_DEFINED_LITERALS_FLAG -- Performing Test CXX_SUPPORTS_WNO_USER_DEFINED_LITERALS_FLAG - Success -- Performing Test CXX_SUPPORTS_WNO_COVERED_SWITCH_DEFAULT_FLAG -- Performing Test CXX_SUPPORTS_WNO_COVERED_SWITCH_DEFAULT_FLAG - Success CMake Warning at /home/luc/gh/llvm-project/libcxx/benchmarks/CMakeLists.txt:2 (message): The libc++ benchmarks won't be available because the version of CMake is too old to support them.
-- Configuring done -- Generating done CMake Warning: Manually-specified variables were not used by the project:
-- Build files have been written to: /home/luc/gh/llvm-project/build/runtimes/runtimes-bins [3556/3706] Performing build step for 'runtimes' [854/854] Linking CXX static library lib/x86_64-unknown-linux-gnu/libc++experimental.a [3612/3706] No install step for 'runtimes' [3706/3706] Creating library symlink lib64/libbenchmark_main.so.1 lib64/libbenchmark_main.so
安装后,我们需要将 bin 目录加入 PATH, 并创建 /etc/ld.so.conf.d/llvm.conf 包含下面一行
CMake Error at /home/luc/gh/llvm-project/libcxx/CMakeLists.txt:880 (message): LIBCXX_ABI_NAMESPACE '__1' is reserved for use by libc++. -- Configuring incomplete, errors occurred!