Skip to content

guix: Compile GUI separately from other binaries - #35098

Closed
hebasto wants to merge 6 commits into
bitcoin:masterfrom
hebasto:260417-guix-gui
Closed

hebasto wants to merge 6 commits into
bitcoin:masterfrom
hebasto:260417-guix-gui

Conversation

@hebasto

@hebasto hebasto commented Apr 17, 2026 •

Copy link
Copy Markdown
Member

This PR isolates the GUI build, including its specific dependencies, into a dedicated container.

Benefits of this approach:

  1. Improves security: Any unknown backdoors in GUI-specific dependencies will no longer affect bitcoind and other non-GUI binaries.

  2. Enables a safer upgrade path: Allows for the introduction of additional GUI dependencies needed for Wayland support or transitioning to the QML-based GUI.

  3. Could be useful for guix: produce a -static-pie bitcoind #25573.

This implementation is based on an idea proposed here.

Currently based on #34948 and #35072.

Closes #29914.

hebasto added 5 commits April 17, 2026 10:56
This removes the `USE_DBUS` definition from `bitcoin-build-config.h`,
reducing the dependency of non-GUI code on GUI-specific definitions.
This removes the `USE_QRCODE` definition from `bitcoin-build-config.h`,
reducing the dependency of non-GUI code on GUI-specific definitions.

Additionally, `QRencode::QRencode` is now linked only when wallet is
enabled, because the `qrencode.h` header is used exclusively in
wallet-specific code.
When using the Guix build/sign scripts from this repository, the Guix
environment and the `GUIX_ENVIRONMENT` variable within the container are
fully defined by the commit hash and the user-provided
`ADDITIONAL_GUIX_*_FLAGS`.

This change removes `GUIX_ENVIRONMENT` from the package ID calculations.
Doing so allows us to split manifests and reuse built depends packages
across containers that utilize these split manifests in subsequent
commits.

The potential impact of `ADDITIONAL_GUIX_*_FLAGS` is still accounted for
by passing them to the `gen_id` script via the `{BUILD,HOST}_ID_SALT`
variables.
@DrahtBot

DrahtBot commented Apr 17, 2026 •

Copy link
Copy Markdown
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/35098.

Reviews

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #35131 (guix, refactor: Minor script cleanups and improvements by hebasto)
  • #35072 (cmake: Remove optional definitions from bitcoin-build-config.h by hebasto)
  • #34948 (guix: Split manifest into build and codesign manifests by hebasto)
  • #33974 (cmake: Check dependencies after build option interaction by hebasto)
  • #32764 (guix: Build for macOS using Clang only by hebasto)
  • #32162 (depends: Switch from multilib to platform-specific toolchains by hebasto)
  • #25573 (guix: produce a -static-pie bitcoind 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.

@DrahtBot

Copy link
Copy Markdown
Contributor

🚧 At least one of the CI tasks failed.
Task lint: https://github.com/bitcoin/bitcoin/actions/runs/24561368833/job/71811492362
LLM reason (✨ experimental): CI failed because the shell lint check (lint-shell.py) reported a ShellCheck SC2206 word-splitting warning in contrib/guix/libexec/build.sh and treated it as an error.

Hints

Try to run the tests locally, according to the documentation. However, a CI failure may still
happen due to a number of reasons, for example:

  • Possibly due to a silent merge conflict (the changes in this pull request being
    incompatible with the current code in the target branch). If so, make sure to rebase on the latest
    commit of the target branch.

  • A sanitizer issue, which can only be found by compiling with the sanitizer and running the
    affected test.

  • An intermittent issue.

Leave a comment here, if you need help tracking down a confusing failure.

@hebasto

hebasto commented Apr 27, 2026

Copy link
Copy Markdown
Member Author

My Guix build:

