Skip to content

guix: map the whole DISTSRC in -fdebug-prefix-map - #36708

Closed
jespada wants to merge 1 commit into
bitcoin:masterfrom
jespada:guix-debug-prefix-map
Closed

jespada wants to merge 1 commit into
bitcoin:masterfrom
jespada:guix-debug-prefix-map

Conversation

@jespada

@jespada jespada commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Fixes #34414.

Why

The Guix build scripts set -fdebug-prefix-map=${DISTSRC}/src=.. Generated sources (for example the capnp proxies) are in the build tree, outside ${DISTSRC}/src, so their debug info kept the absolute /distsrc-base/distsrc-<commit>-<host>/build/... path. Sources from src/ were relative. With two kinds of paths, it is hard to set up source path mapping in a debugger.

This maps ${DISTSRC} instead, in build_linux.sh, build_linux_gui.sh, build_win.sh and build_win_gui.sh. The macOS scripts do not set -fdebug-prefix-map, so this PR does not change them.

What changes in the debug paths

All source paths are now relative to the repository root:

Before After
Source in src/ ./netaddress.cpp ./src/netaddress.cpp
Generated source /distsrc-base/distsrc-<commit>-<host>/build/src/ipc/capnp/init.capnp.proxy-client.c++ ./build/src/ipc/capnp/init.capnp.proxy-client.c++

To find the sources in gdb, use the repository root as the source directory (directory /path/to/bitcoin) instead of src/.

How I checked

  • Guix build of this change on an x86_64 build machine, for the six Linux and Windows hosts.
  • readelf --debug-dump=info, --debug-dump=rawline and --debug-dump=str of libexec/bitcoin-node.dbg (x86_64-linux-gnu): no distsrc string. Sources show as ./src/..., generated capnp files as ./build/src/....
  • bitcoind.exe.dbg from the Windows debug zip: no distsrc string.
  • The only absolute paths left come from the Guix toolchain (glibc, libgcc). This change does not affect them.

I will post the Guix hashes for this commit in a comment. I do not have an aarch64 build machine at the moment, so a build from someone with one is welcome.

Generated sources (e.g. capnp proxies) live in the build tree, outside
${DISTSRC}/src, so their debug paths kept the absolute /distsrc-base
prefix. Map ${DISTSRC} instead so every source path is relative.

Fixes bitcoin#34414.
@DrahtBot

DrahtBot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

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

External sites

Reviews

See the guideline and AI policy for information on the review process.
A summary of reviews will appear here.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #36270 (build: ensure release binaries don't contain depends references by fanquake)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@jespada

jespada commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

Guix build of 00867d7 (x86_64 build machine):

