build: Temporarily remove confusing and brittle -fdebug-prefix-map #34281

pull maflcko wants to merge 1 commits into bitcoin:master from maflcko:2601-build-fix-remove changing 2 files +3 −3
  1. maflcko commented at 12:31 pm on January 14, 2026: member

    The compiler option -fdebug-prefix-map is unconditionally set by the build system. This is problematic for many reasons:

    • Users and devs have no easy way to disable it without modifying the build system source code
    • The mapping is broken since the cmake migration, and requires manual fixups such as #31204 or #31957

    Fix all issues by temporarily removing it.

    Though, the option is kept for the guix build, so that no change in behavior is observed for the release binaries.

    Fixes #31957 Fixes #31204

    The option can be added back in the future, if there is any need to. Though, adding it back should ideally work out of the box, or at least provide easy workarounds for all commonly used tooling.

  2. build: Temporarily remove confusing and brittle -fdebug-prefix-map fa37928536
  3. DrahtBot added the label Build system on Jan 14, 2026
  4. DrahtBot commented at 12:31 pm on January 14, 2026: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/34281.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK pinheadmz, l0rinc, hebasto

    If your review is incorrectly listed, please copy-paste <!–meta-tag:bot-skip–> into the comment that the bot should ignore.

  5. maflcko commented at 3:03 pm on January 14, 2026: member

    I’ve also tested against #30799 via:

    0./bld-c/bin/bitcoind -printtoconsole -logsourcelocations -regtest | grep 'Bitcoin Core version'
    12026-01-14T15:01:26Z [init/common.cpp:153] [LogPackageVersion] Bitcoin Core version v30.99.0-fa37928536e0-dirty (release build)
    
  6. maflcko added the label DrahtBot Guix build requested on Jan 14, 2026
  7. DrahtBot commented at 6:32 pm on January 17, 2026: contributor

    Guix builds (on x86_64) [untrusted test-only build, possibly unsafe, not for production use]

    File commit 9d2b8fddad463f70171906dbe68dbd4681ea1aca(master) commit 618f38274dbef028bbe8b5b643f750c326bb25be(pull/34281/merge)
    *-aarch64-linux-gnu-debug.tar.gz b54752db32c2706e... 3f3f3d8c91f16314...
    *-aarch64-linux-gnu.tar.gz 7387717e93633171... e73ec99d962056f1...
    *-arm-linux-gnueabihf-debug.tar.gz 3d10cef692d6a3b6... e3560f167e7832a5...
    *-arm-linux-gnueabihf.tar.gz 2792a8fe85618eaf... dd1d822ecc1896e1...
    *-powerpc64-linux-gnu-debug.tar.gz 2e16367d642a352f... 89063687ff18dea6...
    *-powerpc64-linux-gnu.tar.gz 874718a62b0031b3... 97e93950bb714fa6...
    *-riscv64-linux-gnu-debug.tar.gz 2c15225fd864f492... 2e59aadeab641038...
    *-riscv64-linux-gnu.tar.gz e0fd8eb5f9d8956f... c952e7228c28b387...
    *-x86_64-linux-gnu-debug.tar.gz d0fafcff098c5c31... 816a772cefce72e0...
    *-x86_64-linux-gnu.tar.gz 0b3f2365df75910f... e816a916290c562d...
    *.tar.gz 8cfd0b29aa4dadf3... 18adea8ba1188b7e...
    SHA256SUMS.part 341ba0fbf217de81... 9a034a9b6d197395...
    guix_build.log 6354adc2c35caf3a... cbe028d6727a8c10...
    guix_build.log.diff cef15d77dd34ffe3...
  8. DrahtBot removed the label DrahtBot Guix build requested on Jan 17, 2026
  9. maflcko requested review from hebasto on Jan 19, 2026
  10. hebasto commented at 3:28 pm on January 19, 2026: member

    Concept ACK. Thanks for picking up #34116!

    I’ve also tested against #30799 via:

    0./bld-c/bin/bitcoind -printtoconsole -logsourcelocations -regtest | grep 'Bitcoin Core version'
    12026-01-14T15:01:26Z [init/common.cpp:153] [LogPackageVersion] Bitcoin Core version v30.99.0-fa37928536e0-dirty (release build)
    

    On my machine:

    0$ ./build/bin/bitcoind -printtoconsole -logsourcelocations -regtest | grep 'Bitcoin Core version'
    12026-01-19T15:24:06Z [../src/init/common.cpp:153] [LogPackageVersion] Bitcoin Core version v30.99.0-fa37928536e0 (release build)
    

    Is there a reason for not including 0fe849b0c33a3246f4c219f442fb098d7b967c9d as well?

  11. maflcko commented at 4:21 pm on January 19, 2026: member

    On my machine:

    What are the exact steps to reproduce (ideally starting from a fresh install of the operating system)?

    Without them, I’d guess that this is completely unrelated to this pull request, and the issue happens before and after this pull request, unrelated to the changes here, because I am not changing anything about file macros.

    Are you using a multi-config builds?

    For reference, I just tried again on a fresh install of Ubuntu 26.04 LTS:

    0export DEBIAN_FRONTEND=noninteractive && apt update && apt install curl wget htop git vim ccache -y && git clone https://github.com/bitcoin/bitcoin.git  --depth=1 ./b-c && cd b-c && git fetch origin --depth=2 fa37928536e0048a262260baf998ead026b14bb9 && git checkout fa37928536e0048a262260baf998ead026b14bb9 && apt install build-essential cmake pkg-config  python3-zmq libzmq3-dev libevent-dev libboost-dev libsqlite3-dev  systemtap-sdt-dev  libcapnp-dev capnproto  clang llvm libc++-dev libc++abi-dev  mold -y
    1
    2cmake -B ./bld-cmake -DAPPEND_CXXFLAGS='-O3 -g2' -DAPPEND_CFLAGS='-O3 -g2' -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=mold -DCMAKE_C_COMPILER='clang' -DCMAKE_CXX_COMPILER='clang++' --preset=dev-mode -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DBUILD_GUI=OFF                             && cmake --build ./bld-cmake --parallel  $(nproc)
    3
    4./bld-cmake/bin/bitcoind -printtoconsole -logsourcelocations -regtest | grep 'Bitcoin Core version'
    5
    6# 2026-01-19T16:19:01Z [init/common.cpp:153] [LogPackageVersion] Bitcoin Core version v30.99.0-fa37928536e0 (debug build)
    

    Is there a reason for not including 0fe849b as well?

    The debug info is broken for more than 1 year, and no one has bothered to fix it. I want to keep the changes here minimal and fix just one thing.

    I am happy to open a separate pull for the file macro, but without exact steps to reproduce the issue, there is nothing i can do.

  12. fanquake commented at 11:21 am on January 22, 2026: member

    What are the exact steps to reproduce (ideally starting from a fresh install of the operating system)? @hebasto can you followup, so we can move forward here?

  13. pinheadmz approved
  14. pinheadmz commented at 8:35 pm on January 23, 2026: member

    ACK fa37928536e0048a262260baf998ead026b14bb9

    Tested on macos/arm64 with AppleClang 16

    To test I run:

    • lldb build/bin/bitcoind and lldb build/bin/test_bitcoin
    • In the debugger, setup a breakpoint b IsRoutable
    • Then run r (for bitcoind, r -regtest)

    Master / with issue:

    0* thread [#1](/bitcoin-bitcoin/1/), name = 'b-test', queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
    1    frame [#0](/bitcoin-bitcoin/0/): 0x0000000102715814 test_bitcoin`CNetAddr::IsRoutable(this=0x0000600002585900) const at netaddress.cpp:464:12
    

    PR / nice and pretty:

    0* thread [#1](/bitcoin-bitcoin/1/), name = 'b-test', queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
    1    frame [#0](/bitcoin-bitcoin/0/): 0x00000001026ebb18 test_bitcoin`CNetAddr::IsRoutable(this=0x0000600003c92c40) const at netaddress.cpp:464:12
    2   461 	 */
    3   462 	bool CNetAddr::IsRoutable() const
    4   463 	{
    5-> 464 	    return IsValid() && !(IsRFC1918() || IsRFC2544() || IsRFC3927() || IsRFC4862() || IsRFC6598() || IsRFC5737() || IsRFC4193() || IsRFC4843() || IsRFC7343() || IsLocal() || IsInternal());
    6   465 	}
    7   466 	
    8   467 	/**
    
     0-----BEGIN PGP SIGNED MESSAGE-----
     1Hash: SHA256
     2
     3ACK fa37928536e0048a262260baf998ead026b14bb9
     4-----BEGIN PGP SIGNATURE-----
     5
     6iQIzBAEBCAAdFiEE5hdzzW4BBA4vG9eM5+KYS2KJyToFAmlz2t8ACgkQ5+KYS2KJ
     7yTqFmBAArfFMI2jeGdwTufHE83ejVkzeEzUpl1ijyVxcj3YdT6VE0VRvRF7nolj2
     8WPcgqtkjxd0Gh33NuFjv4gCMLrzhmJdQ3shfezN2LsvYrUJWxAaTeytgyBZ3HN2w
     9+oWGF8KEZVzvQ6px/ep4ZOt11Ci0AY6Yr33Yd8npw0Eq7tAAvh9h2Ai4JoQCpsOJ
    10gyIl1SQd5cNqKwLDRRadonfsIESctzZ7+jn/lQ8D8HREW0zQ0Zmw7qVbUMsvB+yj
    1121+pW5uxBjXCklpVlbfjJ9Jbrc6n5TWi8d64Z11vQ+w0PvbSHBbuEnnx5R58YbJi
    12jgvIVNhvUAtsySUpmd13r1GprQvq46cZm9vfKmZPqgXaICPxRqY4i4dh5iPPNnHr
    13H/P+auj2cP0ET+ZnH3ciGo2uAcIKit/HIZReD2ed80CTYOoACflJppelbM8k/NUz
    14XVy5W1EXj/4pV1r4Zq0GRdbYDg57A5eoWtG1PllUOq6PW3inq5EAdgXwG2JBtK5e
    15MMjIBvPLcAfHAqK1w2DY4WKc/mOcNWRqjQQXyc1EBm9caS8EhQycq5WOD+k0CfOc
    16iTXZfj5zikhAmVeUu/mOVy8FruaQMM9h+yGcHbWwHDrqfrYwCHerqJVJ808B+Uqi
    17pNdQ8/EsfiO55tomnmSyauTG+O/sBLdeQlNSXivMQSb8VTHixhE=
    18=ryz/
    19-----END PGP SIGNATURE-----
    

    pinheadmz’s public key is on openpgp.org

  15. DrahtBot requested review from hebasto on Jan 23, 2026
  16. l0rinc approved
  17. l0rinc commented at 9:27 pm on January 23, 2026: contributor

    ACK fa37928536e0048a262260baf998ead026b14bb9

    Tested locally, the breakpoints are finally working without the “file name only” option.

    For the record, I have reported this in the original cmake PR (https://github.com/bitcoin/bitcoin/pull/30454#discussion_r1714285678) - I understood it was added to improve ccache hit rates across different checkout paths…

  18. in contrib/guix/libexec/build.sh:214 in fa37928536
    210@@ -211,6 +211,7 @@ CONFIGFLAGS="-DREDUCE_EXPORTS=ON -DBUILD_BENCH=OFF -DBUILD_GUI_TESTS=OFF -DBUILD
    211 # CFLAGS
    212 HOST_CFLAGS="-O2 -g"
    213 HOST_CFLAGS+=$(find /gnu/store -maxdepth 1 -mindepth 1 -type d -exec echo -n " -ffile-prefix-map={}=/usr" \;)
    214+HOST_CFLAGS+=" -fdebug-prefix-map=${DISTSRC}/src=."
    


    hebasto commented at 11:56 am on January 25, 2026:
    This line doesn’t seem necessary for reproducibility. Is there a specific reason it was added?

    maflcko commented at 8:05 am on January 26, 2026:

    I think it goes hand in hand with what you call “outdated” docs:

    Somewhat unrelated: https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#show-sources-in-debugging might be outdated.

    I think those docs are meant for release builds? However, I’ll leave this untouched for now, so that a dedicated follow-up can deal with this, if there is need.


    hebasto commented at 9:32 am on January 26, 2026:

    I think it goes hand in hand with what you call “outdated” docs:

    Somewhat unrelated: https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#show-sources-in-debugging might be outdated.

    I think those docs are meant for release builds?

    It starts with “If you have ccache enabled…”, which implies this is definitely not for release builds.

    However, I’ll leave this untouched for now, so that a dedicated follow-up can deal with this, if there is need.

    Of course. But is this addition necessary in the first place? Does it solve any specific issues with debuggers or callgrind_annotate for release binaries? Has this been tested?


    maflcko commented at 9:55 am on January 26, 2026:

    Has this been tested?

    I don’t think anyone has ever tested this after the cmake migration, at least no one shared the exact steps to reproduce and the output.

    But is this addition necessary in the first place? Does it solve any specific issues

    Conceptually, it seem required, because I don’t think anyone debugging would set up the absolute paths used by the guix container internally. More likely, they’d use relative paths (like the listed workarounds in the dev notes), or rewrite the paths to absolute ones (depending on their individual directory layout), or change the working dir (not mentioned in the dev notes, but in #21885 (comment)).

    Though, it seems more a UX improvement than a requirement. A valid option could be to remove it and just require debugedit for guix builds?

    In any case, my preference would be to change guix builds in a follow-up.

    It starts with “If you have ccache enabled…”, which implies this is definitely not for release builds.

    I think this is an oversight from the commit that removed the ccache guard and forgot to adjust the note here.

    Though, if no dev is using those instructions for guix builds, I am happy to remove them in a follow-up.


    hebasto commented at 11:59 am on January 26, 2026:

    Conceptually, it seem required, because I don’t think anyone debugging would set up the absolute paths used by the guix container internally.

    I agree. However, some source files are generated and reside in the build tree. So the mapping should be:

    0HOST_CFLAGS+=" -fdebug-prefix-map=${DISTSRC}=."
    

    Otherwise, paths become inconsistent and problematic for configuring source remapping in the debugger:

    0$ gdb ./bitcoin-fa37928536e0/libexec/bitcoin-node
    1(gdb) break IsRoutable
    2Breakpoint 1 at 0xb2aa40: file ./netaddress.cpp, line 463.
    3(gdb) break mp::ProxyClient<ipc::capnp::messages::Init>::construct
    4Breakpoint 2 at 0x5d82e0: file /distsrc-base/distsrc-fa37928536e0-x86_64-linux-gnu/build/src/ipc/capnp/init.capnp.proxy-client.c++, line 18.
    

    maflcko commented at 1:17 pm on January 26, 2026:

    I agree. However, some source files are generated and reside in the build tree. So the mapping should be:

    I agree as well, but I really do not want to modify the guix build in any way in this pull request.

    I think fixing two self-build bugs is good enough for now. Also, there is review and testing from everyone who opened those bugs. I don’t want to harass the reviewers into testing and reviewing changes to the guix build as well.

    The remote risk that this will open a can of worms is too high. So we’ll end up with a failed and un-merged pull request trying to fix 3+N bugs, when we could have a trivial pull request fixing 2 bugs, and another one fixing 1+N bugs on its own pace.

    Otherwise, paths become inconsistent and problematic for configuring source remapping in the debugger:

    Sure, but this is orthogonal to the changes in this pull request, because it happens before and after the changes here in this pull request.


    hebasto commented at 1:54 pm on January 26, 2026:
    I’ve verified that changes in this PR do not alter the file paths stored within release debug symbols.


    maflcko commented at 4:21 pm on January 26, 2026:

    Otherwise, paths become inconsistent and problematic for configuring source remapping in the debugger:

    I’ve filed a new issue in #34414. Let’s continue discussion there.

  19. hebasto approved
  20. hebasto commented at 12:33 pm on January 25, 2026: member

    ACK fa37928536e0048a262260baf998ead026b14bb9.

    I can no longer reproduce the issue I raised in #34281#pullrequestreview-3678613176 for some reason.

    Somewhat unrelated: https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#show-sources-in-debugging might be outdated.

  21. pinheadmz commented at 2:34 pm on January 25, 2026: member

    since this PR touches guix I did a build… dunno if this is helpful

     0
     1zip@zip:~/guix.sigs/fa37928536e0/pinheadmz$ cat noncodesigned.SHA256SUMS
     2632630891953c0a4cdb2a193069d5172119e0b97b4b573c77caf006c15c17781  bitcoin-fa37928536e0-aarch64-linux-gnu-debug.tar.gz
     349f1a2e097a552cc0f0a3078fb4613da83db04b704d77c34d4f85e6f7c998f2a  bitcoin-fa37928536e0-aarch64-linux-gnu.tar.gz
     474556debaaaf275e835f8f00a1095a303a64f52568215fc572d65100338e7ed3  bitcoin-fa37928536e0-arm-linux-gnueabihf-debug.tar.gz
     53e0e8ae9c2b79670e3026e6fb728af44323afd6c3ab27773e6e919630053655e  bitcoin-fa37928536e0-arm-linux-gnueabihf.tar.gz
     639f3c4ba8abe01563e80621aa648a65bbc4ae2afebac8943059cf4b3a5e5c8d2  bitcoin-fa37928536e0-arm64-apple-darwin-codesigning.tar.gz
     777bbc0e3b2709675beac983657548b3d7f024fecbe25e082d6e7aeccdbb4a322  bitcoin-fa37928536e0-arm64-apple-darwin-unsigned.tar.gz
     83aba5b5cca86dfb8dc2b105f09904a31453795478ce6b2f1dd13acf015b1157b  bitcoin-fa37928536e0-arm64-apple-darwin-unsigned.zip
     9444d2a4cb1d208f028b42554ecb482e238bf72537e96200518abd682583589f3  bitcoin-fa37928536e0.tar.gz
    10885332385e17545a0087b42861e86efe5ad9d2db8fdac99c3145b49c32b402df  bitcoin-fa37928536e0-powerpc64-linux-gnu-debug.tar.gz
    11ac3ae2473f9f2fb0ce2a06f241e3134cd6a678a6f6ee8b1e46e954f61d622b41  bitcoin-fa37928536e0-powerpc64-linux-gnu.tar.gz
    124f973a26e88cc03b96d6e1fa70f69ba851e24d3c1b1d9cc8bc0daef0c30faa0a  bitcoin-fa37928536e0-riscv64-linux-gnu-debug.tar.gz
    13f95a6ffa639ca5cb738b8d9f1b98ccf318dd237d8197a59ea5b4e065583af3fe  bitcoin-fa37928536e0-riscv64-linux-gnu.tar.gz
    1436cf9cbf0a7e8e1723791bc94c0d79c5f11e1fed03f5502a3e23085a1042a43a  bitcoin-fa37928536e0-x86_64-apple-darwin-codesigning.tar.gz
    1588beb58160efd80ad3d95e10389cbf09a089cc28c868c826b17f1d10cb09d7a0  bitcoin-fa37928536e0-x86_64-apple-darwin-unsigned.tar.gz
    16286fb289a09babba62d9ed4aee4de59062cd8edca83a770587fdef9c4c4469ed  bitcoin-fa37928536e0-x86_64-apple-darwin-unsigned.zip
    170da196500cf01961d11c0be8f555ba11e502636d7636aa8e12bf56387a04e3cf  bitcoin-fa37928536e0-x86_64-linux-gnu-debug.tar.gz
    18bb0b05bb77998187132a9fdce053464481b060d2e66cde8e8bdd27790426af2f  bitcoin-fa37928536e0-x86_64-linux-gnu.tar.gz
    194f180cbc9b7fc7e5814ce21c39d7c3179ba5f519cca452c4de600f5d70020eea  bitcoin-fa37928536e0-win64-codesigning.tar.gz
    200919408b36fb7a74c1741c9029bcd26db5ca21e6ab6d50d91f5a49250ab8021c  bitcoin-fa37928536e0-win64-debug.zip
    2163856c5b91cef78c65a975a5c3a46e18c9aa536e9cd7b72c42e2d06f05def890  bitcoin-fa37928536e0-win64-setup-unsigned.exe
    229000ec91a6e883fbb9725f449fc07e2047549690546b186651df108c0cb69737  bitcoin-fa37928536e0-win64-unsigned.zip
    
  22. hebasto merged this on Jan 26, 2026
  23. hebasto closed this on Jan 26, 2026

  24. in CMakeLists.txt:491 in fa37928536
    487@@ -488,9 +488,8 @@ try_append_cxx_flags("-fno-extended-identifiers" TARGET core_interface SKIP_LINK
    488 # which can cause issues with coverage builds, particularly when using
    489 # Clang in the OSS-Fuzz environment due to its use of other options
    490 # and a third party script, or with GCC.
    491-try_append_cxx_flags("-fdebug-prefix-map=A=B" TARGET core_interface SKIP_LINK
    492-  IF_CHECK_PASSED "-fdebug-prefix-map=${PROJECT_SOURCE_DIR}/src=."
    493-)
    494+# Set `-fmacro-prefix-map`, so that source file names are expanded without the
    


    fanquake commented at 1:56 pm on January 26, 2026:
    Seems like the comment above here is even more confusing now?

    maflcko commented at 4:18 pm on January 26, 2026:
  25. maflcko deleted the branch on Jan 26, 2026

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-01-27 06:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me