Skip to content

Commit 4f49c8f

Browse files
committed
Build LLVM with -static-libstdc++ on dist builds
This commit is intended on fixing a regression from rust-lang#57286 where the distributed LLVM shared library unfortunately depends on a dynamic copy of libstdc++, meaning we're no longer as binary compatible as we thought! This tweaks the build of LLVM as out distribution is slightly different now, and is hoped to fix the issue. Closes rust-lang#57426
1 parent 163eb7d commit 4f49c8f

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/bootstrap/native.rs

+5-8
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ impl Step for Llvm {
235235
cfg.define("PYTHON_EXECUTABLE", python);
236236
}
237237

238-
configure_cmake(builder, target, &mut cfg, false);
238+
configure_cmake(builder, target, &mut cfg);
239239

240240
// FIXME: we don't actually need to build all LLVM tools and all LLVM
241241
// libraries here, e.g., we just want a few components and a few
@@ -277,8 +277,7 @@ fn check_llvm_version(builder: &Builder, llvm_config: &Path) {
277277

278278
fn configure_cmake(builder: &Builder,
279279
target: Interned<String>,
280-
cfg: &mut cmake::Config,
281-
building_dist_binaries: bool) {
280+
cfg: &mut cmake::Config) {
282281
if builder.config.ninja {
283282
cfg.generator("Ninja");
284283
}
@@ -363,10 +362,8 @@ fn configure_cmake(builder: &Builder,
363362
cfg.build_arg("-j").build_arg(builder.jobs().to_string());
364363
cfg.define("CMAKE_C_FLAGS", builder.cflags(target, GitRepo::Llvm).join(" "));
365364
let mut cxxflags = builder.cflags(target, GitRepo::Llvm).join(" ");
366-
if building_dist_binaries {
367-
if builder.config.llvm_static_stdcpp && !target.contains("windows") {
368-
cxxflags.push_str(" -static-libstdc++");
369-
}
365+
if builder.config.llvm_static_stdcpp && !target.contains("windows") {
366+
cxxflags.push_str(" -static-libstdc++");
370367
}
371368
cfg.define("CMAKE_CXX_FLAGS", cxxflags);
372369
if let Some(ar) = builder.ar(target) {
@@ -431,7 +428,7 @@ impl Step for Lld {
431428
t!(fs::create_dir_all(&out_dir));
432429

433430
let mut cfg = cmake::Config::new(builder.src.join("src/tools/lld"));
434-
configure_cmake(builder, target, &mut cfg, true);
431+
configure_cmake(builder, target, &mut cfg);
435432

436433
// This is an awful, awful hack. Discovered when we migrated to using
437434
// clang-cl to compile LLVM/LLD it turns out that LLD, when built out of

0 commit comments

Comments
 (0)