Skip to content

Commit

Permalink
Auto merge of #57429 - alexcrichton:fix-dist, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bors committed Jan 7, 2019
2 parents 8e2063d + 444bc74 commit 94b991d
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -277,8 +277,7 @@ fn check_llvm_version(builder: &Builder, llvm_config: &Path) {

fn configure_cmake(builder: &Builder,
target: Interned<String>,
cfg: &mut cmake::Config,
building_dist_binaries: bool) {
cfg: &mut cmake::Config) {
if builder.config.ninja {
cfg.generator("Ninja");
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 94b991d

Please sign in to comment.