x86_64
c1d8031f2cd1d06378eb804baf9a52fe37d119ca8005da4080543c6be4ed4596  guix-build-00867d70c01b/output/aarch64-linux-gnu/SHA256SUMS.part
7370e22fdefad1459b20ee01304b1a94fbf85a9eca0bc645aa8ff995503d6cb2  guix-build-00867d70c01b/output/aarch64-linux-gnu/bitcoin-00867d70c01b-aarch64-linux-gnu-debug.tar.gz
5426e4f03c118ab9f7b8eb264e2fae3adced11aef5b664c07d7402efa1607568  guix-build-00867d70c01b/output/aarch64-linux-gnu/bitcoin-00867d70c01b-aarch64-linux-gnu.tar.gz
a2704be6259457791b736bd342efe6da9ce71cb08832a6212593f51421722ec4  guix-build-00867d70c01b/output/arm-linux-gnueabihf/SHA256SUMS.part
0f8d323cafd3ce138cbb9032ee433e5c9587965a1d0035172a31dffa9fd23506  guix-build-00867d70c01b/output/arm-linux-gnueabihf/bitcoin-00867d70c01b-arm-linux-gnueabihf-debug.tar.gz
7c3744d66a7aba550fb1916b89f553dcc46ae5909a78fa0dcb4370acbb29236d  guix-build-00867d70c01b/output/arm-linux-gnueabihf/bitcoin-00867d70c01b-arm-linux-gnueabihf.tar.gz
cdce96985aee73f5b4b43dd5bf08725fe5d22e8229fea9b33a05a10d865e026a  guix-build-00867d70c01b/output/dist-archive/bitcoin-00867d70c01b.tar.gz
d12abf6b1cfc7b4629c808af9e8eff49b8065f370048d9faf3d33e427688fc00  guix-build-00867d70c01b/output/powerpc64-linux-gnu/SHA256SUMS.part
fc2a07395af1e5786523e566b4c79176445c92c9e091493df2b527163a66b4dc  guix-build-00867d70c01b/output/powerpc64-linux-gnu/bitcoin-00867d70c01b-powerpc64-linux-gnu-debug.tar.gz
b989b880962028a71e4992bf1faa5e37848c02acb9c0be2533c8fc899515562c  guix-build-00867d70c01b/output/powerpc64-linux-gnu/bitcoin-00867d70c01b-powerpc64-linux-gnu.tar.gz
edcad0104e9855f72aaae58d42dadab5706f432774a5c4d9d6439bd0792ee365  guix-build-00867d70c01b/output/riscv64-linux-gnu/SHA256SUMS.part
f7fa245e77a1143485626c765d8332d17775033a6c546973e68f9a1d8a25ba7b  guix-build-00867d70c01b/output/riscv64-linux-gnu/bitcoin-00867d70c01b-riscv64-linux-gnu-debug.tar.gz
d85c898a9b4fd4b20f4b725a690e85fb5e608687cd20566e2af140ccfbcda86b  guix-build-00867d70c01b/output/riscv64-linux-gnu/bitcoin-00867d70c01b-riscv64-linux-gnu.tar.gz
8affcb7a784e9ad32128eb71e01ef0e85dad4884ae6e130ef914001aae0c367f  guix-build-00867d70c01b/output/x86_64-linux-gnu/SHA256SUMS.part
61cadcebac7788d3358bc24ed85a3ab024ed384efd099cda78b8a3fa8ee8c9ff  guix-build-00867d70c01b/output/x86_64-linux-gnu/bitcoin-00867d70c01b-x86_64-linux-gnu-debug.tar.gz
90c71bcd91abf2529e59ea38cf27d50936c28a63a0e28086a2b488bff79765d6  guix-build-00867d70c01b/output/x86_64-linux-gnu/bitcoin-00867d70c01b-x86_64-linux-gnu.tar.gz
260ae56d80bb1377ff997d3e8066868fe108d0f3f90d30cb9df22d1bfb7f1ab3  guix-build-00867d70c01b/output/x86_64-w64-mingw32/SHA256SUMS.part
465e992f723dffdf8b949e8e326264da91b623949b313d99f93a0f5f03c05c0c  guix-build-00867d70c01b/output/x86_64-w64-mingw32/bitcoin-00867d70c01b-win64-codesigning.tar.gz
9b1ba3ef3e7993f3d34034679862a7939627d4193db653c247fc05925677b6bd  guix-build-00867d70c01b/output/x86_64-w64-mingw32/bitcoin-00867d70c01b-win64-debug.zip
a8f0290fb247f8e06bcbc815b49a12e7bd5754573dcb807aaadef3ed6354729c  guix-build-00867d70c01b/output/x86_64-w64-mingw32/bitcoin-00867d70c01b-win64-setup-unsigned.exe
6554b85fce0b173821c57e1fb30e2ee5316783833a68efb9c914ad8212a7dc86  guix-build-00867d70c01b/output/x86_64-w64-mingw32/bitcoin-00867d70c01b-win64-unsigned.zip

@DrahtBot

DrahtBot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

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

