Skip to content

Commit 737ef08

Browse files
committedMar 13, 2022
Auto merge of rust-lang#94832 - jonhoo:default-static, r=Mark-Simulacrum
bootstrap: untangle static-libstdcpp & llvm-tools Previously, the static-libstdcpp setting was tied to llvm-tools such that enabling the latter always enabled the latter. This seems unfortunate, since it is entirely reasonable for someone to want to _not_ statically link stdc++, but _also_ want to build the llvm-tools. This patch therefore separates the two settings such that neither implies the other. On its own, that would change the default behavior in a way that's likely to surprise users. Specifically, users who build llvm-tools _likely_ want those tools to be statically compiled against libstdc++, since otherwise users with older GLIBCXX will be unable to run the vended tools. So, we also flip the default for the `static-libstdcpp` setting such that builds always link statically against libstdc++ by default, but it's _possible_ to opt out. See also rust-lang#94719.
2 parents e95b10b + ca82e6c commit 737ef08

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed
 

‎config.toml.example

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ changelog-seen = 2
8989

9090
# Link libstdc++ statically into the rustc_llvm instead of relying on a
9191
# dynamic version to be available.
92-
#static-libstdcpp = false
92+
#static-libstdcpp = true
9393

9494
# Whether to use Ninja to build LLVM. This runs much faster than make.
9595
#ninja = true

‎src/bootstrap/config.rs

+1
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,7 @@ impl Config {
645645
config.llvm_optimize = true;
646646
config.ninja_in_file = true;
647647
config.llvm_version_check = true;
648+
config.llvm_static_stdcpp = true;
648649
config.backtrace = true;
649650
config.rust_optimize = true;
650651
config.rust_optimize_tests = true;

‎src/bootstrap/native.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ fn configure_cmake(
566566

567567
// For distribution we want the LLVM tools to be *statically* linked to libstdc++.
568568
// We also do this if the user explicitly requested static libstdc++.
569-
if builder.config.llvm_tools_enabled || builder.config.llvm_static_stdcpp {
569+
if builder.config.llvm_static_stdcpp {
570570
if !target.contains("msvc") && !target.contains("netbsd") {
571571
if target.contains("apple") {
572572
ldflags.push_all("-static-libstdc++");

0 commit comments

Comments
 (0)
Please sign in to comment.