Skip to content

Commit

Permalink
Avoid specifying a clang target triple when not cross-compiling
Browse files Browse the repository at this point in the history
This avoids certain corner cases where supplying the same llvm triple used by
rust for clang++ can cause native (host == target) C++ builds to break.

This fix supersedes rust-lang#785. See relevant discussions in rust-lang#785 and rust-lang#788.
  • Loading branch information
mqudsi committed Feb 9, 2023
1 parent 0d9a0f8 commit 7fd191b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1662,7 +1662,11 @@ impl Build {
if !(target.contains("android")
&& android_clang_compiler_uses_target_arg_internally(&cmd.path))
{
if target.contains("darwin") {
if self.get_host()? == target {
// We are not cross-compiling so we do not need to explicitly
// provide a target triple to the compiler, something which
// may require a lot of extra work to get right (see #785).
} else if target.contains("darwin") {
if let Some(arch) =
map_darwin_target_from_rust_to_compiler_architecture(target)
{
Expand Down

0 comments on commit 7fd191b

Please sign in to comment.