diff --git a/local/recipes/dev/llvm-native/recipe.toml b/local/recipes/dev/llvm-native/recipe.toml index 28cea24019..42b6f9298a 100644 --- a/local/recipes/dev/llvm-native/recipe.toml +++ b/local/recipes/dev/llvm-native/recipe.toml @@ -93,20 +93,30 @@ COOKBOOK_CMAKE_FLAGS+=( -DLLVM_ENABLE_THREADS=On -DLLVM_INCLUDE_EXAMPLES=Off -DLLVM_INCLUDE_TESTS=Off - # 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.) + # OFF on purpose: this recipe PROVIDES host-runnable, version-matched + # tblgens via LLVM_TABLEGEN/CLANG_TABLEGEN below (the redoxer toolchain's + # LLVM 21.1.2). LLVM_OPTIMIZED_TABLEGEN=On would build a second optimized + # native tblgen instead of using them. Off => LLVM uses what we provide. -DLLVM_OPTIMIZED_TABLEGEN=Off -DLLVM_TARGET_ARCH=$ARCH -DLLVM_TOOLS_INSTALL_DIR=bin -DLLVM_UTILS_INSTALL_DIR=bin -DUNIX=1 - -DLLVM_TABLEGEN_EXE=${COOKBOOK_HOST_SYSROOT}/bin/llvm-tblgen - -DCLANG_TABLEGEN_EXE=${COOKBOOK_HOST_SYSROOT}/bin/clang-tblgen + # CRITICAL: the cache vars LLVM/Clang read to SKIP building a native tblgen + # when cross-compiling are LLVM_TABLEGEN / CLANG_TABLEGEN (see + # llvm/cmake/modules/TableGen.cmake: "Native TableGen executable. Saves + # building one when cross-compiling"). The *_TABLEGEN_EXE names used + # previously are NOT read by a from-scratch LLVM build, so LLVM built its + # own native tblgen via the CROSS_TOOLCHAIN_FLAGS_NATIVE sub-build — which + # ran the HOST gcc against the Redox relibc headers leaked through + # CMAKE_CXX_FLAGS and died on host/redox conflicts + # (__deprecated/__noreturn undeclared, duplicate div_t). Passing the + # correct var names makes LLVM use the provided host tblgens (LLVM 21.1.2) + # and skip the native sub-build entirely. (lld21/clang21 build against a + # PREBUILT llvm and locate tblgen via find_program on LLVM_TABLEGEN_EXE — + # a different cache var owned by those projects — so they are correct.) + -DLLVM_TABLEGEN=${COOKBOOK_HOST_SYSROOT}/bin/llvm-tblgen + -DCLANG_TABLEGEN=${COOKBOOK_HOST_SYSROOT}/bin/clang-tblgen ) COOKBOOK_SOURCE="$COOKBOOK_SOURCE/llvm"