build: Temporarily remove confusing and brittle -fdebug-prefix-map
What changed, and why it matters
This commit changes Bitcoin Core's build configuration. It removes one compiler flag (-fdebug-prefix-map) from the main CMake build and adds it instead to the Guix reproducible-build script. The change is described by the project as fixing a 'confusing and brittle' build setup, not as a security fix. It primarily affects how source-code paths are embedded in debug information, which can influence build reproducibility and debuggability, but does not by itself create or fix a vulnerability in the running software.
No immediate security action required. Treat as a normal build-maintenance commit. Reviewers verifying reproducible builds may want to confirm debug-info path normalization still behaves as expected under Guix.
Security signals we found
No security-relevant signal in commit title or message
No CVE, advisory, or vulnerability keyword present
Change is build-system/reproducibility related, not runtime code
No mention of attacker, exploit, crash, memory safety, or consensus
Evidence from the diff
The patch removes a conditional try_append_cxx_flags call for -fdebug-prefix-map=${PROJECT_SOURCE_DIR}/src=. from CMakeLists.txt and adds an explicit -fdebug-prefix-map=${DISTSRC}/src=. to HOST_CFLAGS in contrib/guix/libexec/build.sh. The remaining -fmacro-prefix-map stays in CMakeLists.txt. The stated rationale is that the previous arrangement was confusing and brittle, causing issues with coverage builds under Clang/OSS-Fuzz and GCC. The change narrows the flag’s application to the Guix deterministic-build path, improving build-system maintainability and reproducibility.
Changed components
Bitcoin Core build system (CMakeLists.txt)Guix reproducible build script (contrib/guix/libexec/build.sh)Inspect captured patch +3 / −3
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1b1df77b..eb27f989 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -488,9 +488,8 @@ try_append_cxx_flags("-fno-extended-identifiers" TARGET core_interface SKIP_LINK
# which can cause issues with coverage builds, particularly when using
# Clang in the OSS-Fuzz environment due to its use of other options
# and a third party script, or with GCC.
-try_append_cxx_flags("-fdebug-prefix-map=A=B" TARGET core_interface SKIP_LINK
- IF_CHECK_PASSED "-fdebug-prefix-map=${PROJECT_SOURCE_DIR}/src=."
-)
+# Set `-fmacro-prefix-map`, so that source file names are expanded without the
+# src prefix.
try_append_cxx_flags("-fmacro-prefix-map=A=B" TARGET core_interface SKIP_LINK
IF_CHECK_PASSED "-fmacro-prefix-map=${PROJECT_SOURCE_DIR}/src=."
)
diff --git a/contrib/guix/libexec/build.sh b/contrib/guix/libexec/build.sh
index f4db25f4..1eaa86ae 100755
--- a/contrib/guix/libexec/build.sh
+++ b/contrib/guix/libexec/build.sh
@@ -211,6 +211,7 @@ CONFIGFLAGS="-DREDUCE_EXPORTS=ON -DBUILD_BENCH=OFF -DBUILD_GUI_TESTS=OFF -DBUILD
# CFLAGS
HOST_CFLAGS="-O2 -g"
HOST_CFLAGS+=$(find /gnu/store -maxdepth 1 -mindepth 1 -type d -exec echo -n " -ffile-prefix-map={}=/usr" \;)
+HOST_CFLAGS+=" -fdebug-prefix-map=${DISTSRC}/src=."
case "$HOST" in
*mingw*) HOST_CFLAGS+=" -fno-ident" ;;
*darwin*) unset HOST_CFLAGS ;;
Why this scored 11/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.