aarch64
8d308b60d97239daa22fc9ba920437afbf0664fbdd79cbb980d8c48443eb9f0d  guix-build-c4730955ec14/output/aarch64-linux-gnu/SHA256SUMS.part
4c47b63c7c1d85318bb69bd86dfde30120f5b564f4234a56b66121caad871e47  guix-build-c4730955ec14/output/aarch64-linux-gnu/bitcoin-c4730955ec14-aarch64-linux-gnu-debug.tar.gz
48e5a702549ecbadbfaa03a74da8fd57fa3e27dad2974b5809eec951563ce512  guix-build-c4730955ec14/output/aarch64-linux-gnu/bitcoin-c4730955ec14-aarch64-linux-gnu.tar.gz
809c4ba92375c225343fe72f1301cde792baccb1309ef398a78692569f7f82e2  guix-build-c4730955ec14/output/arm-linux-gnueabihf/SHA256SUMS.part
0e8c57f500706e35234a1ca65267e46abc69245d2b2614c6b05d5027d7a13a6f  guix-build-c4730955ec14/output/arm-linux-gnueabihf/bitcoin-c4730955ec14-arm-linux-gnueabihf-debug.tar.gz
d43d739efcc84fd50ae9c8fafc7d2a238ae68494fe013a5cfaefa6f96da6d59e  guix-build-c4730955ec14/output/arm-linux-gnueabihf/bitcoin-c4730955ec14-arm-linux-gnueabihf.tar.gz
0477d6edfc51e27260ef3ded768bb5dfe0b31151ca784dbbe3d61b019b64c6bc  guix-build-c4730955ec14/output/arm64-apple-darwin/SHA256SUMS.part
65ee14c6a96b5eff66cb37323e58fda3eb148772b0545037a15b3aa00b9b103c  guix-build-c4730955ec14/output/arm64-apple-darwin/bitcoin-c4730955ec14-arm64-apple-darwin-codesigning.tar.gz
b45bf246506de6a858dc9b7e5054b2ebf8db0e3f5b1d01f0cb80446da98999b5  guix-build-c4730955ec14/output/arm64-apple-darwin/bitcoin-c4730955ec14-arm64-apple-darwin-unsigned.tar.gz
ec833b60a512c584bd3bdaa97cfed5edd1a00f15b6f8b6e87c926d4b60c05065  guix-build-c4730955ec14/output/arm64-apple-darwin/bitcoin-c4730955ec14-arm64-apple-darwin-unsigned.zip
5d06358004486a2f3395b37390684cdf8fc6f6c239a1e3acd6a9bfa4ea459127  guix-build-c4730955ec14/output/dist-archive/bitcoin-c4730955ec14.tar.gz
e6b56adabeac53ebb7deb9931e1a35f573f15f2c0660614344471094336d4f7b  guix-build-c4730955ec14/output/powerpc64-linux-gnu/SHA256SUMS.part
23c8f012f09ef3f063d7e9adc2945277d9ccac55a2885b0cce5b0edcadc2d521  guix-build-c4730955ec14/output/powerpc64-linux-gnu/bitcoin-c4730955ec14-powerpc64-linux-gnu-debug.tar.gz
f26008575cc16ba33a7f8988a638baecd6243d8f9bc769541cadbbc4e93998de  guix-build-c4730955ec14/output/powerpc64-linux-gnu/bitcoin-c4730955ec14-powerpc64-linux-gnu.tar.gz
b8136a36ca039e4db008a7ba3694be1a3ef5b8497a28ff0430ca4cea16e2fdab  guix-build-c4730955ec14/output/riscv64-linux-gnu/SHA256SUMS.part
3981d1fe92fbc7683b8b6d0b2f83beab2cd9f4e69ee961b831d82c4771a2e343  guix-build-c4730955ec14/output/riscv64-linux-gnu/bitcoin-c4730955ec14-riscv64-linux-gnu-debug.tar.gz
aff08b59011bc95f493b3866f00864a1501ac089909cb896e8fa1e85fa15191e  guix-build-c4730955ec14/output/riscv64-linux-gnu/bitcoin-c4730955ec14-riscv64-linux-gnu.tar.gz
32ba8fbdc3e4e2c47f0980f515821314c588129942479c972de0444d9a7a7709  guix-build-c4730955ec14/output/x86_64-apple-darwin/SHA256SUMS.part
6cc971e899d7f6472a8a3402b42d5204c0b78ce6c70bf10a23cbc710451f0d12  guix-build-c4730955ec14/output/x86_64-apple-darwin/bitcoin-c4730955ec14-x86_64-apple-darwin-codesigning.tar.gz
070e7c96aeb5ed0deebb4c0d37055414c2922bf1c8b83a93b2ad36f1d54aa374  guix-build-c4730955ec14/output/x86_64-apple-darwin/bitcoin-c4730955ec14-x86_64-apple-darwin-unsigned.tar.gz
2bee7e0febb3cabe3be9d6ddb01a151bbc4856d10a00e962dd094f09bfc6303e  guix-build-c4730955ec14/output/x86_64-apple-darwin/bitcoin-c4730955ec14-x86_64-apple-darwin-unsigned.zip
a82816d07f0b7399b81c6c0be638d42ce958f625ac474bbd241bdc359f93ab44  guix-build-c4730955ec14/output/x86_64-linux-gnu/SHA256SUMS.part
765fce3f8e1d93d16f5ce4aea85ea5a5df7d93f56ead20820453f2ba11968c8a  guix-build-c4730955ec14/output/x86_64-linux-gnu/bitcoin-c4730955ec14-x86_64-linux-gnu-debug.tar.gz
e0cfa6f076bdc9924c2601a031fc05f5f3743a8fe62252770068532b966eb195  guix-build-c4730955ec14/output/x86_64-linux-gnu/bitcoin-c4730955ec14-x86_64-linux-gnu.tar.gz
3fb88c8569f43855f7fb514970e2b9009cea8c6d5f2850c0e751d65a72dcd8d4  guix-build-c4730955ec14/output/x86_64-w64-mingw32/SHA256SUMS.part
079f4921a2456eb983644754f74f280e07faab8f956f0e45524fbabb439aba2a  guix-build-c4730955ec14/output/x86_64-w64-mingw32/bitcoin-c4730955ec14-win64-codesigning.tar.gz
a0ded9c2beedb4d2602ade21e232fc9ed7b099cb7dab57644b14f3651080bb47  guix-build-c4730955ec14/output/x86_64-w64-mingw32/bitcoin-c4730955ec14-win64-debug.zip
c6d59948845b1debdae9d05b17f25496a0700f2fe966c1d2f5919756a2fbf90d  guix-build-c4730955ec14/output/x86_64-w64-mingw32/bitcoin-c4730955ec14-win64-setup-unsigned.exe
ac0e507ef67dae4595ce40433c6e8f05a077e5f0dd0a7ef3bd23d50395d95523  guix-build-c4730955ec14/output/x86_64-w64-mingw32/bitcoin-c4730955ec14-win64-unsigned.zip

