e07224f2d5 depends: fix IPC listeners on macOS dying when accepting a dead socket (xyzconstant)
Pull request description:
This PR adds a depends patch to fix a Cap'n Proto bug present in macOS that throws the following exception after accepting a disconnected client:
```
mp/proxy.cpp:48: error: Uncaught exception in daemonized task.; exception = kj/async-io-unix.c++:1365: failed: setsocketopt(IPPROTO_TCP, TCP_NODELAY): Invalid argument
```
This goes uncaught killing `libmultiprocess`'s accept loop (`mp::ListenConnections()`) in the process.
### Root cause
After `accept()`, kj unconditionally calls `setsockopt(TCP_NODELAY)` on the connection socket. For Unix sockets, kj handles the usual "not supported" error codes, however, on macOS EINVAL is returned when the client has already disconnected and kj only tolerates that code when built for FreeBSD. The unexpected error then goes uncaught in the accept loop, causing the listener to stop accepting new connections.
See https://github.com/bitcoin-core/libmultiprocess/issues/319 for more details and instructions on how to reproduce it in Bitcoin Core using socat.
### Fix
The patch is based on the EINVAL handling from capnproto/capnproto@7df5bd078, which is only available on the not yet released v2 branch. It's applied to `capnp.mk` as a temporary workaround until capnproto/capnproto#2748 is available in a v1 release.
ACKs for top commit:
hebasto:
ACK e07224f2d5, I have reviewed the code and it looks OK.
ryanofsky:
Code review ACK e07224f2d5. Confirmed patch matches what was committed upstream (85d8e47fcb).
Tree-SHA512: 7d3b3dd6cabdc658971e0f20159ad36594759b3686d2e5dc74fb21900ccec0c637980e36fa71fbd808c642ce83f89c73f5bc788eb42644bceed67acb78e8eee5
7e973cce52 depends: Make tarball creation from local directory reproducible (Hennadii Stepanov)
Pull request description:
This guarantees `$(package)_sha256_hash` reproducibility regardless of the default behavior of `$(build_TAR)` and fixes [caching](https://github.com/bitcoin/bitcoin/pull/36006#issuecomment-5328809116) for the `native_libmultiprocess` package.
Steps to reproduce the issue using the master branch @ 2a9e35d293:
```console
$ mkdir a && cd a && git init
$ git remote add origin https://github.com/bitcoin/bitcoin.git
$ git fetch --depth 1 origin 2a9e35d293
$ git checkout FETCH_HEAD
$ cd depends
$ gmake print-native_libmultiprocess_sha256_hash # Hash A. Compare with Hash B.
native_libmultiprocess_sha256_hash=7dd817bfc0ee23c408299907aff13fefb0bd3a54ec66dc14ea15b0cc38c3d9ce
$ cd ../../ && sleep 2
$ mkdir b && cd b && git init
$ git remote add origin https://github.com/bitcoin/bitcoin.git
$ git fetch --depth 1 origin 2a9e35d293
$ git checkout FETCH_HEAD
$ cd depends
$ gmake print-native_libmultiprocess_sha256_hash # Hash B. Compare with Hash A.
native_libmultiprocess_sha256_hash=34d6f79560c0ff7a4f46bd6bfb4693076546b41f071b6dbf879da45ac8384688
```
ACKs for top commit:
fanquake:
ACK 7e973cce52
willcl-ark:
ACK 7e973cce52
Tree-SHA512: f939cd1b2aca04eaa0f8426858bae3657ee9625f915834980caacfbf80843b952451f4d1c29e27179e533de3e10d31688593e4c25ed32e62392bfbaf9e58dd12
ec61a1af62 depends: Hash included makefiles in package checksums (Hennadii Stepanov)
Pull request description:
This PR fixes an issue where modifications in included files (e.g. `packages/qt_details.mk`) do not trigger a rebuild of the parent packages (`native_qt` and `qt`).
This addresses an oversight in 248613eb3e from https://github.com/bitcoin/bitcoin/pull/30997.
### Reproduction
On master (@ 595504a432), modifying the included makefile does not change the build ID:
```
$ cd depends
$ gmake print-qt_build_id HOST=x86_64-w64-mingw32
qt_build_id=b2ce790473c
$ gmake print-native_qt_build_id HOST=x86_64-w64-mingw32
native_qt_build_id=70e1e5164c5
$ echo "" >> packages/qt_details.mk
$ gmake print-qt_build_id HOST=x86_64-w64-mingw32
qt_build_id=b2ce790473c
$ gmake print-native_qt_build_id HOST=x86_64-w64-mingw32
native_qt_build_id=70e1e5164c5
```
### With this patch
The checksum calculation now parses `include` directives and adds those files to the hash. The IDs now update correctly:
```
$ cd depends
$ gmake print-qt_build_id HOST=x86_64-w64-mingw32
qt_build_id=9a6ebf79cb3
$ gmake print-native_qt_build_id HOST=x86_64-w64-mingw32
native_qt_build_id=6ad78a3f644
$ echo "" >> packages/qt_details.mk
$ gmake print-qt_build_id HOST=x86_64-w64-mingw32
qt_build_id=ca820665c52
$ gmake print-native_qt_build_id HOST=x86_64-w64-mingw32
native_qt_build_id=082e4cb2364
```
ACKs for top commit:
sedited:
ACK ec61a1af62
Tree-SHA512: 9425d606dcf003ef9342560a1d0def3d591279ed261a6af0cfb2bf7b2fb1864bf7937877a1119e4c694e6c74a46074eb5e84e6198a90f4d1cd49010088077f92
de9b436ba3 depends: Switch from multilib to platform-specific toolchains (Hennadii Stepanov)
Pull request description:
Using the multilib GCC toolchain, as currently documented in [`depends/README.md`](4c1906a500/depends/README.md), has several issues, such as:
1. The [`g++-multilib`](https://packages.ubuntu.com/noble/g++-multilib) package conflicts with platform-specific cross-compiler packages. This means it is not possible to cross compile for `i686` and other platforms using the same set of installed packages.
2. The [`g++-multilib`](https://packages.ubuntu.com/noble/g++-multilib) package is not available for `arm64`:
```sh
$ sudo apt install g++-multilib
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package g++-multilib
```
3. Managing the multilib GCC toolchain requires additional code in both depends and Guix scripts.
This PR addresses all the issues mentioned above by switching from multilib to platform-specific toolchains.
Also see https://github.com/bitcoin/bitcoin/pull/22456.
---
Here are examples of building for different scenarions:
- Linux, `x86_64` or `arm64`, building with depends natively:
```sh
$ gmake -C depends -j $(nproc)
$ cmake -B build --toolchain depends/$(./depends/config.sub $(./depends/config.guess))/toolchain.cmake
$ cmake --build build -j $(nproc)
```
- Linux, `x86_64` or `arm64`, cross compiling for `i686-pc-linux-gnu`:
```sh
$ sudo apt install g++-i686-linux-gnu binutils-i686-linux-gnu
$ export HOST=i686-linux-gnu
$ gmake -C depends -j $(nproc)
$ cmake -B build-${HOST} --toolchain depends/${HOST}/toolchain.cmake
$ cmake --build build-${HOST} -j $(nproc)
```
- Linux, `x86_64`, cross compiling for `arm64`:
```sh
$ sudo apt install g++-aarch64-linux-gnu binutils-aarch64-linux-gnu
$ export HOST=aarch64-linux-gnu
$ gmake -C depends -j $(nproc)
$ cmake -B build-${HOST} --toolchain depends/${HOST}/toolchain.cmake
$ cmake --build build-${HOST} -j $(nproc)
```
- Linux, `arm64`, cross compiling for `x86_64`:
```sh
$ sudo apt install g++-x86-64-linux-gnu binutils-x86-64-linux-gnu
$ export HOST=x86_64-linux-gnu
$ gmake -C depends -j $(nproc)
$ cmake -B build-${HOST} --toolchain depends/${HOST}/toolchain.cmake
$ cmake --build build-${HOST} -j $(nproc)
```
ACKs for top commit:
fanquake:
ACK de9b436ba3
BrandonOdiwuor:
ACK de9b436ba3
Tree-SHA512: 453b4744974cdf56d6edfdbe93bb11e3bae3f9bc9cd99b9c57aee74e65fcdd3ac011a1dcc19f485ea3be427f4e9c6c6b0d704881369f719620f0cb299123e561
8a90c7cd97 guix: Build for macOS using LLVM toolchain only (Hennadii Stepanov)
7e1a750d45 guix, refactor: Use `target` variable instead of hardcoded value (Hennadii Stepanov)
Pull request description:
This PR makes macOS builds LLVM-only (non-GCC) by switching the build compiler in depends to `clang` + `libc++`.
See: https://github.com/bitcoin/bitcoin/issues/30206.
ACKs for top commit:
fanquake:
ACK 8a90c7cd97
Tree-SHA512: 02bfa784f89db980de2d2bb759200a0e8c0b10f48ac7e14e2bcdba75416aef30afa68d36e98c4652e18d282f023d1e94a351ff65b4a2731bdcac7c8a8c720623
226e6388b7 depends: Update Qt to 6.8.4 (Hennadii Stepanov)
Pull request description:
Release notes: https://code.qt.io/cgit/qt/qtreleasenotes.git/about/qt/6.8.4/release-note.md
`depends/patches/qt/qtbase_platformsupport.patch` has been dropped as the fix was backported upstream in 5afcc64fd7.
ACKs for top commit:
fanquake:
ACK 226e6388b7
Tree-SHA512: 20f371384c1fcfd5018218ef262b10568bd009e2f1fafca9fa42788aca4683ec706b7a4e35816b884b294b5f9bdb1aefda0bad75921d9e426558cccd80f913cd
d64ea15824 ci: add openBSD cross CI job (fanquake)
5404b62074 depends: add openbsd_LDFLAGS (fanquake)
Pull request description:
This adds a Linux cross job for OpenBSD; similar to https://github.com/bitcoin/bitcoin/pull/34491 (FreeBSD).
ACKs for top commit:
hebasto:
ACK d64ea15824.
willcl-ark:
ACK d64ea15824
Tree-SHA512: 0353c0ae8dd49c861a9100ebd5044fc39227c29859ca68e6454ebdf469c90ff5471e29733613606ee8ba72037f7fca5086275f794e90864a6456ffee73d9113b
This guarantees `$(package)_sha256_hash` reproducibility regardless of
the default behavior of `$(build_TAR)`. Fixes caching on some systems,
for example, on FreeBSD.
1. The trailing slash is redundant.
2. It causes warnings when using CMake >=3.31:
```
CMake Warning (dev) at CMakeLists.txt:596 (install):
Policy CMP0177 is not set: install() DESTINATION paths are normalized. Run
"cmake --help-policy CMP0177" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.
```
f1e14dfbe9 depends: remove workaround for Make older than 4.2.90 (fanquake)
Pull request description:
This was introduced for distros shipping older `make`, such as Ubuntu `20.04` (`4.2.1`). It's likely that any distros being used for Darwin and Windows cross compilation, are shipping a newer make at this point.
ACKs for top commit:
hebasto:
ACK f1e14dfbe9, I have reviewed the code and it looks OK.
Tree-SHA512: bb5d785e4804f0b0d51c5abba31ee4537cf04247801edef51a5da728c7df7fff1189625d222f91b8f5896f9ec71dc8dbd11614a69e13e0dcad6017cab7dd5874
242b0ebb5c btcsignals: use a single shared_ptr for liveness and callback (Cory Fields)
b12f43a0a8 signals: remove boost::signals2 from depends and vcpkg (Cory Fields)
a4b1607983 signals: remove boost::signals2 mentions in linters and docs (Cory Fields)
375397ebd9 signals: remove boost includes where possible (Cory Fields)
091736a153 signals: re-add forward-declares to interface headers (Cory Fields)
9958f4fe49 Revert "signals: Temporarily add boost headers to bitcoind and bitcoin-node builds" (Cory Fields)
34eabd77a2 signals: remove boost compatibility guards (Cory Fields)
e60a0b9a22 signals: Add a simplified boost-compatible implementation (Cory Fields)
63c68e2a3f signals: add signals tests (Cory Fields)
edc2978058 signals: use an alias for the boost::signals2 namespace (Cory Fields)
9ade3929aa signals: remove forward-declare for signals (Cory Fields)
037e58b57b signals: use forwarding header for boost signals (Cory Fields)
2150153f37 signals: Temporarily add boost headers to bitcoind and bitcoin-node builds (Cory Fields)
fd5e9d9904 signals: Use a lambda to avoid connecting a signal to another signal (Cory Fields)
Pull request description:
This drops our dependency on `boost::signals2`, leaving `boost::multi_index` as the only remaining boost dependency for bitcoind.
`boost::signals2` is a complex beast, but we only use a small portion of it. Namely: it's a way for multiple subscribers to connect to the same event, and the ability to later disconnect individual subscribers from that event.
`btcsignals` adheres to the subset of the `boost::signals2` API that we currently use, and thus is a drop-in replacement. Rather than implementing a complex `slot` tracking class that we never used anyway (and which was much more useful in the days before std::function existed), callbacks are simply wrapped directly in `std::function`s.
The new tests work with either `boost::signals2` or the new `btcsignals` implementation. Reviewers can verify
functional equivalency by running the tests in the commit that introduces them against `boost::signals2`, then again with `btcsignals`.
The majority of the commits in this PR are preparation and cleanup. Once `boost::signals2` is no longer needed, it is removed from depends. Additionally, a few CMake targets no longer need boost includes as they were previously only required for signals.
I think this is actually pretty straightforward to review. I kept things simple, including keeping types unmovable/uncopyable where possible rather than trying to define those semantics. In doing so, the new implementation has even fewer type requirements than boost, which I believe is due to a boost bug. I've opened a PR upstream for that to attempt to maintain parity between the implementations.
See individual commits for more details.
Closes#26442.
ACKs for top commit:
fjahr:
Code review ACK 242b0ebb5c
maflcko:
re-review ACK 242b0ebb5c🎯
w0xlt:
reACK 242b0ebb5c
Tree-SHA512: 9a472afa4f655624fa44493774a63b57509ad30fb61bf1d89b6d0b52000cb9a1409a5b8d515a99c76e0b26b2437c30508206c29a7dd44ea96eb1979d572cd4d4
This was introduced for distros shipping older make, such as
Ubuntu 20.04 (4.2.1). It's likely that all distros being used for
Darwin and Qindows cross compilation, are shipping a newer make at
this point.
b149a28f6b depends: Do not consider `CC` environment variable when detecting system (Hennadii Stepanov)
Pull request description:
On the master branch @ 3c88eac28e, consider the following commands in the `depends` subdirectory:
```sh
$ make print-build HOST=i686-pc-linux-gnu CC="clang -m32"
build=x86_64-pc-linux-gnu
$ make print-host HOST=i686-pc-linux-gnu CC="clang -m32"
host=i686-pc-linux-gnu
```
The printed variable values are expected.
However, switching the `CC` variable context from Makefile to the shell environment breaks expectations:
```sh
$ CC="clang -m32" make print-build HOST=i686-pc-linux-gnu
build=i686-pc-linux-gnu
$ CC="clang -m32" make print-host HOST=i686-pc-linux-gnu
host=i686-pc-linux-gnu
```
This PR fixes this issue.
#### UPDATE 2026-01-20
On the master branch @ 7f5ebef56a:
```
$ gmake print-build HOST=i686-pc-linux-gnu CC="clang -m32"
build=i686-pc-linux-gnu
$ gmake print-host HOST=i686-pc-linux-gnu CC="clang -m32"
host=i686-pc-linux-gnu
```
ACKs for top commit:
sedited:
Re-ACK b149a28f6b
ryanofsky:
Code review ACK b149a28f6b. `env --unset` was replaced with `unset &&` since last review. I still think it could be better to write `CC=$(build_CC)` here even if `build_CC` may not be defined at this point (https://github.com/bitcoin/bitcoin/pull/29963#issuecomment-3774229317) because it makes intent of the code more obvious, but current PR is already an improvement
Tree-SHA512: bd498706ad46aab93192e21b7cc30c34a714c5f31601122752fc94416dc51846b8d4eaf5d1c3250ba64d4eadf3fd43c9f7f5d9e178a47ee2165474ac6833fa31
578525d31d depends: Remove no longer necessary `dsymutil` (Hennadii Stepanov)
Pull request description:
I can't see where `dsymutil` is used. For example, a shared library under LTO builds fine:
```
cmake -B build --toolchain depends/arm64-apple-darwin/toolchain.cmake -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DBUILD_KERNEL_LIB=ON -DBUILD_SHARED_LIBS=ON
cmake --build build -t libbitcoinkernel
```
ACKs for top commit:
fanquake:
ACK 578525d31d
Tree-SHA512: 41e7601e26f639383bfa78ceb97e45d03e6cf098cf636bc4f3274360516bb78753aacfd89c8541b38ee4f39cbbf7c7b7a6eb8dc9a653f4438392cd61678e80ce
1. Use `build_os` instead of `host_os` for native packages.
2. `XCODE_VERSION` is available only for `darwin` hosts. Therefore,
simply disable the Xcode version check for `native_qt`.
Fix the behavior where modifications in included files (e.g.
`packages/qt_details.mk`) do not trigger a rebuild of the
parent packages (`native_qt` and `qt`).
The checksum calculation now parses `include` directives and
adds those files to the hash.
CC/CXX only override compilers for target (host) packages. Native
build tool packages (native_capnp, native_qt, etc.) use separate
build_CC/build_CXX variables, which default to gcc/g++ on Linux.
On systems without gcc (e.g. Nix, Chimera Linux), native package
builds fail unless build_CC/build_CXX are also set explicitly.
Document how to override both sets of compilers.
0ebc6891e2 depends: delete Boost extra files (fanquake)
168997e9b5 depends: disable Qt sbom generation (fanquake)
Pull request description:
1 followup to #34650, to disable sbom generation.
1 commit to Boost, to cleanup `.natvis` files that end up in share.
ACKs for top commit:
hebasto:
ACK 0ebc6891e2, tested on Ubuntu 25.10.
Tree-SHA512: 728b51d798a30c54df915564446a7a8648eb4fc27adb8c18b8202df506e2ff61e74516cfe4d6af1af72279255fc75fe14cb43403632a978637781d59eb11fc0f
0a6724aaae doc: Update Windows build notes (Hennadii Stepanov)
473e5f8efc qt: Add patch to fix SFINAE warnings in QAnyStringView with gcc16 (Hennadii Stepanov)
3cb4d6066b qt: add patches to fix SFINAE errors/warnings with gcc16 (Cory Fields)
d7e972a90d qt: add patch to fix build with gcc16 (Cory Fields)
19693a8c91 depends: Update Qt to 6.8.3 (Hennadii Stepanov)
c55584575a cmake: Fix `FindQt` module (Hennadii Stepanov)
Pull request description:
This PR updates the `qt` package in depends to the latest open-source [6.8.3](https://www.qt.io/blog/qt-6.8.3-released) LTS release.
The update includes numerous bugfixes, which allows us to drop `qtbase_plugins_windows11style.patch`.
Additionally, it includes [patches](https://github.com/bitcoin/bitcoin/issues/34569#issuecomment-3892793262) for compatibility with GCC 16 (along with one extra patch), and incorporates a [commit](8f1b55d1d5) from https://github.com/bitcoin/bitcoin/pull/32709.
Closes https://github.com/bitcoin/bitcoin/issues/34569.
ACKs for top commit:
achow101:
ACK 0a6724aaae
sedited:
ACK 0a6724aaae
Tree-SHA512: b66fe6f75bae00fb5c525c5fad56d39273f53f6bfd58206da8a55c6e41d14533137c72fb03e9537ba3a3d0b3463b6dcbef6a88ac2f4559fa6e9abf045fe1beaa