arcivanov created this revision.
arcivanov added reviewers: LLVM, clang.
arcivanov added projects: clang, LLVM.
Herald added a subscriber: mgorny.
arcivanov requested review of this revision.
Herald added a subscriber: cfe-commits.
In my case `-tblgen` tools in the **second stage** end up being built depending
on `libc++.so`.
While the the dependency is correct and the tools are built successfully,
`-tblgen` tools would not function until `libc++.so` is built in the
`$ORIGIN/../lib`.
But `libc++.so` of the second stage cannot be built without second stage
`llvm-tblgen` and `clang-tblgen` functioning.
This patch makes sure that in a bootstrapped build `llvm-tblgen`and
`clang-tblgen` are always used from the bootstrap //even when not
crosscompiling//.
See https://github.com/llvm/llvm-project/issues/53561 for extensive logs,
printouts and cmake caches.
If accepted please also send to 13.x and 14.x.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D118964
Files:
clang/CMakeLists.txt
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)
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)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits