Skip to content

Commit b8edf02

Browse files
committedNov 11, 2022
Avoid runtime dependency on static libstdc++
Usually, we do want to use the static C++ library when building rustc_llvm, but do not want to have that dependency at compiler runtime. Change the defaults to Make It So.
1 parent 0aaad9e commit b8edf02

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed
 

‎config.toml.example

+4-3
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,10 @@ changelog-seen = 2
8787
# this flag will indicate that this version check should not be done.
8888
#version-check = true
8989

90-
# Link libstdc++ statically into the rustc_llvm instead of relying on a
91-
# dynamic version to be available.
92-
#static-libstdcpp = true
90+
# When true, link libstdc++ statically into the rustc_llvm.
91+
# This is useful if you don't want to use the dynamic version of that
92+
# library provided by LLVM.
93+
#static-libstdcpp = false
9394

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

‎src/bootstrap/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ impl Config {
781781
config.llvm_optimize = true;
782782
config.ninja_in_file = true;
783783
config.llvm_version_check = true;
784-
config.llvm_static_stdcpp = true;
784+
config.llvm_static_stdcpp = false;
785785
config.backtrace = true;
786786
config.rust_optimize = true;
787787
config.rust_optimize_tests = true;

‎src/ci/run.sh

+4
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ else
123123
# (And PGO is its own can of worms).
124124
if [ "$NO_DOWNLOAD_CI_LLVM" = "" ]; then
125125
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set llvm.download-ci-llvm=if-available"
126+
else
127+
# When building for CI we want to use the static C++ Standard library
128+
# included with LLVM, since a dynamic libstdcpp may not be available.
129+
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set llvm.static-libstdcpp"
126130
fi
127131
fi
128132

0 commit comments

Comments
 (0)