From c5d4f7339ad576502f0a27a4bb8e917509000099 Mon Sep 17 00:00:00 2001 From: Alex Zepeda Date: Wed, 2 Aug 2023 17:57:13 -0700 Subject: [PATCH] proc-macro-test: Pass target to cargo invocation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- crates/proc-macro-test/build.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/proc-macro-test/build.rs b/crates/proc-macro-test/build.rs index 19a5caa4cc..7827157865 100644 --- a/crates/proc-macro-test/build.rs +++ b/crates/proc-macro-test/build.rs @@ -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();