#36106 bitcoin wrapper: respect CMAKE_INSTALL_BINDIR/LIBEXECDIR
https://github.com/bitcoin/bitcoin/pull/36106 · · +113/-6 in 6 files, 2 commits · labels: none
Goal
- Allow distributions with custom install paths to run the bitcoin wrapper without execution errors
- Fixes broken binary discovery when launching components on systems like Arch Linux
Threads CMAKE_INSTALL_BINDIR and CMAKE_INSTALL_LIBEXECDIR through bitcoin-build-config.h into the bitcoin wrapper (src/bitcoin.cpp). Replaces hardcoded 'bin' and 'libexec' directory lookups with configured build-time paths and adds configure-time validation checks and functional tests for installed directory layouts.
Problem: On distributions such as Arch Linux that set CMAKE_INSTALL_LIBEXECDIR to 'lib', the installed bitcoin wrapper command cannot find internal executables like bitcoind or bitcoin-node, failing immediately with execvp 'No such file or directory'.
Category: Build and CI (#20 of 55)
P3 · platform fix
- P3 because it fixes packaging configuration for distributions that override standard install paths
- Packaging maintainers get functioning installations without manual path workarounds
Fixes installation layout on distributions like Arch Linux that set CMAKE_INSTALL_LIBEXECDIR=lib. While standard builds are unaffected, package maintainers and users on downstream distributions benefit directly.
Membership: Modifies CMakeLists.txt and cmake/bitcoin-build-config.h.in to configure and validate install directory variables.
Factors: security/stability 0, bug 2, performance 0, user value 1, leverage 1
Category: Tools and scripts (#3 of 22)
P3 · bug fix
- P3 because it resolves a complete failure of the wrapper executable on affected distributions
- Users on distributions like Arch Linux can invoke wrapper subcommands reliably
Fixes a bug where the bitcoin command fails completely when trying to dispatch to underlying binaries on non-default directory installations.
Membership: Modifies the bitcoin wrapper executable in src/bitcoin.cpp and adds test coverage in test/functional/tool_bitcoin.py.
Factors: security/stability 0, bug 2, performance 0, user value 2, leverage 0
Category: IPC / multiprocess (#17 of 20)
P3 · bug fix
- P3 because the multiprocess wrapper can locate and dispatch to sub-processes in custom layouts
- Prevents execution failures when launching node processes under non-default directory trees
Ensures that multiprocess subcommands like 'bitcoin -m node' can locate and spawn the separated node executable when installed on diverse distro layouts.
Membership: Changes src/bitcoin.cpp which serves as the launcher for process separation (bitcoin -m node, bitcoin-node).
Factors: security/stability 0, bug 1, performance 0, user value 1, leverage 0
Reviewability: Ready
- Ready to review
- Code is clean, test suite issues are resolved, and CI is passing
The PR has clean mergeability, green CI, and the author addressed all reviewer feedback in the latest update.
Author status: Active; resolved all reviewer points and pushed fixes on 2026-09-10.
Resolved concerns:
- hebasto noted that empty CMake install dir variables should be caught early at configure time rather than compile time only; author added CMake FATAL_ERROR checks.
- hebasto observed the test failed when CMAKE_INSTALL_BINDIR was customized; author updated test configuration and passed BINDIR to the test runner.
- cyb3ralbert caught a valgrind test regression caused by clearing PATH in the wrapper subprocess; author resolved valgrind via shutil.which before blanking PATH.
Agreement: Strong
- Strong support across reviewers with all prior feedback addressed
- Approach approved after testing with custom install prefixes (hebasto)
- Verified by testing on Arch Linux directory layouts (cyb3ralbert)
Strong: Approach ACK from hebasto, positive manual testing from cyb3ralbert, and all feedback addressed.
Hebasto gave an Approach ACK, cyb3ralbert tested and verified the fix, and all concerns raised regarding configure checks and test behavior were resolved.
- hebasto gave Concept ACK and Approach ACK on 2026-09-01
- cyb3ralbert verified the fix against the Arch Linux scenario in issue #35785 on 2026-09-02
- ryanofsky addressed all suggestions in pushes on 2026-09-09 and 2026-09-10
Objections:
| Reviewer | Kind | Harm | Status | Blocking | Author replied | Quote |
|---|---|---|---|---|---|---|
| hebasto | correctness | Test failed when user specified a custom CMAKE_INSTALL_BINDIR. | resolved | no | yes | 2026-09-01: 'The new test fails when the user specifies CMAKE_INSTALL_BINDIR' Settled: 2026-09-09: 'Good catch, fixed by passing CMAKE_INSTALL_BINDIR to the test now.' |
| hebasto | approach | Empty or unset install variables were not caught early at configure time. | resolved | no | yes | 2026-09-01: 'Shouldn't the check for unset or empty CMake variables be performed earlier, at the configuration stage?' Settled: 2026-09-09: 'added some cmake checks for empty values.' |
| cyb3ralbert | correctness | Test suite fails under --valgrind because PATH is blanked before valgrind binary is located. | resolved | no | yes | 2026-09-10: 'The last push did introduce one regression, though: tool_bitcoin.py fails under --valgrind.' Settled: 2026-09-10: 'Updated ... with another fix for valgrind' |
Support:
- hebasto: Approach ACK and verified install layout behavior with cmake --install prefix.
- cyb3ralbert: Verified fix on Arch Linux layout reproducing #35785 and verified subsequent iterations.
Participants: purpleKarrot (neutral), hebasto (support), cyb3ralbert (support)
State derived from the lists: substantive support, no open objection (hebasto, cyb3ralbert)
Review verdicts (DrahtBot): 0
- Approach ACK: hebasto
Files
71 lines under test/bench/ci.
- test/functional/tool_bitcoin.py +69/-0
- src/bitcoin.cpp +18/-5
- CMakeLists.txt +14/-0
- cmake/bitcoin-build-config.h.in +10/-0
- test/config.ini.in +2/-0
- cmake/module/InstallBinaryComponent.cmake +0/-1
Card
PR 36106 fixes an issue where the bitcoin wrapper cannot execute underlying binaries like bitcoind or bitcoin-node on distributions with non-default install directories such as Arch Linux (issue #35785). It replaces hardcoded 'bin' and 'libexec' directory paths in src/bitcoin.cpp with build-time values from CMAKE_INSTALL_BINDIR and CMAKE_INSTALL_LIBEXECDIR, accompanied by configure-time sanity checks and functional test coverage. Review has been constructive, with an Approach ACK from hebasto and extensive testing from cyb3ralbert, and all requested test and build adjustments have been incorporated.