From 5057f4f0e07289524d407d2b8e4e02766b6af602 Mon Sep 17 00:00:00 2001 From: Georgi Valkov Date: Tue, 9 Jun 2026 13:56:30 +0300 Subject: [PATCH] rust: fix host build on x64 Darwin rust/host fails to compile on macOS running on Intel x64 because the host target triple is autogenerated to be 'arm64-unknown-linux-'. Rust doesn't have such a target triple, thus the build fails because there are no pre-built artefacts for bootstrapping. Fix this by setting RUSTC_HOST_ARCH to 'x86_64-apple-darwin' in case our host is HOST_ARCH=x86_64 and HOST_OS=Darwin. This fix is based on the existing fix for Apple silicon [1]. Fixes: File "/Volumes/pepe/py/openwrt/build_dir/target-x86_64_musl/host/rustc-1.96.0-src/x.py", line 53, in bootstrap.main() ~~~~~~~~~~~~~~^^ File "/Volumes/pepe/py/openwrt/build_dir/target-x86_64_musl/host/rustc-1.96.0-src/src/bootstrap/bootstrap.py", line 1418, in main bootstrap(args) ~~~~~~~~~^^^^^^ File "/Volumes/pepe/py/openwrt/build_dir/target-x86_64_musl/host/rustc-1.96.0-src/src/bootstrap/bootstrap.py", line 1366, in bootstrap build.download_toolchain() ~~~~~~~~~~~~~~~~~~~~~~~~^^ File "/Volumes/pepe/py/openwrt/build_dir/target-x86_64_musl/host/rustc-1.96.0-src/src/bootstrap/bootstrap.py", line 697, in download_toolchain download_component(download_info) ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^ File "/Volumes/pepe/py/openwrt/build_dir/target-x86_64_musl/host/rustc-1.96.0-src/src/bootstrap/bootstrap.py", line 529, in download_component get( ~~~^ download_info.base_download_url, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<3 lines>... verbose=download_info.verbose, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/Volumes/pepe/py/openwrt/build_dir/target-x86_64_musl/host/rustc-1.96.0-src/src/bootstrap/bootstrap.py", line 58, in get raise RuntimeError( ...<6 lines>... ) RuntimeError: src/stage0 doesn't contain a checksum for dist/2026-04-16/rust-std-1.95.0-x86_64-unknown-linux-darwin24.6.0.tar.xz. Pre-built artifacts might not be available for this target at this time, see https://doc.rust-lang.org/nightly/rustc/platform-support.html for more information. [1] https://github.com/openwrt/packages/commit/105fa3920e12f557bdf1fcbc566fc286fb53e319 Signed-off-by: Georgi Valkov --- lang/rust/rust-values.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lang/rust/rust-values.mk b/lang/rust/rust-values.mk index 8acdc394337eb..8e49409ff64f3 100644 --- a/lang/rust/rust-values.mk +++ b/lang/rust/rust-values.mk @@ -32,6 +32,8 @@ CARGO_RUSTFLAGS+=-Ctarget-feature=-crt-static $(RUSTC_LDFLAGS) ifeq ($(HOST_OS),Darwin) ifeq ($(HOST_ARCH),arm64) RUSTC_HOST_ARCH:=aarch64-apple-darwin + else ifeq ($(HOST_ARCH),x86_64) + RUSTC_HOST_ARCH:=x86_64-apple-darwin endif endif