File commit 43a33e5
(master)
commit 9172f4d
(pull/36708/merge)
*-aarch64-linux-gnu-debug.tar.gz bd1be406251b0830... 8d97d6cf1ea779c6...
*-aarch64-linux-gnu.tar.gz f25f9e09ede2f54a... 42adae4be565366b...
*-arm-linux-gnueabihf-debug.tar.gz 8914e06f638d0188... 5bf9005b911e369e...
*-arm-linux-gnueabihf.tar.gz 825652890c01c086... daebc976af67d1e4...
*-arm64-apple-darwin-codesigning.tar.gz 80c35cf9e61559f2... 18e89203a7d0d0d5...
*-arm64-apple-darwin-unsigned.tar.gz 66caba904aa20fb0... 303d668984409a95...
*-arm64-apple-darwin-unsigned.zip adaf018e7c491ea0... 10428a2dc224263b...
*-powerpc64-linux-gnu-debug.tar.gz 19f3931aa23a3bd8... 821b2f1a717399ce...
*-powerpc64-linux-gnu.tar.gz 8854ecbdd1c4c527... 08bd8a302e280993...
*-riscv64-linux-gnu-debug.tar.gz 86192da4bd7e12c2... 86b590ef0b0ef5ec...
*-riscv64-linux-gnu.tar.gz 3c270d4945bd6d7e... f036eb8da1f31818...
*-win64-codesigning.tar.gz 5102faf1a020f55a... 5e1891b915fe0b60...
*-win64-debug.zip 3342e6211801f147... a3fc83f325860960...
*-win64-setup-unsigned.exe 10bb847d2df1639a... e63042c5ecdc9ab7...
*-win64-unsigned.zip e9823de8fc4cdeed... 92767d4e2ba0dfed...
*-x86_64-apple-darwin-codesigning.tar.gz 5cc61b2feffba75f... 611ef6796972ac20...
*-x86_64-apple-darwin-unsigned.tar.gz 2dcff22293f3b9f1... 2f56d532875c4454...
*-x86_64-apple-darwin-unsigned.zip fb4b47f6714e128b... d1a67894b08c12a4...
*-x86_64-linux-gnu-debug.tar.gz 897e63af3a39b976... 919815d1552dc225...
*-x86_64-linux-gnu.tar.gz 1848ddacee205ec5... ca57c2b9377f091a...
*.tar.gz b0f192888345f26a... 1aeb5c6f746d973c...
SHA256SUMS.part 493cd803369bf35a... 8db1c19a21d945f1...
guix_build.log 7078d254e4746a3f... fcc0ccb947616c83...
guix_build.log.diff dafd7c1a2eac818d...

@maflcko

maflcko commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Hmm, I was thinking this is a nice change, but I am not so sure now. Maybe this and the issue should just be closed?

Recall that there is still plenty of stuff not mapped, like /bitcoin/depends/..., or /usr/include/.... So mapping capnp seems like a rounding error that doesn't really matter? (Recall a user won't have the build dir anyway for this guix release build)

So I think this can still be done, but I think it would mostly be a "style cleanup".

@jespada

jespada commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor Author

Hmm, I was thinking this is a nice change, but I am not so sure now. Maybe this and the issue should just be closed?

Recall that there is still plenty of stuff not mapped, like /bitcoin/depends/..., or /usr/include/.... So mapping capnp seems like a rounding error that doesn't really matter? (Recall a user won't have the build dir anyway for this guix release build)

So I think this can still be done, but I think it would mostly be a "style cleanup".

Fair point. I checked the line tables of bitcoin-node.dbg from my build, and after this change about a third of the source directories are still absolute (/bitcoin/depends/..., /usr/include/..., plus the toolchain's /tmp/guix-build-...). So the capnp mapping alone does not give fully relative debug info, and it is mostly cosmetic. Feel free to close this one.

do you think mapping of all paths, including depends, be worth it, or is it not worth the review? I'm ok to do update this one if you think so.

#36709 is separate: it fixes a real build failure with --system, which I hit while trying to test this PR.

@maflcko

maflcko commented Nov 6, 2026

Copy link
Copy Markdown
Member

See also #36270, but that just re-writes the path and the user would still have to fetch the sources themselves (and likely rewrite the debug paths themselves again)

@maflcko

maflcko commented Nov 6, 2026

Copy link
Copy Markdown
Member

I think I'll close this for now. The changes are fine, but as a pure style cleanup, it may be not worth it. Let's wait until the motivation is stronger and then re-open.

@maflcko maflcko closed this Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

guix: Re-evaluate fdebug-prefix-map

3 participants