Skip to content

Commit 99d00c8

Browse files
committed
bootstrap: set toolchain variables on per target basis
Using CC, CFLAGS, CXX, CXXFLAGS, AR and RANLIB breaks cross compilation because host is built first and has correct values. The same values are incorrect for the target however.
1 parent d8a0dd7 commit 99d00c8

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/bootstrap/builder.rs

+4-9
Original file line numberDiff line numberDiff line change
@@ -1051,29 +1051,24 @@ impl<'a> Builder<'a> {
10511051
}
10521052
};
10531053
let cc = ccacheify(&self.cc(target));
1054-
cargo.env(format!("CC_{}", target), &cc).env("CC", &cc);
1054+
cargo.env(format!("CC_{}", target), &cc);
10551055

10561056
let cflags = self.cflags(target, GitRepo::Rustc).join(" ");
10571057
cargo
1058-
.env(format!("CFLAGS_{}", target), cflags.clone())
1059-
.env("CFLAGS", cflags.clone());
1058+
.env(format!("CFLAGS_{}", target), cflags.clone());
10601059

10611060
if let Some(ar) = self.ar(target) {
10621061
let ranlib = format!("{} s", ar.display());
10631062
cargo
10641063
.env(format!("AR_{}", target), ar)
1065-
.env("AR", ar)
1066-
.env(format!("RANLIB_{}", target), ranlib.clone())
1067-
.env("RANLIB", ranlib);
1064+
.env(format!("RANLIB_{}", target), ranlib);
10681065
}
10691066

10701067
if let Ok(cxx) = self.cxx(target) {
10711068
let cxx = ccacheify(&cxx);
10721069
cargo
10731070
.env(format!("CXX_{}", target), &cxx)
1074-
.env("CXX", &cxx)
1075-
.env(format!("CXXFLAGS_{}", target), cflags.clone())
1076-
.env("CXXFLAGS", cflags);
1071+
.env(format!("CXXFLAGS_{}", target), cflags);
10771072
}
10781073
}
10791074

0 commit comments

Comments
 (0)