Skip to content

Commit

Permalink
Auto merge of rust-lang#57953 - mati865:cc-fix, r=alexcrichton
Browse files Browse the repository at this point in the history
Do not set CC, CFLAGS, CXX, CXXFLAGS, AR, RANLIB in bootstrap, it breaks cross compilation

Fixes rust-lang#57812

I tested it in AArch64 Ubuntu container with several days old tree to have all the tools buildable.

I did **not** test native builds (amd64 -> amd64), leaving it to CI.

r? @alexcrichton
  • Loading branch information
bors committed Jan 29, 2019
2 parents c1c3c4e + 99d00c8 commit 40e6a0b
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1051,29 +1051,24 @@ impl<'a> Builder<'a> {
}
};
let cc = ccacheify(&self.cc(target));
cargo.env(format!("CC_{}", target), &cc).env("CC", &cc);
cargo.env(format!("CC_{}", target), &cc);

let cflags = self.cflags(target, GitRepo::Rustc).join(" ");
cargo
.env(format!("CFLAGS_{}", target), cflags.clone())
.env("CFLAGS", cflags.clone());
.env(format!("CFLAGS_{}", target), cflags.clone());

if let Some(ar) = self.ar(target) {
let ranlib = format!("{} s", ar.display());
cargo
.env(format!("AR_{}", target), ar)
.env("AR", ar)
.env(format!("RANLIB_{}", target), ranlib.clone())
.env("RANLIB", ranlib);
.env(format!("RANLIB_{}", target), ranlib);
}

if let Ok(cxx) = self.cxx(target) {
let cxx = ccacheify(&cxx);
cargo
.env(format!("CXX_{}", target), &cxx)
.env("CXX", &cxx)
.env(format!("CXXFLAGS_{}", target), cflags.clone())
.env("CXXFLAGS", cflags);
.env(format!("CXXFLAGS_{}", target), cflags);
}
}

Expand Down

0 comments on commit 40e6a0b

Please sign in to comment.