Skip to content

Commit

Permalink
Auto merge of #15385 - inferiorhumanorgans:explicit-cross-target, r=V…
Browse files Browse the repository at this point in the history
…eykril

proc-macro-test: Pass target to cargo invocation

When cross compiling macos → dragonfly the dist build fails in the proc-maro-test-impl crate with the following error:

`ld: unknown option: -z\nclang: error: linker command failed with exit code 1 (use -v to see invocation)`

This appears to be a wart stemming from using an Apple host for cross compiling.  Passing the target along to cargo allows it to pick up a linker that it understands and DTRT.
  • Loading branch information
bors committed Aug 5, 2023
2 parents 86b6b6f + c5d4f73 commit 83ebbbf
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crates/proc-macro-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ fn main() {
.arg("--target-dir")
.arg(&target_dir);

if let Ok(target) = std::env::var("TARGET") {
cmd.args(["--target", &target]);
}

println!("Running {cmd:?}");

let output = cmd.output().unwrap();
Expand Down

0 comments on commit 83ebbbf

Please sign in to comment.