Skip to content

Commit 2cb7cdc

Browse files
committed
Auto merge of #57429 - alexcrichton:fix-dist, r=Mark-Simulacrum
Build LLVM with -static-libstdc++ on dist builds This commit is intended on fixing a regression from #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 #57426
2 parents b8c8f0b + d585553 commit 2cb7cdc

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/bootstrap/native.rs

+8-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,11 @@ 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 &&
366+
!target.contains("windows") &&
367+
!target.contains("netbsd")
368+
{
369+
cxxflags.push_str(" -static-libstdc++");
370370
}
371371
cfg.define("CMAKE_CXX_FLAGS", cxxflags);
372372
if let Some(ar) = builder.ar(target) {
@@ -431,7 +431,7 @@ impl Step for Lld {
431431
t!(fs::create_dir_all(&out_dir));
432432

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

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

0 commit comments

Comments
 (0)