Skip to content

Commit

Permalink
Fix platform tags when cross-compiling universal2 (PyO3#2153)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tuxu committed Jul 23, 2024
1 parent 223293b commit 46cce03
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/build_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
Expand Down

0 comments on commit 46cce03

Please sign in to comment.