From 822a4edbfd55b46fd0eee37118d01a27cc52a230 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 2 Aug 2022 20:34:53 -0400 Subject: [PATCH 1/2] propagate --target to rustc invocation --- build.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build.rs b/build.rs index cd79927..9f8e78d 100644 --- a/build.rs +++ b/build.rs @@ -89,6 +89,10 @@ fn compile_probe() -> Option { .arg(out_dir) .arg(probefile); + if let Some(target) = env::var_os("TARGET") { + cmd.arg("--target").arg(target); + } + // If Cargo wants to set RUSTFLAGS, use that. if let Ok(rustflags) = env::var("CARGO_ENCODED_RUSTFLAGS") { if !rustflags.is_empty() { From da28e88245e9cbcc2315ececafcd3a76300a4653 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 2 Aug 2022 20:35:15 -0400 Subject: [PATCH 2/2] fix RUSTC_WRAPPER env var --- build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.rs b/build.rs index 9f8e78d..c470ba1 100644 --- a/build.rs +++ b/build.rs @@ -71,7 +71,7 @@ fn compile_probe() -> Option { fs::write(&probefile, PROBE).ok()?; // Make sure to pick up Cargo rustc configuration. - let mut cmd = if let Some(wrapper) = env::var_os("CARGO_RUSTC_WRAPPER") { + let mut cmd = if let Some(wrapper) = env::var_os("RUSTC_WRAPPER") { let mut cmd = Command::new(wrapper); // The wrapper's first argument is supposed to be the path to rustc. cmd.arg(rustc);