From 46cce0312f0379b6dfe16040b0c8bee4b4aae1ba Mon Sep 17 00:00:00 2001 From: Tino Wagner Date: Tue, 23 Jul 2024 14:48:07 +0200 Subject: [PATCH] Fix platform tags when cross-compiling universal2 (#2153) When cross-compiling for `universal2-apple-darwin`, the platform tags of the resulting wheel were not properly derived. This is because with forcing `target_triple` to `None` as before, it was not detected that we are in fact cross-compiling for a different target and thus the wheels were wrongly tagged for the host platform. To make the inference work, set `target_triple` to a valid triple instead. --- src/build_options.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/build_options.rs b/src/build_options.rs index a15db6d5..878681fa 100644 --- a/src/build_options.rs +++ b/src/build_options.rs @@ -549,7 +549,9 @@ impl BuildOptions { }; } if universal2 { - target_triple = None; + // Ensure that target_triple is valid. This is necessary to properly + // infer the platform tags when cross-compiling from Linux. + target_triple = Some("aarch64-apple-darwin".to_string()); } let mut target = Target::from_target_triple(target_triple)?;