Skip to content

Commit 40e6a0b

Browse files
committed
Auto merge of #57953 - mati865:cc-fix, r=alexcrichton
Do not set CC, CFLAGS, CXX, CXXFLAGS, AR, RANLIB in bootstrap, it breaks cross compilation Fixes #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
2 parents c1c3c4e + 99d00c8 commit 40e6a0b

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)