ci: link against -lstdc++ in native fuzz with msan job
What changed, and why it matters
This commit changes Bitcoin Core's internal continuous integration (CI) build scripts for a memory-sanitizer fuzz-testing job. It switches from building a custom Clang compiler from source to using pre-packaged Ubuntu LLVM 21 packages, and adds a linker flag (-lstdc++) to work around packaging-related link issues. There is no change to the Bitcoin Core software that users run, no change to consensus or networking code, and no security vulnerability is being fixed.
No security action required. Treat as normal CI infrastructure maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff modifies two CI shell scripts. In 00_setup_env_native_fuzz_with_msan.sh it adds APT_LLVM_V=21, a PACKAGES list for Ubuntu LLVM 21 binaries, and appends -lstdc++ to LIBCXX_FLAGS with a comment explaining it resolves upstream packaging link issues. In 01_base_install.sh it removes the conditional block that built Clang/compiler-rt/libcxx from source when APT_LLVM_V was set, because the job now consumes distro packages instead. This is a build/CI maintenance change, not a runtime code change.
Changed components
ci/test/00_setup_env_native_fuzz_with_msan.shci/test/01_base_install.shInspect captured patch +4 / −18
diff --git a/ci/test/00_setup_env_native_fuzz_with_msan.sh b/ci/test/00_setup_env_native_fuzz_with_msan.sh
index c71772b8..0d906057 100755
--- a/ci/test/00_setup_env_native_fuzz_with_msan.sh
+++ b/ci/test/00_setup_env_native_fuzz_with_msan.sh
@@ -7,12 +7,15 @@
export LC_ALL=C.UTF-8
export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:24.04"
+export APT_LLVM_V="21"
LIBCXX_DIR="/cxx_build/"
export MSAN_FLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer -g -O1 -fno-optimize-sibling-calls"
-LIBCXX_FLAGS="-nostdinc++ -nostdlib++ -isystem ${LIBCXX_DIR}include/c++/v1 -L${LIBCXX_DIR}lib -Wl,-rpath,${LIBCXX_DIR}lib -lc++ -lc++abi -lpthread -Wno-unused-command-line-argument"
+# -lstdc++ to resolve link issues due to upstream packaging
+LIBCXX_FLAGS="-nostdinc++ -nostdlib++ -isystem ${LIBCXX_DIR}include/c++/v1 -L${LIBCXX_DIR}lib -Wl,-rpath,${LIBCXX_DIR}lib -lc++ -lc++abi -lpthread -Wno-unused-command-line-argument -lstdc++"
export MSAN_AND_LIBCXX_FLAGS="${MSAN_FLAGS} ${LIBCXX_FLAGS}"
export CONTAINER_NAME="ci_native_fuzz_msan"
+export PACKAGES="clang-${APT_LLVM_V} llvm-${APT_LLVM_V} llvm-${APT_LLVM_V}-dev libclang-${APT_LLVM_V}-dev libclang-rt-${APT_LLVM_V}-dev"
export DEP_OPTS="DEBUG=1 NO_QT=1 CC=clang CXX=clang++ CFLAGS='${MSAN_FLAGS}' CXXFLAGS='${MSAN_AND_LIBCXX_FLAGS}'"
export GOAL="all"
# Setting CMAKE_{C,CXX}_FLAGS_DEBUG flags to an empty string ensures that the flags set in MSAN_FLAGS remain unaltered.
diff --git a/ci/test/01_base_install.sh b/ci/test/01_base_install.sh
index 6944ab42..ce460987 100755
--- a/ci/test/01_base_install.sh
+++ b/ci/test/01_base_install.sh
@@ -58,23 +58,6 @@ fi
if [[ -n "${USE_INSTRUMENTED_LIBCPP}" ]]; then
${CI_RETRY_EXE} git clone --depth=1 https://github.com/llvm/llvm-project -b "llvmorg-21.1.1" /llvm-project
- if [ -n "${APT_LLVM_V}" ]; then
-
- cmake -G Ninja -B /clang_build/ \
- -DLLVM_ENABLE_PROJECTS="clang" \
- -DCMAKE_BUILD_TYPE=Release \
- -DLLVM_TARGETS_TO_BUILD=Native \
- -DLLVM_ENABLE_RUNTIMES="compiler-rt;libcxx;libcxxabi;libunwind" \
- -S /llvm-project/llvm
-
- ninja -C /clang_build/ "$MAKEJOBS"
- ninja -C /clang_build/ install-runtimes
-
- update-alternatives --install /usr/bin/clang++ clang++ /clang_build/bin/clang++ 100
- update-alternatives --install /usr/bin/clang clang /clang_build/bin/clang 100
- update-alternatives --install /usr/bin/llvm-symbolizer llvm-symbolizer /clang_build/bin/llvm-symbolizer 100
- fi
-
cmake -G Ninja -B /cxx_build/ \
-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
-DCMAKE_BUILD_TYPE=Release \
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.