rust: fix host build on aarch64 darwin
authorJonas Jelonek <jelonek.jonas@gmail.com>
Wed, 16 Aug 2023 07:25:50 +0000 (09:25 +0200)
committerNick Hainke <vincent@systemli.org>
Thu, 17 Aug 2023 07:39:24 +0000 (09:39 +0200)
rust/host failed to compile on macOS running on Apple Silicon M1 Pro
because the host target triple is autogenerated to be
'arm64-unknown-linux-'. Rust doesn't have such a target triple, thus the
build failes because there are no pre-built artifacts for bootstrapping.

Fix this by setting RUSTC_HOST_ARCH to 'aarch64-apple-darwin' in case
our host is HOST_ARCH=arm64 and HOST_OS=darwin.

Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
lang/rust/rust-values.mk

index 27e7f080644b35eb7468ca2bcf2b48d17e1a2c92..6209e5e124256b6722400ee962b8eedc2a09a1ee 100644 (file)
@@ -22,6 +22,12 @@ ifdef CONFIG_PKG_CC_STACKPROTECTOR_STRONG
 endif
 endif
 
+ifeq ($(HOST_OS),Darwin)
+  ifeq ($(HOST_ARCH),arm64)
+    RUSTC_TARGET_ARCH:=aarch64-apple-darwin
+  endif
+endif
+
 # mips64 openwrt has a specific targed in rustc
 ifeq ($(ARCH),mips64)
   RUSTC_TARGET_ARCH:=$(REAL_GNU_TARGET_NAME)