Skip to content

Commit

Permalink
use target platform for CARGO_CFG_TARGET_* (#494)
Browse files Browse the repository at this point in the history
build_script_runner was gathering details based on the host platform
instead of the target platform. This was causing a cross-compile of the
ring crate to fail to link, as it was making build-time decisions based
on the host OS instead of the target one.
  • Loading branch information
dae committed Nov 14, 2020
1 parent 776599d commit 2d8bac0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cargo/cargo_build_script_runner/bin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ fn get_target_env_vars<P: AsRef<Path>>(rustc: &P) -> Result<BTreeMap<String, Str
// As done by Cargo when constructing a cargo::core::compiler::build_context::target_info::TargetInfo.
let output = Command::new(rustc.as_ref())
.arg("--print=cfg")
.arg(format!(
"--target={}",
env::var("TARGET").expect("missing TARGET")
))
.output()
.map_err(|err| format!("Error running rustc to get target information: {}", err))?;
if !output.status.success() {
Expand Down

0 comments on commit 2d8bac0

Please sign in to comment.