@fanquake

Copy link
Copy Markdown
Member

or transitioning to the QML-based GUI.

Is that blocked on this change; I thought it just needed to be finished? (looking at https://github.com/bitcoin-core/gui-qml, it just has this repo as a subtree; I also can't see any new dependencies)

Could be useful for #25573.

Im not sure yet, given the current approach of re-using the same build dir. We will want to compile / link the static binaries with different compilation / link flags.

@hebasto

hebasto commented Apr 29, 2026

Copy link
Copy Markdown
Member Author

or transitioning to the QML-based GUI.

Is that blocked on this change; I thought it just needed to be finished? (looking at https://github.com/bitcoin-core/gui-qml, it just has this repo as a subtree; I also can't see any new dependencies)

The qt6 branch using this repo as a subtree is a shortcut taken during the migration from Qt 5 to Qt 6.

The transition to QML-based GUI will use a branch that is cleanly mergeable into the master branch in this repo (rebasing is currently in progress).

The new dependencies will look like the ones here.

Could be useful for #25573.

Im not sure yet, given the current approach of re-using the same build dir. We will want to compile / link the static binaries with different compilation / link flags.

Dropped this from the PR description. However, it still seems unreasonable to keep GUI-specific stuff in a Guix prefix where static non-GUI binaries are being built.

@fanquake

fanquake commented Apr 29, 2026 •

Copy link
Copy Markdown
Member

The new dependencies will look like the ones here.

Ok, so some additional Qt subcomponents? My point is that doing anything QML related in this repo, doesn't seem to be blocked on the changes here. It could be done today, by just enabling a few more components in Qt, without any other, new, non-Qt dependencies?

@hebasto

hebasto commented Apr 29, 2026

Copy link
Copy Markdown
Member Author

The new dependencies will look like the ones here.

Ok, so some additional Qt subcomponents? My point is that doing anything QML related in this repo, doesn't seem to be blocked on the changes here. It could be done today, by just enabling a few more components in Qt, without any other, new, non-Qt dependencies?

I'm a bit confused. Are we making a distinction between additional Qt components and other non-Qt dependencies? If so, what is the difference between them from a security perspective?

This PR is not proposed solely for the transition to the QML-based GUI. Its primary purpose is to resolve #29914, which doesn't mention QML at all. As a byproduct, it also enables the transition to the QML GUI without having any effect on the security of the non-GUI release binaries.

@fanquake

Copy link
Copy Markdown
Member

I'm a bit confused. Are we making a distinction between additional Qt components and other non-Qt dependencies? If so, what is the difference between them from a security perspective?

Yes. I think we could generally add new Qt submodules as-needed, given we are already using Qt. Any other new dependency should be evaluated on a case-by-case basis.

it also enables the transition to the QML GUI without having any effect on the security of the non-GUI release binaries.

I think this is my confusion. I don't think there are any security-related issues that would arise from moving to QML, today, if it only requires using a few more Qt modules; so am trying to clarify how this PR provides a "safer upgrade path".

@fanquake

Copy link
Copy Markdown
Member

I've pushed an alternate approach into #25573 (if you want to leave approach feedback there), as the approach here wont work for static builds (we can't re-use depends / build artifacts across linux & linux GUI builds. My approach should be compatible with #34948, and wouldn't need changes like #35072.

@DrahtBot

Copy link
Copy Markdown
Contributor

🐙 This pull request conflicts with the target branch and needs rebase.

@hebasto

hebasto commented May 28, 2026

Copy link
Copy Markdown
Member Author

I've pushed an alternate approach into #25573 (if you want to leave approach feedback there), as the approach here wont work for static builds (we can't re-use depends / build artifacts across linux & linux GUI builds.

Closing.

@hebasto hebasto closed this May 28, 2026
fanquake added a commit that referenced this pull request May 30, 2026
5338877 guix: Remove redundant ShellCheck `source` directives (Hennadii Stepanov)
62cf7bc guix, refactor: Add `BASE` argument to `*_for_host` functions (Hennadii Stepanov)
5d46429 guix, refactor: Move `distsrc_for_host()` to `prelude.bash` (Hennadii Stepanov)
cab65ea guix, refactor: Move duplicated `profiledir_for_host()` to `prelude.bash` (Hennadii Stepanov)
faa9d43 guix, refactor: Move duplicated `outdir_for_host()` to `prelude.bash` (Hennadii Stepanov)
6b59fd6 guix, refactor: Remove `contains()` function (Hennadii Stepanov)
d4c69a7 guix, refactor: Remove unused `out_name()` function (Hennadii Stepanov)

Pull request description:

  While working on #35098, I reviewed my notes regarding a few minor Guix script flaws and decided to address them here.

  This PR:

  1. Removes unused code.

  2. Reduces code duplication.

  3. Improves consistency across function usage.

  4. Minimizes ShellCheck directive usage.

ACKs for top commit:
  fanquake:
    ACK 5338877 - the move-only deduplication, and dead code removal seem fine. The other (refactoring) changes seem less well motived

Tree-SHA512: d565e31ba49300f3001b04d3143721aced305f41bca6d04c33dc479d568efb2c06d91758619378199f174a40f1306c9418ae80d5478013a65ad96341bea122b1
rustaceanrob pushed a commit to 2140-dev/bitcoin that referenced this pull request Jun 5, 2026
…ements

5338877 guix: Remove redundant ShellCheck `source` directives (Hennadii Stepanov)
62cf7bc guix, refactor: Add `BASE` argument to `*_for_host` functions (Hennadii Stepanov)
5d46429 guix, refactor: Move `distsrc_for_host()` to `prelude.bash` (Hennadii Stepanov)
cab65ea guix, refactor: Move duplicated `profiledir_for_host()` to `prelude.bash` (Hennadii Stepanov)
faa9d43 guix, refactor: Move duplicated `outdir_for_host()` to `prelude.bash` (Hennadii Stepanov)
6b59fd6 guix, refactor: Remove `contains()` function (Hennadii Stepanov)
d4c69a7 guix, refactor: Remove unused `out_name()` function (Hennadii Stepanov)

Pull request description:

  While working on bitcoin#35098, I reviewed my notes regarding a few minor Guix script flaws and decided to address them here.

  This PR:

  1. Removes unused code.

  2. Reduces code duplication.

  3. Improves consistency across function usage.

  4. Minimizes ShellCheck directive usage.

ACKs for top commit:
  fanquake:
    ACK 5338877 - the move-only deduplication, and dead code removal seem fine. The other (refactoring) changes seem less well motived

Tree-SHA512: d565e31ba49300f3001b04d3143721aced305f41bca6d04c33dc479d568efb2c06d91758619378199f174a40f1306c9418ae80d5478013a65ad96341bea122b1
(cherry picked from commit fbe6287)
Kino1994 pushed a commit to Kino1994/bitcoin-full-history that referenced this pull request Jun 28, 2026
…d improvements

a242a12 guix: Remove redundant ShellCheck `source` directives (Hennadii Stepanov)
45867c8 guix, refactor: Add `BASE` argument to `*_for_host` functions (Hennadii Stepanov)
22fe58e guix, refactor: Move `distsrc_for_host()` to `prelude.bash` (Hennadii Stepanov)
b22a57a guix, refactor: Move duplicated `profiledir_for_host()` to `prelude.bash` (Hennadii Stepanov)
10c2997 guix, refactor: Move duplicated `outdir_for_host()` to `prelude.bash` (Hennadii Stepanov)
6c8426b guix, refactor: Remove `contains()` function (Hennadii Stepanov)
fcd785e guix, refactor: Remove unused `out_name()` function (Hennadii Stepanov)

Pull request description:

  While working on bitcoin/bitcoin#35098, I reviewed my notes regarding a few minor Guix script flaws and decided to address them here.

  This PR:

  1. Removes unused code.

  2. Reduces code duplication.

  3. Improves consistency across function usage.

  4. Minimizes ShellCheck directive usage.

ACKs for top commit:
  fanquake:
    ACK a242a12 - the move-only deduplication, and dead code removal seem fine. The other (refactoring) changes seem less well motived

Tree-SHA512: d565e31ba49300f3001b04d3143721aced305f41bca6d04c33dc479d568efb2c06d91758619378199f174a40f1306c9418ae80d5478013a65ad96341bea122b1
BigcoinBGC pushed a commit to BigcoinBGC/bigcoin that referenced this pull request Jun 30, 2026
…d improvements

e2a92ec guix: Remove redundant ShellCheck `source` directives (Hennadii Stepanov)
bd9db9e guix, refactor: Add `BASE` argument to `*_for_host` functions (Hennadii Stepanov)
3ba31d0 guix, refactor: Move `distsrc_for_host()` to `prelude.bash` (Hennadii Stepanov)
ab5abe5 guix, refactor: Move duplicated `profiledir_for_host()` to `prelude.bash` (Hennadii Stepanov)
7f6b89b guix, refactor: Move duplicated `outdir_for_host()` to `prelude.bash` (Hennadii Stepanov)
e12b41b guix, refactor: Remove `contains()` function (Hennadii Stepanov)
1de71b3 guix, refactor: Remove unused `out_name()` function (Hennadii Stepanov)

Pull request description:

  While working on bitcoin/bitcoin#35098, I reviewed my notes regarding a few minor Guix script flaws and decided to address them here.

  This PR:

  1. Removes unused code.

  2. Reduces code duplication.

  3. Improves consistency across function usage.

  4. Minimizes ShellCheck directive usage.

ACKs for top commit:
  fanquake:
    ACK e2a92ec - the move-only deduplication, and dead code removal seem fine. The other (refactoring) changes seem less well motived

Tree-SHA512: d565e31ba49300f3001b04d3143721aced305f41bca6d04c33dc479d568efb2c06d91758619378199f174a40f1306c9418ae80d5478013a65ad96341bea122b1
Kino1994 pushed a commit to Kino1994/bitcoin-full-history that referenced this pull request Aug 19, 2026
…d improvements

53388773af78f8f1b8f3e705a5400cff6bee6de0 guix: Remove redundant ShellCheck `source` directives (Hennadii Stepanov)
62cf7bc53f238849cfa872972fc384dd25175fba guix, refactor: Add `BASE` argument to `*_for_host` functions (Hennadii Stepanov)
5d46429e322aa4840e0e7a714caa87672aee5faa guix, refactor: Move `distsrc_for_host()` to `prelude.bash` (Hennadii Stepanov)
cab65ea9c6963bfffe73524b1485378b6305c398 guix, refactor: Move duplicated `profiledir_for_host()` to `prelude.bash` (Hennadii Stepanov)
faa9d4345ff584eb2a7c09f4087c487c381e6b42 guix, refactor: Move duplicated `outdir_for_host()` to `prelude.bash` (Hennadii Stepanov)
6b59fd6b8cfd21bb008d3b71d4f1b24cf562854b guix, refactor: Remove `contains()` function (Hennadii Stepanov)
d4c69a72246ed6a290c5aca812d5b896904b4382 guix, refactor: Remove unused `out_name()` function (Hennadii Stepanov)

Pull request description:

  While working on bitcoin/bitcoin#35098, I reviewed my notes regarding a few minor Guix script flaws and decided to address them here.

  This PR:

  1. Removes unused code.

  2. Reduces code duplication.

  3. Improves consistency across function usage.

  4. Minimizes ShellCheck directive usage.

ACKs for top commit:
  fanquake:
    ACK 53388773af78f8f1b8f3e705a5400cff6bee6de0 - the move-only deduplication, and dead code removal seem fine. The other (refactoring) changes seem less well motived

Tree-SHA512: d565e31ba49300f3001b04d3143721aced305f41bca6d04c33dc479d568efb2c06d91758619378199f174a40f1306c9418ae80d5478013a65ad96341bea122b1
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.

RFC: In guix compile the GUI sequentially from everything else?

3 participants