From 5d426d89a721ba6ad18b401d93512932e2de087b Mon Sep 17 00:00:00 2001 From: vasilito Date: Fri, 31 Jul 2026 07:01:48 +0900 Subject: [PATCH] llvm-native: use provided tblgen, don't force C++11 native sub-build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two fixes for the native tblgen sub-build failing on : - 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 --- local/recipes/dev/llvm-native/recipe.toml | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/local/recipes/dev/llvm-native/recipe.toml b/local/recipes/dev/llvm-native/recipe.toml index 071eca3970..28cea24019 100644 --- a/local/recipes/dev/llvm-native/recipe.toml +++ b/local/recipes/dev/llvm-native/recipe.toml @@ -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 . 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 ("'_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