From 448800aea97dffd635807836a4ffe653b51243e3 Mon Sep 17 00:00:00 2001 From: vasilito Date: Fri, 31 Jul 2026 11:10:52 +0300 Subject: [PATCH] prefix: propagate AMDGPU/NVPTX host LLVM into the redoxer toolchain clang-install now cooks host:llvm21 (which carries AMDGPU;NVPTX). rsync its host LLVM (llvm-config + libs + llvm headers) into ~/.redoxer/toolchain so the host llvm-config the Mesa build reads reports the amdgpu module (mesa's dependency('llvm', modules: amdgpu) otherwise fails against the toolchain's downloaded X86-only LLVM). Mirrors the existing relibc->toolchain propagation; rsync without --delete preserves the toolchain's gcc/rust/redox-target files. --- mk/prefix.mk | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mk/prefix.mk b/mk/prefix.mk index 664090a0e1..d8378873cb 100644 --- a/mk/prefix.mk +++ b/mk/prefix.mk @@ -493,6 +493,22 @@ endif cp -r "$(CLANG_TARGET)/stage/usr/". "$@.partial" cp -r "$(LLD_TARGET)/stage/usr/". "$@.partial" mv "$@.partial" "$@" +# Propagate the freshly-built host LLVM (which now carries the AMDGPU + NVPTX GPU +# backends per recipes/dev/llvm21) into the redoxer toolchain. The Mesa build +# reads a host llvm-config through bin/x86_64-unknown-redox-llvm-config, which +# execs $COOKBOOK_HOST_SYSROOT/bin/llvm-config (= this toolchain). The toolchain +# ships a downloaded X86-only LLVM, so without this sync mesa's +# dependency('llvm', modules: [... amdgpu ...]) reports amdgpu(missing) and the +# GPU driver build fails. rsync WITHOUT --delete so the toolchain's gcc/rust and +# redox-target files are preserved; only the (same-version, 21.1.2) LLVM +# binaries/libs/headers/cmake are updated to the AMDGPU/NVPTX build. + @REDOXER_TC=$(HOME)/.redoxer/$(TARGET)/toolchain; \ + if [ -d "$$REDOXER_TC/bin" ]; then \ + rsync -a "$@/bin/llvm-config" "$$REDOXER_TC/bin/llvm-config"; \ + rsync -a "$@/lib/" "$$REDOXER_TC/lib/"; \ + rsync -a "$@/include/llvm" "$@/include/llvm-c" "$$REDOXER_TC/include/" 2>/dev/null || true; \ + echo " [toolchain] synced AMDGPU/NVPTX host LLVM into redoxer toolchain"; \ + fi # no longer needed, delete build files to save disk space rm -rf $(LLVM_TARGET) $(CLANG_TARGET) $(LLD_TARGET) endif