Index: clang/CMakeLists.txt =================================================================== --- clang/CMakeLists.txt +++ clang/CMakeLists.txt @@ -747,6 +747,13 @@ -DCMAKE_ASM_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/${C_COMPILER} -DCMAKE_ASM_COMPILER_ID=Clang) + # If -tblgen is linked to libc++.so and it's not available in the system, the tool can't run + # since the runpath doesn't yet contain libc++.so, which can't be built without -tblgen + # See https://github.com/llvm/llvm-project/issues/53561 + set(${CLANG_STAGE}_TABLEGEN + -DLLVM_TABLEGEN=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-tblgen + -DCLANG_TABLEGEN=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang-tblgen) + # cmake requires CMAKE_LINKER to be specified if the compiler is MSVC-like, # otherwise it defaults the linker to be link.exe. if(BOOTSTRAP_LLVM_ENABLE_LLD) @@ -757,9 +764,6 @@ if(BOOTSTRAP_CMAKE_SYSTEM_NAME) set(${CLANG_STAGE}_CONFIG -DLLVM_CONFIG_PATH=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-config) - set(${CLANG_STAGE}_TABLEGEN - -DLLVM_TABLEGEN=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-tblgen - -DCLANG_TABLEGEN=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang-tblgen) if(BOOTSTRAP_CMAKE_SYSTEM_NAME STREQUAL "Linux") if(BOOTSTRAP_LLVM_ENABLE_LLD) set(${CLANG_STAGE}_LINKER -DCMAKE_LINKER=${LLVM_RUNTIME_OUTPUT_INTDIR}/ld.lld)