llvm-native: use provided tblgen, don't force C++11 native sub-build
Two fixes for the native tblgen sub-build failing on <shared_mutex>: - LLVM_OPTIMIZED_TABLEGEN=Off: this recipe already provides a host-runnable, version-matched llvm-/clang-tblgen (redoxer toolchain, LLVM 21.1.2) via *_TABLEGEN_EXE. OPTIMIZED_TABLEGEN=On ignored those and forced a redundant native sub-build (CROSS_TOOLCHAIN_FLAGS_NATIVE) that failed. Off => LLVM uses the provided tblgen and skips the native build. (llvm21 provides no tblgen, so it keeps On and builds its own — different case, left as-is.) - CMAKE_CXX_FLAGS --std=gnu++11 -> gnu++17: LLVM 21 requires C++17; the stale gnu++11 could win the flag-order race in any sub-build and break the headers. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -93,7 +93,14 @@ COOKBOOK_CMAKE_FLAGS+=(
|
||||
-DLLVM_ENABLE_THREADS=On
|
||||
-DLLVM_INCLUDE_EXAMPLES=Off
|
||||
-DLLVM_INCLUDE_TESTS=Off
|
||||
-DLLVM_OPTIMIZED_TABLEGEN=On
|
||||
# OFF on purpose: this recipe PROVIDES a host-runnable, version-matched
|
||||
# tblgen via LLVM_TABLEGEN_EXE/CLANG_TABLEGEN_EXE below (the redoxer
|
||||
# toolchain's LLVM 21.1.2). LLVM_OPTIMIZED_TABLEGEN=On would ignore those
|
||||
# and force a redundant native sub-build (CROSS_TOOLCHAIN_FLAGS_NATIVE)
|
||||
# that failed to compile <shared_mutex>. With it off, LLVM uses the
|
||||
# provided tblgen and skips the native build entirely. (llvm21, which does
|
||||
# NOT provide a tblgen, keeps it On and builds its own — different case.)
|
||||
-DLLVM_OPTIMIZED_TABLEGEN=Off
|
||||
-DLLVM_TARGET_ARCH=$ARCH
|
||||
-DLLVM_TOOLS_INSTALL_DIR=bin
|
||||
-DLLVM_UTILS_INSTALL_DIR=bin
|
||||
@@ -115,10 +122,17 @@ fi
|
||||
if [ -n "${_SAVED_CFLAGS}" ]; then
|
||||
COOKBOOK_CMAKE_FLAGS+=(-DCMAKE_C_FLAGS="${_SAVED_CFLAGS}")
|
||||
fi
|
||||
# LLVM 21 REQUIRES C++17 (its headers use std::remove_reference_t, std::size,
|
||||
# std::shared_timed_mutex, etc.). The main build gets -std=gnu++17 from LLVM's
|
||||
# own CMAKE_CXX_STANDARD=17, appended after CMAKE_CXX_FLAGS so it wins — but the
|
||||
# CROSS_TOOLCHAIN_FLAGS_NATIVE sub-build (native llvm-tblgen) inherits
|
||||
# CMAKE_CXX_FLAGS with a DIFFERENT flag order where a stale "--std=gnu++11"
|
||||
# would win, breaking <shared_mutex> ("'_M_rwlock' was not declared"). Pass
|
||||
# gnu++17 here so no target can regress to C++11 regardless of flag order.
|
||||
if [ -n "${_SAVED_CXXFLAGS}" ]; then
|
||||
COOKBOOK_CMAKE_FLAGS+=(-DCMAKE_CXX_FLAGS="--std=gnu++11 ${_SAVED_CXXFLAGS}")
|
||||
COOKBOOK_CMAKE_FLAGS+=(-DCMAKE_CXX_FLAGS="--std=gnu++17 ${_SAVED_CXXFLAGS}")
|
||||
else
|
||||
COOKBOOK_CMAKE_FLAGS+=(-DCMAKE_CXX_FLAGS="--std=gnu++11")
|
||||
COOKBOOK_CMAKE_FLAGS+=(-DCMAKE_CXX_FLAGS="--std=gnu++17")
|
||||
fi
|
||||
|
||||
cookbook_cmake
|
||||
|
||||
Reference in New Issue
Block a user