Repository navigation
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/35929. ReviewsSee the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsReviewers, this pull request conflicts with the following ones:
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. |
|
I think the PR description needs to be updated to clarify that this is only a "regression" for macOS/Windows builds. The point of #35537 was to split the Linux builds, and they wont be re-usable going forward. |
The PR description has been updated. Rebuilding packages in depends when switching branches is still a regression, even for Linux hosts. This affects all Guix builders, similar to the issue resolved in #34228.
Yes. For the case I mentioned above. UPDATE: Please see my revised response here. |
488f4e1 to
2e605da
Compare
|
Rebased on top of the recent changes in the depends build subsystem. |
For static builds, this approach won't cache non-native non-GUI packages properly. However, that can be mitigated with a single-line change, which follows your idea of separate caches: --- a/contrib/guix/libexec/build_linux_gui.sh
+++ b/contrib/guix/libexec/build_linux_gui.sh
@@ -15,7 +15,7 @@ gcc_toolchain
make -C depends --jobs="$JOBS" HOST="$HOST" \
${V:+V=1} \
${SOURCES_PATH+SOURCES_PATH="$SOURCES_PATH"} \
- ${BASE_CACHE+BASE_CACHE="$BASE_CACHE"} \
+ BASE_CACHE="${BASE_CACHE:-$PWD/depends/built}/gui" \
${build_CC+build_CC="$build_CC"} \
${build_CXX+build_CXX="$build_CXX"}
|
willcl-ark
left a comment
There was a problem hiding this comment.
tACK 2e605da
Manually tested changing GUIX_ENVIRONMENT here and on master:
bitcoin/worktrees/pr-35929 on pr-35929 [$] via △ v4.3.4 via 🐍 v3.14.7 via ❄️ impure (nix-shell-env)
❯ GUIX_ENVIRONMENT=/tmp make -C depends --no-print-directory print-build_id
build_id=fb8808cf406fe741121401c6dca25037e1dfdccf9e6a5094ab3ec3b2e9745f39
bitcoin/worktrees/pr-35929 on pr-35929 [$] via △ v4.3.4 via 🐍 v3.14.7 via ❄️ impure (nix-shell-env) took 6s
❯ GUIX_ENVIRONMENT=/var make -C depends --no-print-directory print-build_id
build_id=fb8808cf406fe741121401c6dca25037e1dfdccf9e6a5094ab3ec3b2e9745f39
bitcoin/worktrees/pr-35929 on pr-35929 [$] via △ v4.3.4 via 🐍 v3.14.7 via ❄️ impure (nix-shell-env) took 2s
❯ cd bitcoin
core/bitcoin/bitcoin on master [$?⇕] via △ v4.3.4 via 🐍 v3.14.7 via ❄️ impure (nix-shell-env)
❯ GUIX_ENVIRONMENT=/tmp make -C depends --no-print-directory print-build_id
build_id=055db281a936a1f3617749173a3dfda529852292674e1dd4a0547c09322ad102
core/bitcoin/bitcoin on master [$?⇕] via △ v4.3.4 via 🐍 v3.14.7 via ❄️ impure (nix-shell-env) took 3s
❯ GUIX_ENVIRONMENT=/var make -C depends --no-print-directory print-build_id
build_id=ea52a88298f7ff28b6d45e44486d1577de149afdabb276263eb08d9d7fec795d|
Guix build for good measure: |
|
My Guix build: $ uname -m && find guix-build-$(git rev-parse --short=12 HEAD)/output/ -type f -print0 | env LC_ALL=C sort -z | xargs -r0 sha256sum
aarch64
52a27582606827acad30bedaeb64d81125e2f069ae97c8fc15b1679bb5463b91 guix-build-2e605da1a653/output/aarch64-linux-gnu/SHA256SUMS.part
3106d8d7abc7704df689bbd4b553d41e39f647af2c74688e620393832cf6d795 guix-build-2e605da1a653/output/aarch64-linux-gnu/bitcoin-2e605da1a653-aarch64-linux-gnu-debug.tar.gz
6b4147e8ba221bcc4f4d3ccdba3e597bc6220edc2db98198113ed2f7193e4153 guix-build-2e605da1a653/output/aarch64-linux-gnu/bitcoin-2e605da1a653-aarch64-linux-gnu.tar.gz
0ff2536a4eccca3a892cdc064f0b82d389add0862ebf5b59d84455bf2c3b10e1 guix-build-2e605da1a653/output/arm-linux-gnueabihf/SHA256SUMS.part
2c44c5e8e03e25243584683ef84e95f63ea623340ec49ae7284dd052cf0fe9a9 guix-build-2e605da1a653/output/arm-linux-gnueabihf/bitcoin-2e605da1a653-arm-linux-gnueabihf-debug.tar.gz
d3450a74ff1bd60a6399c1a4a64fbbe77c2cb7513c1665b6df0152c8957d2e5e guix-build-2e605da1a653/output/arm-linux-gnueabihf/bitcoin-2e605da1a653-arm-linux-gnueabihf.tar.gz
5155416ed81d9b75d8691ccdf5a7e817832b4eb9d2403e819830dd27f195dd1c guix-build-2e605da1a653/output/arm64-apple-darwin/SHA256SUMS.part
9622f3054edb5ef4b055259400ee612aa34d4d0250b19b0e0b00285f6d2967e9 guix-build-2e605da1a653/output/arm64-apple-darwin/bitcoin-2e605da1a653-arm64-apple-darwin-codesigning.tar.gz
52114da05c6355f033b1000c6a34bb8091dcdc97444104f97c101fd304f469d4 guix-build-2e605da1a653/output/arm64-apple-darwin/bitcoin-2e605da1a653-arm64-apple-darwin-unsigned.tar.gz
27e2d133aaf7c62f557f94416557f084f37882a24d9c92ed9527125b6fd44b99 guix-build-2e605da1a653/output/arm64-apple-darwin/bitcoin-2e605da1a653-arm64-apple-darwin-unsigned.zip
3041d76bba1f83000e72f1b5bc35f773bb5ce47b858a71ed6028676f92ad9a24 guix-build-2e605da1a653/output/dist-archive/bitcoin-2e605da1a653.tar.gz
24735eaa4cf8222da930eba23af74b4cac8607cccce4fdf424221468ec4a0b31 guix-build-2e605da1a653/output/powerpc64-linux-gnu/SHA256SUMS.part
2059aeebda7c74eaa85e890a97123b7d7cbf064f9fd923af570051cca686ee0b guix-build-2e605da1a653/output/powerpc64-linux-gnu/bitcoin-2e605da1a653-powerpc64-linux-gnu-debug.tar.gz
04745d8bde8772d274df6cb50dc14471647d296ef5d9873cdb4cc40dc03095c9 guix-build-2e605da1a653/output/powerpc64-linux-gnu/bitcoin-2e605da1a653-powerpc64-linux-gnu.tar.gz
c0500744d4f4619cfdf84af1b45c10e7dbd3d4a2b4d93d614f379241f1f31403 guix-build-2e605da1a653/output/riscv64-linux-gnu/SHA256SUMS.part
7e21b0b07032a2f6e9f7f2e684f8264521bec879f653d54cb3bdb11ac7a95357 guix-build-2e605da1a653/output/riscv64-linux-gnu/bitcoin-2e605da1a653-riscv64-linux-gnu-debug.tar.gz
e14e20b43a11fb04028d252a7f4d09add5bec5a9cd4d4e0caaae4429924dc0b2 guix-build-2e605da1a653/output/riscv64-linux-gnu/bitcoin-2e605da1a653-riscv64-linux-gnu.tar.gz
17d0070b7497a52d0e8148933f3cc69940aaf8c601e07289493241d7ccf224f3 guix-build-2e605da1a653/output/x86_64-apple-darwin/SHA256SUMS.part
dc92119f5929e81cdb14d3fc012baa64b6a6bde154a2ea82755ac83dbd2b9c53 guix-build-2e605da1a653/output/x86_64-apple-darwin/bitcoin-2e605da1a653-x86_64-apple-darwin-codesigning.tar.gz
3a6859dac6131988f9163165b0c6a5b82b09f20532199498924ed7482982def3 guix-build-2e605da1a653/output/x86_64-apple-darwin/bitcoin-2e605da1a653-x86_64-apple-darwin-unsigned.tar.gz
a9019c9d837d6e27593230602e216101db83e1b210edf9ea46063c85cc7c07cd guix-build-2e605da1a653/output/x86_64-apple-darwin/bitcoin-2e605da1a653-x86_64-apple-darwin-unsigned.zip
ba136010df1fc24d5c40ce77b7c2f6b1c6a522f056c0df0a183877e427261be6 guix-build-2e605da1a653/output/x86_64-linux-gnu/SHA256SUMS.part
e2e31b7c3087c009626c4dd90426f290e3add2767348c87e012db224c6a8ac97 guix-build-2e605da1a653/output/x86_64-linux-gnu/bitcoin-2e605da1a653-x86_64-linux-gnu-debug.tar.gz
133cf528ba9923facad4d375b7079e09cd69fd63d7730568a481ce3319b6d818 guix-build-2e605da1a653/output/x86_64-linux-gnu/bitcoin-2e605da1a653-x86_64-linux-gnu.tar.gz
922b967eb4df77bbdd0bb8bf3a14a189686209885ec8d764715925c80af2c935 guix-build-2e605da1a653/output/x86_64-w64-mingw32/SHA256SUMS.part
2aee52621f2f5422b684d355039b5223cb7d92993e4ef0638b61b7e52b593643 guix-build-2e605da1a653/output/x86_64-w64-mingw32/bitcoin-2e605da1a653-win64-codesigning.tar.gz
92a488ad32aaaf8b81d4d59fb47ce3428303cf14029dc9ec0ab4e88a397f98ab guix-build-2e605da1a653/output/x86_64-w64-mingw32/bitcoin-2e605da1a653-win64-debug.zip
aa04ba875eaef202a5dc4b1f50b996a770c8b9e670b3db4ba6214be38afc76a1 guix-build-2e605da1a653/output/x86_64-w64-mingw32/bitcoin-2e605da1a653-win64-setup-unsigned.exe
519357dd2b0103d495da0d7bd7817e6bc286f8de6a9dc78fd372e282a7000a63 guix-build-2e605da1a653/output/x86_64-w64-mingw32/bitcoin-2e605da1a653-win64-unsigned.zip |
I can't quite convince myself that this is correct. How does this hold for a package like I think we do actually want the full Guix environment passed into the ID generation, because it's non-trivial to list all things in the environment that could affect the build, and it seems easier to just pass in the env, rather than try and enumerate them all in the ID generation (although maybe we should add a few more entries/tools there in any case, for general depends usage). |
|
Hmmm, I think I agree that gen_id isn't accounting for enough and, if we try to make it do so, we are just re-inventing a more-brittle Perhaps simpler to go with a more "dumb" method like efbb911 and accept that we may build some parts of depends twice, in the name of reproducibility! |
I tested this scenario by taking this PR, rebasing it on master, and adding a commit to bump the time-machine to guix master (so we have |
Make the pinned repository and commit available to callers that source the Guix prelude. A Bitcoin Core-specific substitute server only needs to build the packages in the guix closure at a specific time machine commit. It does not need to build the bitcoin core binary applications. To facilitate extracting the time-machine commit, export it as a variable, so substitute builders (and anybody else) can re-use it by sourcing the prelude, instead of requiring error-prone command string parsing.
343950c to
35cb557
Compare
|
🚧 At least one of the CI tasks failed. HintsTry to run the tests locally, according to the documentation. However, a CI failure may still
Leave a comment here, if you need help tracking down a confusing failure. |
a3dc9c2 to
d4d09e4
Compare
|
Thank you for the review! Your feedback has been addressed. The first commit is borrowed from #36082, with a minor variable name adjustment to align with |
|
My Guix build: $ uname -m && find guix-build-$(git rev-parse --short=12 HEAD)/output/ -type f -print0 | env LC_ALL=C sort -z | xargs -r0 sha256sum
x86_64
5285c602b94b5345be396fadd8d3791829948e48dd8e44880650c7cb40692828 guix-build-d4d09e4eb066/output/aarch64-linux-gnu/SHA256SUMS.part
14bd26d72ec670e6a428cecf852a64f20e41238ff5a863f8e6167cfd8d38c6e4 guix-build-d4d09e4eb066/output/aarch64-linux-gnu/bitcoin-d4d09e4eb066-aarch64-linux-gnu-debug.tar.gz
0fe1a4f682d627480c13cecbd9176931f0e91f2fee543e981a8a2e1d355469c8 guix-build-d4d09e4eb066/output/aarch64-linux-gnu/bitcoin-d4d09e4eb066-aarch64-linux-gnu.tar.gz
cb8ca5053b80ad6546de1c3dc5956aad75c5236e2b443cf5eee842116fa88ae0 guix-build-d4d09e4eb066/output/arm-linux-gnueabihf/SHA256SUMS.part
b2d81d4ab5c9315e7c344a2052bac92e5e43d24027f2d6102262ea81162d1320 guix-build-d4d09e4eb066/output/arm-linux-gnueabihf/bitcoin-d4d09e4eb066-arm-linux-gnueabihf-debug.tar.gz
c0b1d289e41943491613d2dc84bbbf6b702c14b05883635f161d8980c24e99ab guix-build-d4d09e4eb066/output/arm-linux-gnueabihf/bitcoin-d4d09e4eb066-arm-linux-gnueabihf.tar.gz
8ece66bfa85f7536c7076a8fb38c45acd05d57d2c53c0e875c637c50c1fd124b guix-build-d4d09e4eb066/output/arm64-apple-darwin/SHA256SUMS.part
9eede88713a7065ccf1bfc6080b49796c299ab98e8b7e2746dff7cd0c0f23851 guix-build-d4d09e4eb066/output/arm64-apple-darwin/bitcoin-d4d09e4eb066-arm64-apple-darwin-codesigning.tar.gz
e00b192ada996b3cd5388b4c7c96ef55d13b30cf30cc1a685fe5b0ab6139bd38 guix-build-d4d09e4eb066/output/arm64-apple-darwin/bitcoin-d4d09e4eb066-arm64-apple-darwin-unsigned.tar.gz
efc1ecd020e44e43f914d53073adac46dc0791f05999f5cdb1f7b941012a7b16 guix-build-d4d09e4eb066/output/arm64-apple-darwin/bitcoin-d4d09e4eb066-arm64-apple-darwin-unsigned.zip
b7427962340e4daaf49b6a789e5261e653b506faea5e56de16f2865961fe93d0 guix-build-d4d09e4eb066/output/dist-archive/bitcoin-d4d09e4eb066.tar.gz
f228cc665149e6a3cb090f8d0a348d72f71b405d269ad4958efee892c822769d guix-build-d4d09e4eb066/output/powerpc64-linux-gnu/SHA256SUMS.part
be648d4167d726e1496ef9b78beedf457f41d06072c9e9903350d8e4f8b77c52 guix-build-d4d09e4eb066/output/powerpc64-linux-gnu/bitcoin-d4d09e4eb066-powerpc64-linux-gnu-debug.tar.gz
7a9b5a69305de6abdabd7efe889bf26c3c1218a96f751f02567e6dcb7aca692c guix-build-d4d09e4eb066/output/powerpc64-linux-gnu/bitcoin-d4d09e4eb066-powerpc64-linux-gnu.tar.gz
67f2b632e36b097f2c28b21d3b27c8e32838c1bb202b3013e0d7ded1dae0f8be guix-build-d4d09e4eb066/output/riscv64-linux-gnu/SHA256SUMS.part
b2a8a65783d61a1e96169f4e1e03cdafd1bf3be634e0298d2df5774873e44076 guix-build-d4d09e4eb066/output/riscv64-linux-gnu/bitcoin-d4d09e4eb066-riscv64-linux-gnu-debug.tar.gz
c294bad4acfc424a02822e707addd5910fe052190b16053440b93f81c27bc60c guix-build-d4d09e4eb066/output/riscv64-linux-gnu/bitcoin-d4d09e4eb066-riscv64-linux-gnu.tar.gz
d5426b70e231098b61f8ec29c1bbac095ce9b3b4377fb7c5b1543c93c705b976 guix-build-d4d09e4eb066/output/x86_64-apple-darwin/SHA256SUMS.part
8bbd7e613506791526a16a4100c0b3eb0075c810f0e5b0031fe2887615bd5a9b guix-build-d4d09e4eb066/output/x86_64-apple-darwin/bitcoin-d4d09e4eb066-x86_64-apple-darwin-codesigning.tar.gz
6f9de0bcf9a556048606095c8b25ef18c2bf0c9d0082163ee22549c9f9ec71b4 guix-build-d4d09e4eb066/output/x86_64-apple-darwin/bitcoin-d4d09e4eb066-x86_64-apple-darwin-unsigned.tar.gz
c75a9d0739f78a78b1ceba5e66810e306ff830d005927002166adef64cd2a31e guix-build-d4d09e4eb066/output/x86_64-apple-darwin/bitcoin-d4d09e4eb066-x86_64-apple-darwin-unsigned.zip
f21fe3c65423fca8e7cd8c2761497f812c3fa3ec8070db022fdd86b1fdf19543 guix-build-d4d09e4eb066/output/x86_64-linux-gnu/SHA256SUMS.part
d8ee0cd3c75e2d6c52403cc991fe92153e57b2f5f47a760b79496453b701b1e1 guix-build-d4d09e4eb066/output/x86_64-linux-gnu/bitcoin-d4d09e4eb066-x86_64-linux-gnu-debug.tar.gz
f73d907d32047b419e8047b0864998d58c5ba63411d7a135fcae95527c589d98 guix-build-d4d09e4eb066/output/x86_64-linux-gnu/bitcoin-d4d09e4eb066-x86_64-linux-gnu.tar.gz
6470d60aa6ce3514792844a99c7c9ff65f4d978c4d704e538a4a7afd3ff509f5 guix-build-d4d09e4eb066/output/x86_64-w64-mingw32/SHA256SUMS.part
353f540032c43d46805d19986063dc6c03007b59650e8cafca8a477e6625a2e2 guix-build-d4d09e4eb066/output/x86_64-w64-mingw32/bitcoin-d4d09e4eb066-win64-codesigning.tar.gz
fb54fdf39460f2e173882837b8c2685d46295e594edf469d69fad70b315d60eb guix-build-d4d09e4eb066/output/x86_64-w64-mingw32/bitcoin-d4d09e4eb066-win64-debug.zip
4fd38c4056c6f275e1d4a4ffe543d99745461103317012838cf0b5f6c33ec713 guix-build-d4d09e4eb066/output/x86_64-w64-mingw32/bitcoin-d4d09e4eb066-win64-setup-unsigned.exe
a158ac076e029030fde0d62eac9d1298711f7616965912b5fd5f5c960fb7d62e guix-build-d4d09e4eb066/output/x86_64-w64-mingw32/bitcoin-d4d09e4eb066-win64-unsigned.zip |
|
I think I agree that this would be a better approach than the new changes here, which also seems fragile (i.e they introduce a list of files that we'd need to remember to manually update, if there's any (relevant) change in the Note also the PR description / commit message don't seem to have been updated for the current changes, because they still state that "verbose compiler output" would be a viable replacement for |
Happy to close this PR in favour of an alternative approach, once someone opens one.
The file list only names two files, and it shouldn't need updating often. |
GUIX_ENVIRONMENT from gen_id calculationsGUIX_ENVIRONMENT from gen_id calculations
Since commit 008a3e2 ("guix: split builds into Linux(gui) and macOS/Windows"), each host is built in two containers: one instantiated from `manifest_build.scm` and the other from the union of `manifest_build.scm` and `manifest_gui.scm`. The resulting Guix profiles necessarily differ, and because `$(realpath $(GUIX_ENVIRONMENT))` is hashed into every depends package id, the built-package cache is invalidated whenever the profile changes: 1. Depends are rebuilt when switching to another branch with identical Guix scripts and the depends subdirectory. 2. Non-GUI packages are built twice per host, as the GUI container cannot reuse the packages just cached by the base container (this is mostly relevant for non-Linux hosts, as we move towards static builds on Linux). Drop `GUIX_ENVIRONMENT` from the `gen_id` inputs, and salt the depends ids in `guix-build` with the inputs that define the containers instead: the pinned time-machine commit, the contents of `manifest_build.scm`, `manifest_gui.scm` and of every patch in `contrib/guix/patches`, and the user-supplied `ADDITIONAL_GUIX_*_FLAGS`. Unlike the profile path, this salt is identical for both containers of a given host, so the GUI container reuses the packages built by the base container, and it stays stable across branches whose Guix and depends inputs are unchanged, while any change to the pinned Guix revision, to the manifests, or to the patches still invalidates the cache.
d4d09e4 to
5d8f540
Compare
Thanks! Reworked. |
|
|
I opened #36209 as a possible alternative to the approach here. |
Closing this PR in favour of #36209. |
1fe87c2 guix: cache GUI depends separately (will) Pull request description: Alternative to #35929 The GUI and non-GUI Guix profiles produce different depends build IDs. However, depends deletes the existing per-package cache directory when storing a new build. Sharing a cache root therefore causes each profile to evict the other's packages, forcing rebuilds on subsequent runs. This PR keeps these packages in separate `GUIX/BUILD` and `GUIX/GUI` directories under the cache root. This also keeps them separate from ordinary developer builds when BASE_CACHE is being used there. #35929 replaces `GUIX_ENVIRONMENT` in package ID generation with a hash of selected Guix inputs. Its current implementation covers the manifests, patches, pinned Guix revision and additional flags, but that list needs to stay aligned with how we construct the environment and may therefore be brittle to future changes. In this version I prefer keeping the resolved environment in the cache key and simply keeping the caches separate. #### Tradeoffs vs #35929 This PR means building and storing some dependencies twice, which I consider a reasonable cost for simpler cache tracking/invalidation. This is likely going to be the case for Linux anyway i.e after a change like #36193 or #25573. ACKs for top commit: achow101: ACK 1fe87c2 hebasto: ACK 1fe87c2, tested on Ubuntu 26.04 by doing several consecutive Guix builds interleaved with branch switches and observing the cache behavior. sedited: ACK 1fe87c2 Tree-SHA512: 33d8926fd8cc81338dd2d2c389a0ae9388256da5b1fdebabf05308f057535d1240d6e8bc0fc30a11a80cd3677c39067b0a5c3cc87272d162d8dbe727d8e1cc7c
This PR fixes a performance regression noticed during the review of #35537.
Since commit 008a3e2 ("guix: split builds into Linux(gui) and macOS/Windows"), each host is built in two containers: one instantiated from
manifest_build.scmand the other from the union ofmanifest_build.scmandmanifest_gui.scm. The resulting Guix profiles necessarily differ, and because$(realpath $(GUIX_ENVIRONMENT))is hashed into every depends package id, the built-package cache is invalidated whenever the profile changes:Depends are rebuilt when switching to another branch with identical Guix scripts and the depends subdirectory.
All non-GUI packages are built twice per host, as the GUI container cannot reuse the packages just cached by the base container (this is mostly relevant for non-Linux hosts, as we move towards static builds on Linux).
Drop
GUIX_ENVIRONMENTfrom thegen_idinputs, and salt the depends ids inguix-buildwith the inputs that define the containers instead: the pinned time-machine commit, the contents ofmanifest_build.scm,manifest_gui.scmand of every patch incontrib/guix/patches, and the user-suppliedADDITIONAL_GUIX_*_FLAGS.Unlike the profile path, this salt is identical for both containers of a given host, so the GUI container reuses the packages built by the base container, and it stays stable across branches whose Guix and depends inputs are unchanged, while any change to the pinned Guix revision, to the manifests, or to the patches still invalidates the cache.
Related: #34228.