From 4f49c8f58fed09836e6068e15242df5f632cfa6e Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 7 Jan 2019 13:47:35 -0800 Subject: [PATCH] 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 --- src/bootstrap/native.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index c548d7f6948dc..2edb50295a258 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -235,7 +235,7 @@ impl Step for Llvm { cfg.define("PYTHON_EXECUTABLE", python); } - configure_cmake(builder, target, &mut cfg, false); + configure_cmake(builder, target, &mut cfg); // FIXME: we don't actually need to build all LLVM tools and all LLVM // 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) { fn configure_cmake(builder: &Builder, target: Interned, - cfg: &mut cmake::Config, - building_dist_binaries: bool) { + cfg: &mut cmake::Config) { if builder.config.ninja { cfg.generator("Ninja"); } @@ -363,10 +362,8 @@ fn configure_cmake(builder: &Builder, cfg.build_arg("-j").build_arg(builder.jobs().to_string()); cfg.define("CMAKE_C_FLAGS", builder.cflags(target, GitRepo::Llvm).join(" ")); let mut cxxflags = builder.cflags(target, GitRepo::Llvm).join(" "); - if building_dist_binaries { - if builder.config.llvm_static_stdcpp && !target.contains("windows") { - cxxflags.push_str(" -static-libstdc++"); - } + if builder.config.llvm_static_stdcpp && !target.contains("windows") { + cxxflags.push_str(" -static-libstdc++"); } cfg.define("CMAKE_CXX_FLAGS", cxxflags); if let Some(ar) = builder.ar(target) { @@ -431,7 +428,7 @@ impl Step for Lld { t!(fs::create_dir_all(&out_dir)); let mut cfg = cmake::Config::new(builder.src.join("src/tools/lld")); - configure_cmake(builder, target, &mut cfg, true); + configure_cmake(builder, target, &mut cfg); // This is an awful, awful hack. Discovered when we migrated to using // clang-cl to compile LLVM/LLD it turns out that LLD, when built out of