Repository navigation
backport: bitcoin#31008, #31171, #31358, #31857, #31849, #31360, #32798, #32943, partial #31276 (depends toolchain follow-ups) - #8179
Conversation
… for CMake invocation 605926d depends: Print ready-to-use `--toolchain` option for CMake invocation (Hennadii Stepanov) Pull request description: Requested in bitcoin#30997 (comment): > P.S. it would be nice if `make` in `depends` provides the incantation needed for the configure stage. An example of a build log with this PR: ``` $ make --no-print-directory -C depends -j16 NO_QT=1 NO_WALLET=1 NO_UPNP=1 NO_NATPMP=1 NO_ZMQ=1 NO_USDT=1 LOG=1 Extracting boost... /home/hebasto/git/bitcoin/depends/sources/boost_1_81_0.tar.gz: OK Preprocessing boost... Configuring boost... Building boost... Staging boost... Postprocessing boost... Caching boost... Extracting libevent... /home/hebasto/git/bitcoin/depends/sources/libevent-2.1.12-stable.tar.gz: OK Preprocessing libevent... Configuring libevent... Building libevent... Staging libevent... Postprocessing libevent... Caching libevent... copying packages: boost libevent to: /home/hebasto/git/bitcoin/depends/x86_64-pc-linux-gnu To build Bitcoin Core with these packages, pass '--toolchain /home/hebasto/git/bitcoin/depends/x86_64-pc-linux-gnu/toolchain.cmake' to the first CMake invocation. ``` ACKs for top commit: Sjors: tACK 605926d theuni: ACK 605926d jarolrod: ACK 605926d pablomartin4btc: ACK 605926d Tree-SHA512: 658358cb12a2409486962273d418f8cfa9609c84c6e70b426250173925c0938a6eba0dca72f43d78cc63c9cb927514c959473da04bdcda714228c5d8c248c1fe (cherry picked from commit caf44e5)
e2ba823 depends: Specify CMake generator explicitly (Hennadii Stepanov) Pull request description: Building packages in depends implies using GNU Make. However, this assumption can be wrong in environments where the [`CMAKE_GENERATOR`](https://cmake.org/cmake/help/latest/envvar/CMAKE_GENERATOR.html) variable is set. This change explicitly makes CMake use the "Unix Makefiles" generator. Can be tested as follows: ``` $ env CMAKE_GENERATOR=Ninja make -C depends ``` ACKs for top commit: fanquake: ACK e2ba823 - Going forward I think we should look at making this work without having to hard code anything. Tree-SHA512: e14ed1cec192434fe089d36a83e1e150727a3b299fada80a61fa5b44b0c50e014a774ef1e6cd6df189e25f7a13042a20d4f9605f6ccd32e7782f10adaf5e788f (cherry picked from commit 3a5f602)
bcd82b1 Remove pkgconfig from toolchain file (TheCharlatan) 319a4e8 depends: drop sqlite pkgconfig file (fanquake) a8fe1fd depends: better cleanup after fontconfig (fanquake) 17e79c9 depends: fully remove libtool archives from Qt build (fanquake) 8ca8565 guix: move pkg-config to Linux builds (fanquake) e3e648c depends: drop pkg-config option from Qt build (fanquake) 0d185bd doc: update depends doc to prefer .cmake outputs (fanquake) Pull request description: After bitcoin#31181, `pkg-config` is no-longer needed for macOS or Windows Guix builds. It's still needed for Linux, as it's used by a Qt subdependency (fontconfig to find freetype). However we should also no-longer need it for Qt itself, when building using depends. ACKs for top commit: TheCharlatan: ACK bcd82b1 Tree-SHA512: 89ae68281030d43fcb6c5c96429cd038a21f13a8ca19ea828ada47e8f9f0aa7407854a67c9003652817e47ab9565573b7028342e3e11bb1cca1d823c483081cd (cherry picked from commit ab22726) Dash keeps the toolchain's pkg-config setup, pkg-config in the Guix manifest for every host, and the depends/packages.md guidance on .pc outputs. Upstream dropped them once bitcoin#31181 (FindLibevent revamp) had moved its depends builds off pkg-config. Dash still finds libevent, ZeroMQ, zstd, qrencode, miniupnpc and dash_sdk_cxx through pkg-config, so only the Qt, fontconfig and sqlite parts are taken.
…hain file d9c8aac depends, refactor: Avoid hardcoding `host_prefix` in toolchain file (Hennadii Stepanov) Pull request description: This PR allows the entire `depends/<host_prefix>` directory to be relocatable. Only `libevent` package configuration files are non-relocatable for the version `2.1.12-stable` we use now. However, this issue has been fixed upstream in libevent/libevent@1f1593f and friends. Fixes bitcoin#31050. ACKs for top commit: theuni: Neat. utACK d9c8aac ryanofsky: Code review ACK d9c8aac Tree-SHA512: c4c340722e63fc1da36fba2b15f025a6e1d477da1991194d678f546f2f3ea9454e2f0ff054aae6ae6c332a0781a597c3ce63b9018b46b8c258033f0d19efbef3 (cherry picked from commit 2aa7be1)
2434aea depends: avoid an unset CMAKE_OBJDUMP (fanquake) Pull request description: Similar to bitcoin#31840, currently our Linux toolchain file contains: ```bash set(CMAKE_AR "aarch64-linux-gnu-ar") set(CMAKE_RANLIB "aarch64-linux-gnu-ranlib") set(CMAKE_STRIP "aarch64-linux-gnu-strip") set(CMAKE_OBJCOPY "aarch64-linux-gnu-objcopy") set(CMAKE_OBJDUMP "") ``` `objdump` is currently only used for the macOS cross build, where it's `llvm-objdump`, but we should be consistent in producing a toolchain file that points to actual tools, rather than leaving variables unset. ACKs for top commit: hebasto: ACK 2434aea. theuni: utACK 2434aea Tree-SHA512: 65f6b7b9cae79e9c0784c108709139125e52d8f2818afbea5f719bc1b6dc338b870abbdfcb174ae541c0027a7ac07cb56012735b7a37b58b9a6e55a48c0257cf (cherry picked from commit 109bfe9)
9633550 depends: set CMAKE_*_COMPILER_TARGET in toolchain (fanquake) Pull request description: According to the CMake docs, this is the correct way to setup a toolchain file for cross-compilation using Clang. See https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling-using-clang Internally it looks like CMake will only take this variable into account if it detects the compiler to be Clang, so this shouldn't effect other builds, but in the case of our Apple cross builds, we'd end up with a duplicated `--target=$ARCH-apple-darwin` on the compiler line, given we are already setting `--target` for Darwin builds. Would fix bitcoin#31748. ACKs for top commit: hebasto: ACK 9633550, tested on Ubuntu 24.10. Tree-SHA512: 1aa0c5d9cb069ce277e53b5551baf5249c449331b0a160edb9a8ceb56209f886a9e2051e2ba63e0874904f652ace0280b7483dd5d81bfff9e993eb18abb961ad (cherry picked from commit e563cb5)
…in file 7343a18 depends: Avoid using helper variables in toolchain file (Hennadii Stepanov) Pull request description: Using helper variables has two issues: 1. They contaminate the global namespace of the main build script. 2. They can be used as `set(var)`, effectively [exposing](https://cmake.org/cmake/help/latest/command/set.html) a cache variable `var`, which makes the toolchain file susceptible to the build environment. The [`depends/Makefile`](https://github.com/bitcoin/bitcoin/blob/master/depends/Makefile) can generate values with "not-set" semantics as empty strings or strings containing only spaces. For example:https://github.com/bitcoin/bitcoin/blob/2638fdb4f934be96b7c798dbac38ea5ab8a6374a/depends/Makefile#L157 Therefore, [`MATCHES`](https://cmake.org/cmake/help/latest/command/if.html#matches) must be used rather than [`STREQUAL`](https://cmake.org/cmake/help/latest/command/if.html#strequal). ACKs for top commit: purpleKarrot: ACK 7343a18 Tree-SHA512: f2235321ac13daee8e82fa1ae9d02b95097a696265ad3a31fbda9cbc3c387c1dc7d01951154f99828468e50b73ed2889a6fa2720007f519dd11fe25ee5303d23 (cherry picked from commit b070ce1)
…chain e27a945 build: add root dir to CMAKE_PREFIX_PATH (will) Pull request description: Fixes: bitcoin#32428 Nix patches `cmake` to remove the root directory `/` from `CMAKE_PREFIX_PATH`: https://github.com/NixOS/nixpkgs/blob/428b49b28ebc8938a6d9f6c540d32d7a06713972/pkgs/by-name/cm/cmake/001-search-path.diff#L10 Without this, and when using the toolchain for depends builds, cmake's `find_path()` and `find_package()` do not know where to find dependencies, causing issues like as seen in bitcoin#32428 Adding this path back is harmless on other systems, and fixes the toolchain for Nix users. As described in bitcoin#32428 (comment) I think this can be taken as a temporary fix whilst a longer-term solution is worked on. ACKs for top commit: josibake: reACK bitcoin@e27a945 hebasto: ACK e27a945, I have reviewed the code and it looks OK. janb84: reACK e27a945 Tree-SHA512: f299f2bab2620179518da866cbb7992d41d142ad42e79c14496e72f725a1dc60698b3e4b1daf45d28f71f32a23f0c8d7b4f6c6cf33aeedf322b7ef565b70b4af (cherry picked from commit 7d5a6d1)
…=TRUE` 44f3bae depends: Force `CMAKE_EXPORT_NO_PACKAGE_REGISTRY=TRUE` (Hennadii Stepanov) Pull request description: When using CMake policies 3.14 and below, the `export(PACKAGE)` command by default populates the user package registry, which is stored outside the build tree. Setting the `CMAKE_EXPORT_NO_PACKAGE_REGISTRY` variable disables this side effect. In CMake 3.15 and later, this behavior is disabled by default, and the variable has no effect. This PR forces `CMAKE_EXPORT_NO_PACKAGE_REGISTRY=TRUE` globally, rather than managing it for each dependency package individually rather. It may be reverted once all CMake-based packages have updated to policies 3.15 or newer. Fixes bitcoin#32938. ACKs for top commit: fanquake: ACK 44f3bae Tree-SHA512: 0aac398b7182e80185b064d59f81aece4d8477a609fad9cc3fee317da2aff43b66ef7db1efec0135b4f0feaad23b1db664e33bd035fe659712c5b2a9bf2d6fb6 (cherry picked from commit e72cb20)
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 27 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
⛔ Final review complete — 1 blocking finding(s) (commit 1ee9847) · triage: normal |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 1 + Phase 2
The depends changes correctly implement the stated generator, compiler-target, package-registry, and toolchain-path fixes, but relocation remains incomplete for Dash. FindLibevent still consumes libevent.pc through pkg-config, and the staged metadata embeds the original absolute install prefix, so moving the depends directory can make configuration or linking use the old path. The CI snapshot also contains a failed linux64_asan-build source check whose log was unavailable while the workflow was still reported in progress; it cannot be attributed to this depends-only diff.
🔴 1 blocking
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: backport-reviewer); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: dash-core-commit-history); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: backport-reviewer); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: dash-core-commit-history); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.1-sol(effort low) — This is a multi-file depends and CMake toolchain change affecting cross-platform build configuration and package discovery, but it does not modify consensus, funds, cryptography, networking serialization, or storage migration code. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Second Phase-2 pass: on this first full review every Phase-2 reviewer also ran a second, independent time, and the verifier weighed both sets
- Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— backport-reviewer (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— dash-core-commit-history (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— backport-reviewer (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— dash-core-commit-history (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `depends/toolchain.cmake.in`:
- [BLOCKING] depends/toolchain.cmake.in:88-92: Relocated depends prefixes still use the old libevent path
Changing CMAKE_FIND_ROOT_PATH to CMAKE_CURRENT_LIST_DIR makes CMake and PKG_CONFIG_PATH search the moved prefix, but Dash's FindLibevent.cmake still calls pkg_check_modules() and creates the imported libevent target from pkg-config metadata. The current depends/packages/libevent.mk leaves the generated libevent.pc files installed, and depends/funcs.mk configures CMake with the absolute depends prefix as CMAKE_INSTALL_PREFIX. Consequently, after the prefix is moved, pkg-config finds the new libevent.pc but its libdir resolves to the original build-time path, so configuration or linking can fail or use libraries from the old location. The relocation fix therefore does not work for the normal Dash dependency configuration. Complete the dependency-discovery migration and remove this pkg-config dependency, or make the libevent metadata relocation-safe as part of the relocation change.
| set(CMAKE_FIND_ROOT_PATH "${CMAKE_CURRENT_LIST_DIR}") | ||
| set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) | ||
| set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) | ||
| set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) | ||
| set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) |
There was a problem hiding this comment.
🔴 Blocking: Relocated depends prefixes still use the old libevent path
Changing CMAKE_FIND_ROOT_PATH to CMAKE_CURRENT_LIST_DIR makes CMake and PKG_CONFIG_PATH search the moved prefix, but Dash's FindLibevent.cmake still calls pkg_check_modules() and creates the imported libevent target from pkg-config metadata. The current depends/packages/libevent.mk leaves the generated libevent.pc files installed, and depends/funcs.mk configures CMake with the absolute depends prefix as CMAKE_INSTALL_PREFIX. Consequently, after the prefix is moved, pkg-config finds the new libevent.pc but its libdir resolves to the original build-time path, so configuration or linking can fail or use libraries from the old location. The relocation fix therefore does not work for the normal Dash dependency configuration. Complete the dependency-discovery migration and remove this pkg-config dependency, or make the libevent metadata relocation-safe as part of the relocation change.
source: gpt-6.1-sol (phase2-reviewer: general)
Issue being fixed or feature implemented
After the CMake switch in #7481, depends and its generated
toolchain.cmakestill lack several fixes that upstream made right after its own switch:depends/<host>path, so a depends prefix can't be moved or reused from another location;qt_packages,zmq_packages, ...) in the main project's scope, and treats a value of only spaces as "set";CMAKE_GENERATORfrom the environment (soCMAKE_GENERATOR=Ninja make -C dependsbreaks), and older CMake-based packages can write to the user's package registry outside the build tree;CMAKE_OBJDUMPis empty for the default host tools; clang cross builds don't getCMAKE_*_COMPILER_TARGET; Nix's CMake can't find anything through the toolchain;-pkg-configand installs.pc/.lafiles nothing uses.What was done?
Backports, one commit each, in upstream merge order:
--toolchainoption for CMake invocation bitcoin/bitcoin#31008 depends: Print ready-to-use--toolchainoption for CMake invocation (message says "Dash Core")-no-pkg-config,fix_qt_pkgconfig.patchremoved, Qtlib/pkgconfigandQt5*.laand sqlitelib/pkgconfigremoved after staging, fontconfig'sbin etc shareremoved. Not taken: removal of the pkg-config block fromtoolchain.cmake.in, movingpkg-configto Linux-only in the Guix manifest, and thedepends/packages.mdwording that packages should not output.pcfiles. Upstream could drop those after cmake: RevampFindLibeventmodule bitcoin/bitcoin#31181 moved its depends lookups off pkg-config; Dash still finds libevent, ZeroMQ, zstd, qrencode, miniupnpc anddash_sdk_cxxthrough pkg-config on every host.host_prefixin toolchain file bitcoin/bitcoin#31358 depends: Avoid hardcodinghost_prefixin toolchain fileCMAKE_OBJDUMPbitcoin/bitcoin#31857 depends: avoid an unsetCMAKE_OBJDUMPCMAKE_*_COMPILER_TARGETin toolchain bitcoin/bitcoin#31849 depends: setCMAKE_*_COMPILER_TARGETin toolchainMATCHES "^[ ]*$"is also applied to the Dash-onlyzstd,bdb,sqlite,upnpandnatpmpblocks. Upstream's context lineset(Qt6_ROOT ...)is from the Qt 6 migration and is not part of this PR.CMAKE_EXPORT_NO_PACKAGE_REGISTRY=TRUEbitcoin/bitcoin#32943 depends: ForceCMAKE_EXPORT_NO_PACKAGE_REGISTRY=TRUEbitcoin#31627 (depends: Fix spacing issue) was already backported in #6918, so it is not repeated here.
The changes stay inside
depends/and do not touchCMakeLists.txtorcmake/module/*.How Has This Been Tested?
make -C depends -j20forx86_64-pc-linux-gnuwith Qt (every package rebuilt because of the new build ids). Qt's configure reportsUsing pkg-config ... nowith FreeType, Fontconfig, xkbcommon and XCB all found. The Qt.prllink interfaces list the same libraries as before; only the redundant-Lentries that came from pkg-config are gone.toolchain.cmake: no@...@placeholders left,CMAKE_FIND_ROOT_PATHandQT_TRANSLATIONS_DIRuse${CMAKE_CURRENT_LIST_DIR},CMAKE_OBJDUMPis set. Acmake -Pcheck confirmedMATCHES "^[ ]*$"treats empty and spaces-only values as unset and package lists as set.make -C depends print-libevent_cmakeshows-G "Unix Makefiles"and-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY:BOOL=TRUE.cmake -B build -G Ninja --toolchain depends/x86_64-pc-linux-gnu/toolchain.cmake -DWERROR=ON -DBUILD_GUI=ON -DBUILD_BENCH=ON: every optional feature that depends provides (wallet with SQLite and BDB, NAT-PMP, UPnP, ZeroMQ, zstd, USDT, QR codes, DBus) was detected.cmake --build build -j14succeeded.QT_QPA_PLATFORM=minimal ctest --test-dir build -j14: 185/185 passed, includingtest_bitcoin-qtand the bench sanity checks.Breaking Changes
None. Changes to
depends/funcs.mkand the Qt, fontconfig and sqlite recipes change build ids, so depends packages rebuild once.Checklist:
🤖 Generated with Claude Code