Commit graph

1056 commits

Author SHA1 Message Date
Hennadii Stepanov
d44626a9c2
depends: Override default build type for libevent
The `libevent` package defaults to the "Release" build type, which
overrides our per-build-type optimization flags with `-O3`.

To prevent this behavior, set `CMAKE_BUILD_TYPE` to "None", consistent
with how other packages are handled.
2025-01-21 10:39:11 +00:00
merge-script
4601b7ca61
Merge bitcoin/bitcoin#31125: depends: add *FLAGS to gen_id
Some checks are pending
CI / test each commit (push) Waiting to run
CI / macOS 14 native, arm64, no depends, sqlite only, gui (push) Waiting to run
CI / macOS 14 native, arm64, fuzz (push) Waiting to run
CI / Win64 native, VS 2022 (push) Waiting to run
CI / Win64 native fuzz, VS 2022 (push) Waiting to run
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Waiting to run
01df180bfb depends: add mold & ld.lld to gen_id (fanquake)
d032ac8063 depends: add *FLAGS to gen_id (fanquake)

Pull request description:

  The depends cache should be busted when flags change, the same as any other tooling change. I'd also like to start passing `*FLAGS` into depends inside the Guix env, which, without this change, doesn't bust the cache.

ACKs for top commit:
  hebasto:
    ACK 01df180bfb.

Tree-SHA512: 3809359fe763af9dde484e0c6bd3e262c4c09fcbe2f96ccf64194f5f9f840f5476b9c9929cf7bda7b8c14efeffd369cdb8c233625b79a944e1380df20698246f
2025-01-20 16:25:39 +00:00
merge-script
2e839dd641
Merge bitcoin/bitcoin#30774: depends: Qt 5.15.16
31a0e5f090 depends: Qt 5.15.16 (fanquake)

Pull request description:

  Contains a handful of miscellaneous bug fixes.
  We can drop a few of our patches.

  See https://github.com/qt/qtbase/compare/v5.15.14-lts-lgpl...v5.15.16-lts-lgpl.

ACKs for top commit:
  hebasto:
    ACK 31a0e5f090.
  TheCharlatan:
    ACK 31a0e5f090

Tree-SHA512: dd7b3332dd6ecb95189bc72364883425fb8869e03850791d2ee92555a37046c7abaaee16575a0396f1ce9674856b894563dbd36868c2cf46f9fee48028fd967b
2025-01-20 14:03:54 +00:00
merge-script
5b3a81f44d
Merge bitcoin/bitcoin#31626: depends: Use base system's sha256sum utility on FreeBSD
727c542769 depends: Use base system's `sha256sum` utility (Hennadii Stepanov)

Pull request description:

  On FreeBSD, the `shasum` utility is provided by the [`perl5`](https://ports.freebsd.org/cgi/ports.cgi?query=%5Eperl5&stype=all&sektion=all) port, which is not part of the base system and must be [installed](0e3518579a/.github/workflows/freebsd.yml (L104)) separately. Note that this requirement is currently not documented in [`depends/README.md`](https://github.com/bitcoin/bitcoin/blob/master/depends/README.md).

  This PR switches to using the [`sha256sum`](https://man.freebsd.org/cgi/man.cgi?query=sha256sum&apropos=0&sektion=0&manpath=FreeBSD+14.2-RELEASE+and+Ports&arch=default&format=html) utility, which is included in the base system.

ACKs for top commit:
  davidgumberg:
    ACK 727c542769

Tree-SHA512: 41f11b80c2dc32514116400aa8ae57ef809edcbff5883dd62042d12ff14a54557864e2f1979c8705914242a2334880463da3e376f32c5b57a68fe41a90db1f85
2025-01-17 14:02:03 +00:00
Adlai Chandrasekhar
160c27ec07 doc: Update dependency installation for Debian/Ubuntu and CI
According to the description for pkg-config, "pkgconf is a
replacement for pkg-config, providing additional functionality
while also maintaining compatibility. This package only provides
a dependency link to the pkgconf package to help with package
upgrades. It can be safely removed."

Thus several scripts and markdown files are updated.
2025-01-16 17:31:13 +02:00
fanquake
31a0e5f090
depends: Qt 5.15.16 2025-01-15 11:52:27 +00:00
fanquake
01df180bfb
depends: add mold & ld.lld to gen_id
We use `lld` when cross-compiling for macOS, and it's version should
be tied to LLVM. However someone compiling with GCC and `-fuse-ld=lld`
would not see a cache bust if the LLVM toolchain was updated.

We don't use `mold` directly, but I'm aware of it's usage in
infrastructure, along with depends, used to test the project.
2025-01-10 12:38:47 +00:00
fanquake
d032ac8063
depends: add *FLAGS to gen_id
The depends cache should be busted when flags change, the same as any
other tooling change. Id also like to start passing *FLAGS into depends
inside the Guix env, which, without this change, doesn't bust the cache.
2025-01-10 12:38:25 +00:00
Hennadii Stepanov
727c542769
depends: Use base system's sha256sum utility
On FreeBSD, the `shasum` utility is provided by the `perl5` port, which
is not part of the base system and must be installed separately.
Note that this requirement is currently not documented in
`depends/README.md`.

This change switches to using the `sha256sum` utility, which is included
in the base system.
2025-01-09 20:24:05 +00:00
Hennadii Stepanov
8a46286da6
depends: Fix spacing issue
This change resolves an issue where a missing space caused the value of
the `build_AR` variable to be concatenated with the "NM=" string. This
resulted in subsequent calls to `${AR}` and `${NM}` failing.
2025-01-09 13:36:19 +00:00
Hennadii Stepanov
b0b8d96d93
depends: Update capnproto to 1.1.0
This change fixes compilation on NetBSD with GCC 14.
2024-12-21 17:39:19 +00:00
merge-script
d2136d32bb
Merge bitcoin/bitcoin#31502: depends: Fix CXXFLAGS on NetBSD
a10bb400e8 depends: Fix CXXFLAGS on NetBSD (Hennadii Stepanov)

Pull request description:

  This PR corrects an issue where `CXXFLAGS` were mistakenly overridden by `CFLAGS`. This behaviour was introduced in 7e7b3e42fa (from https://github.com/bitcoin/bitcoin/pull/22380).

  On the master branch:
  ```
  $ gmake --no-print-directory -C depends print-x86_64_netbsd_CXXFLAGS
  x86_64_netbsd_CXXFLAGS=-pipe -std=c11
  ```

  With this PR:
  ```
  $ gmake --no-print-directory -C depends print-x86_64_netbsd_CXXFLAGS
  x86_64_netbsd_CXXFLAGS=-pipe -std=c++20
  ```

ACKs for top commit:
  theuni:
    utACK a10bb400e8

Tree-SHA512: 0c842db2965ebb0a58693394715922810235d9e5f2a7416fe258eb252dbd68ec04f90a0f7948abe938caf94a9194cca7deb53a08335c4404cce3a40c5cb44944
2024-12-17 10:55:53 +00:00
Hennadii Stepanov
a10bb400e8
depends: Fix CXXFLAGS on NetBSD
This change corrects an issue where CXXFLAGS were mistakenly overridden
by CFLAGS.
2024-12-14 20:32:38 +00:00
Hennadii Stepanov
3353d4a5e9
depends: Ignore prefix directory on OpenBSD 2024-12-14 09:55:47 +00:00
fanquake
5cd9e95eea
depends: update capnproto to 1.0.2
This fixes compilation on FreeBSD.
See:
1c19c362b4.
2024-12-12 17:15:15 +00:00
fanquake
b7ec69c25c
depends: add -g to *BSD_debug flags
To match the other HOST_debug_flags.
2024-12-10 15:20:46 +00:00
TheCharlatan
a8e04704f9
build: Set shared linker flags in toolchain file
These are required when cross-compiling shared libraries such as the
kernel library.
2024-11-30 11:31:27 +01:00
Ava Chow
70e20ea024
Merge bitcoin/bitcoin#31172: build: increase minimum supported Windows to 10.0
Some checks are pending
CI / test each commit (push) Waiting to run
CI / macOS 14 native, arm64, no depends, sqlite only, gui (push) Waiting to run
CI / macOS 14 native, arm64, fuzz (push) Waiting to run
CI / Win64 native, VS 2022 (push) Waiting to run
CI / Win64 native fuzz, VS 2022 (push) Waiting to run
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Waiting to run
ee1128ead8 doc: update stack-clash-protection comment re mingw-w64 (fanquake)
bf47448f15 test: drop check for Windows < 10 (fanquake)
35b898c47f release: target Windows 10 or later (fanquake)
398754e70b depends: target Windows 10 when building for mingw-w64 (fanquake)

Pull request description:

  Follows up to https://github.com/bitcoin/bitcoin/pull/31048#discussion_r1803165670.

  We definitely cannot claim that Bitcoin Core is "supported and extensively tested on" on Windows 7.

  Note that #30997 is also increasing the minimum required Windows version (for the GUI) to 10.

ACKs for top commit:
  hodlinator:
    cr-ACK ee1128ead8
  davidgumberg:
    ACK ee1128ead8
  achow101:
    ACK ee1128ead8
  hebasto:
    re-ACK ee1128ead8, only rebased, a commit message and a comment have been amended since my recent [review](https://github.com/bitcoin/bitcoin/pull/31172#pullrequestreview-2415452160).
  TheCharlatan:
    ACK ee1128ead8

Tree-SHA512: 245e0bac3d63414d919a1948661fef4ff79359faaacaf19d64abd91cc62e822797fb1cf3379e340bfdf9a85c0b88fd99a90eda450dd4218b6213ab78aefb1374
2024-11-26 17:47:29 -05:00
TheCharlatan
bcd82b13f4
Remove pkgconfig from toolchain file 2024-11-14 13:39:09 +00:00
fanquake
319a4e8261
depends: drop sqlite pkgconfig file 2024-11-14 13:39:08 +00:00
fanquake
a8fe1fd38b
depends: better cleanup after fontconfig 2024-11-14 11:32:47 +00:00
fanquake
17e79c9260
depends: fully remove libtool archives from Qt build
`Qt5Zlib.la` was hanging around.
2024-11-14 11:32:47 +00:00
fanquake
e3e648cf41
depends: drop pkg-config option from Qt build 2024-11-14 11:32:47 +00:00
fanquake
0d185bd99f
doc: update depends doc to prefer .cmake outputs 2024-11-14 11:32:46 +00:00
merge-script
8d340be924
Merge bitcoin/bitcoin#31181: cmake: Revamp FindLibevent module
Some checks are pending
CI / macOS 14 native, arm64, no depends, sqlite only, gui (push) Waiting to run
CI / test each commit (push) Waiting to run
CI / Win64 native, VS 2022 (push) Waiting to run
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Waiting to run
5a96767e3f depends, libevent: Do not install *.pc files and remove patches for them (Hennadii Stepanov)
ffda355b5a cmake, refactor: Move `HAVE_EVHTTP_...` to `libevent` interface (Hennadii Stepanov)
b619bdc330 cmake: Revamp `FindLibevent` module (Hennadii Stepanov)

Pull request description:

  This PR generalizes the use of `find_package` / `pkg_check_modules`, prioritizing the former.

  Addresses https://github.com/bitcoin/bitcoin/pull/30903#issuecomment-2444700876:
  > We should also follow up with refactoring the libevent module, to more generically use CMake/pkg-config, rather than restricting the CMake usage to `vcpkg`. At that point, we'd likely be able to dump pkg-config for the depends path entirely.

  Similar to https://github.com/bitcoin/bitcoin/pull/30903.

ACKs for top commit:
  fanquake:
    ACK 5a96767e3f

Tree-SHA512: 181020c16ccd2821e718c73f264badcdc5e62980c4a8d9691e759efe2ea00da2326e26308d1dcfdeac01e9e27930428ecace9f36941deee951b751b138d7266c
2024-11-11 15:31:58 +00:00
fanquake
398754e70b
depends: target Windows 10 when building for mingw-w64 2024-11-08 13:32:37 +00:00
merge-script
3a5f6027e1
Merge bitcoin/bitcoin#31171: depends: Specify CMake generator explicitly
e2ba823671 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 e2ba823671 - Going forward I think we should look at making this work without having to hard code anything.

Tree-SHA512: e14ed1cec192434fe089d36a83e1e150727a3b299fada80a61fa5b44b0c50e014a774ef1e6cd6df189e25f7a13042a20d4f9605f6ccd32e7782f10adaf5e788f
2024-11-07 17:12:21 +00:00
Hennadii Stepanov
5a96767e3f
depends, libevent: Do not install *.pc files and remove patches for them 2024-11-06 15:40:42 +00:00
Hennadii Stepanov
4747f03095
depends, doc: List packages required to build qt package separately 2024-11-04 11:22:33 +00:00
merge-script
dc97e7f6db
Merge bitcoin/bitcoin#30903: cmake: Add FindZeroMQ module
Some checks are pending
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Waiting to run
CI / test each commit (push) Waiting to run
CI / macOS 14 native, arm64, no depends, sqlite only, gui (push) Waiting to run
CI / Win64 native, VS 2022 (push) Waiting to run
915640e191 depends: zeromq: don't install .pc files and remove patches for them (Cory Fields)
6b8a74463b cmake: Add `FindZeroMQ` module (Hennadii Stepanov)

Pull request description:

  This PR introduces the `FindZeroMQ` module, which first attempts to find the `libzmq` library using CMake's `find_package()` and falls back to `pkg_check_modules()` if unsuccessful.

  Addresses https://github.com/bitcoin/bitcoin/issues/30876 for the ZeroMQ package.

ACKs for top commit:
  fanquake:
    ACK 915640e191

Tree-SHA512: 2f17bae21be5d3f280a13425d22f5d1b2e23837a8aaf5ec89c433767509de030a42d598b261e102bdb5b860d8ede98013c124c3d25e081e956d4ee3a81b2584f
2024-10-29 16:21:07 +00:00
Hennadii Stepanov
e2ba823671
depends: Specify CMake generator explicitly
Building packages in depends implies using GNU Make. However, this
assumption can be wrong in environments where the `CMAKE_GENERATOR`
variable is set.
This change explicitly makes CMake use the "Unix Makefiles" generator.
2024-10-28 11:25:06 +00:00
merge-script
6e21dedbf2
Merge bitcoin/bitcoin#31130: Drop miniupnp dependency
40e5f26a3f mapport: remove dead code in DispatchMapPort (Antoine Poinsot)
38fdf7c1fb mapport: drop outdated comments (Antoine Poinsot)
b7b2435290 doc: add release note for #31130 (Antoine Poinsot)
1b6dec98da depends: drop miniupnpc (Antoine Poinsot)
953533d021 doc: remove mentions of UPnP (Antoine Poinsot)
94ad614482 ci: remove UPnP options (Antoine Poinsot)
a9598e5eaa build: drop miniupnpc dependency (Antoine Poinsot)
a5fcfb7385 interfaces: remove now unused 'use_upnp' arg from 'mapPort' (Antoine Poinsot)
038bbe7b20 daemon: remove UPnP support (Antoine Poinsot)
844770b05e qt: remove UPnP settings (Antoine Poinsot)

Pull request description:

  This PR removes UPnP IGD support and drops our [miniupnp](https://github.com/miniupnp/miniupnp) dependency.

  Miniupnpc is a C library (somewhat) maintained by a single person which had several vulnerabilities in the past (a couple dozens are listed [here](https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=miniupnp)), some of which directly affected our software ([RCE in 2015](https://bitcoincore.org/en/2024/07/03/disclose_upnp_rce/), [OOM in 2020](https://bitcoincore.org/en/2024/07/31/disclose-upnp-oom/)).

  The main purpose of this functionality is to have more (non-data-center) reachable nodes on the network. For a non-technical user running Bitcoin Core at home, the software would automatically open a port on their router to receive incoming connections. This way, users not able to manually open a port on their router would still provide the network with more resources and enhance its diversity.

  However, due to past vulnerabilities (and a worry about unknown future ones) in miniupnpc this feature was disabled by default in https://github.com/bitcoin/bitcoin/pull/6795. Having it disabled by default kills (most of?) the purpose of having this functionality in the first place: someone technical enough to understand the `-upnp` startup option or the "enable UPnP" setting is most likely able to open a port on his box in the first place.

  In addition, laanwj implemented PCP with a NAT-PMP fallback directly in Bitcoin Core in https://github.com/bitcoin/bitcoin/pull/30043. If we ever want to re-enable automatic NAT traversal by default in Bitcoin Core, this is the best option (and in my opinion the only sane one). The NAT-PMP fallback makes it so compatibility shouldn't be (much of) an issue.

  On balance, i believe that keeping this functionality and this barely maintained C dependency has higher costs than benefits. Therefore i propose that we get rid of it.

ACKs for top commit:
  jarolrod:
    ACK 40e5f26a3f
  1440000bytes:
    Code Review ACK 40e5f26a3f
  laanwj:
    Code review ACK 40e5f26a3f
  i-am-yuvi:
    Tested ACK 40e5f26a3f

Tree-SHA512: 9ea48662775510f5ec6de7af65790f7c8d211603398e9d8c634a86387be81b28081419a95b4d6680d3d7fe6a9f16cec99f16516548201dc7e49781909899a657
2024-10-28 10:47:34 +00:00
Cory Fields
915640e191
depends: zeromq: don't install .pc files and remove patches for them 2024-10-25 18:11:43 +01:00
Antoine Poinsot
1b6dec98da
depends: drop miniupnpc 2024-10-25 09:27:30 -04:00
merge-script
8f24e492e2
Merge bitcoin/bitcoin#29991: depends: sqlite 3.46.1
def6dd0c59 depends: sqlite 3.46.1 (fanquake)

Pull request description:

  Update sqlite in depends from [3.38.5](https://sqlite.org/releaselog/3_38_5.html) to [3.46.1](https://sqlite.org/releaselog/3_46_1.html).

ACKs for top commit:
  TheCharlatan:
    ACK def6dd0c59
  theuni:
    Not opposed utACK def6dd0c59

Tree-SHA512: 1f12c8ed8d05600b8240bcdbad5cf7d073ea5ab0bbd4a0f49a39ccfe1a93c043ee855b6eb0c67028edec57d8c21588dc33246e64d0b94feafad1a6ec38839893
2024-10-25 11:43:09 +01:00
laanwj
a0c9595810 doc: Make list of targets in depends README consistent
The description of `i686-pc-linux-gnu` and `x86_64-pc-linux-gnu` is
incomplete and inconsistent with the rest. Fix this. Also use "64 bit"
consistently instead of "64-bit".
2024-10-23 20:19:22 +02:00
merge-script
563c4d2926
Merge bitcoin/bitcoin#31105: Update libmultiprocess library
90b405516f Update libmultiprocess library (Ryan Ofsky)

Pull request description:

  Add recent changes and fixes for shutdown bugs.

  https://github.com/chaincodelabs/libmultiprocess/pull/111: doc: Add internal design section
  https://github.com/chaincodelabs/libmultiprocess/pull/113: Add missing include to util.h
  https://github.com/chaincodelabs/libmultiprocess/pull/116: shutdown bugfix: destroy RPC system before running cleanup callbacks
  https://github.com/chaincodelabs/libmultiprocess/pull/118: shutdown bugfix: Prevent segfault in server if connection is broken during long function call
  https://github.com/chaincodelabs/libmultiprocess/pull/119: cmake: avoid libatomic not found error on debian

ACKs for top commit:
  fanquake:
    ACK 90b405516f
  TheCharlatan:
    ACK 90b405516f

Tree-SHA512: 2c256667f0c16e00bb5a81b2c6d3db103fae211844e32b111bbed673ab2612ad1478e6b3ecd3a867a4e425cfa6e778b67388343626597a8fac800a15cea5e53a
2024-10-21 10:54:38 +01:00
Ryan Ofsky
90b405516f Update libmultiprocess library
Add recent changes and fixes for shutdown bugs.

https://github.com/chaincodelabs/libmultiprocess/pull/111: doc: Add internal design section
https://github.com/chaincodelabs/libmultiprocess/pull/113: Add missing include to util.h
https://github.com/chaincodelabs/libmultiprocess/pull/116: shutdown bugfix: destroy RPC system before running cleanup callbacks
https://github.com/chaincodelabs/libmultiprocess/pull/118: shutdown bugfix: Prevent segfault in server if connection is broken during long function call
https://github.com/chaincodelabs/libmultiprocess/pull/119: cmake: avoid libatomic not found error on debian
2024-10-16 12:13:27 -04:00
fanquake
184f12c154
doc: remove dependency install instructions from win docs
This duplicates what is in depends, and is outdated.
2024-10-16 14:47:11 +01:00
Hennadii Stepanov
a0e089a71d
build: Bump minimum supported macOS to 13.0
Running Bitcoin Core on unsupported OSes may expose users to security
issues.

macOS Monterey 12 received its final security update (12.7.6) on July
2024. Apple classifies the hardware that can run macOS 12 at most as
"obsolete worldwide".
2024-10-15 10:18:48 +01:00
merge-script
3c4a9419db
Merge bitcoin/bitcoin#31013: depends: For mingw cross compile use -gcc-posix to prevent library conflict
ae56b3230b depends: For mingw cross compile use -gcc-posix to prevent library conflict (laanwj)

Pull request description:

  CMake parses some paths from the spec of the C compiler, assuming it will be the linker, resulting in the link to end up with  `-L/usr/lib/gcc/x86_64-w64-mingw32/12-win32` on debian bookworm if both `-win32` and `-posix` variants are installed, and `-win32` is the default alternative.

  This results in the wrong C++ library being linked, missing std::threads::hardware_concurrency and other threading functions.

  To fix this, use the `-posix` variant of gcc as well when available. This fixes a regression compared to autotools, where this scenario worked.

ACKs for top commit:
  theuni:
    utACK ae56b3230b.
  hebasto:
    ACK ae56b3230b. I've tested on both Debian Bookworm and Ubuntu 24.04 with the `g++-mingw-w64-x86-64` package installed. The resulting CMake internal configuration appears more accurate. For instance, on Ubuntu 24.04, for the `bitcoin-tx` target, the diff in `build/src/CMakeFiles/bitcoin-tx.dir/linkLibs.rsp` looks as follows:

Tree-SHA512: f36fae50f91a29f565940494af9e46f47e219b99e329c0714ace47c516ac524602d5b6538a07488157bc2a71be7bac72176097fff3178129c5084bf6cc823167
2024-10-08 15:22:53 +01:00
laanwj
ae56b3230b depends: For mingw cross compile use -gcc-posix to prevent library conflict
CMake parses some paths from the spec of the C compiler, assuming it
will be the linker, resulting in the link to end up with
`-L/usr/lib/gcc/x86_64-w64-mingw32/12-win32` on debian bookworm if both
-win32 and -posix variants are installed, and -win32 is the default
alternative.

This results in the wrong C++ library being linked, missing
std::threads::hardware_concurrency and other threading functions.

To fix this, use the -posix variant of gcc as well when available. This
fixes a regression compared to autotools, where this scenario worked.
2024-10-01 19:46:27 +02:00
Hennadii Stepanov
605926da0a
depends: Print ready-to-use --toolchain option for CMake invocation 2024-10-01 13:03:35 +01:00
Ava Chow
c33eb2360e
Merge bitcoin/bitcoin#30043: net: Replace libnatpmp with built-in PCP+NATPMP implementation
5c7cacf649 ci: Remove natpmp build option and libnatpmp dependency (laanwj)
7e7ec984da doc: Remove mention of natpmp build options (laanwj)
061c3e32a2 depends: Drop natpmp and associated option from depends (laanwj)
20a18bf6aa build: Drop libnatpmp from build system (laanwj)
7b04709862 qt: Changes for built-in PCP+NAT-PMP (laanwj)
52f8ef66c6 net: Replace libnatpmp with built-in NATPMP+PCP implementation in mapport (laanwj)
97c97177cd net: Add PCP and NATPMP implementation (laanwj)
d72df63d16 net: Use GetLocalAddresses in Discover (laanwj)
e02030432b net: Add netif utility (laanwj)
754e425438 crypto: Add missing WriteBE16 function (laanwj)

Pull request description:

  Continues #30005. Closes #17012..

  This PR adds PCP (Port Control Protocol) from [RFC6887](https://datatracker.ietf.org/doc/html/rfc6887).  This adds, in addition to the existing IPv4 port mapping (which now uses PCP, with fallback to NAT-PMP), support for IPv6 pinholing-that is, opening a port on the firewall to make it reachable.

  PCP, like NAT-PMP is a simple UDP-based protocol, and the implementation is self-contained, so this gets rid of lthe libnatpnp dependency without adding a new one. It should otherwise be a drop-in replacement. NAT-PMP fallback is implemented so this will not make router support worse.

  For now it is disabled by default, though in the future (not in this PR) we could consider enable it by default to increase the number of connectable nodes without adding significant attack surface.

  To test:
  ```bash
  bitcoind -regtest -natpmp=1 -debug=net
  ```

  (most of the changes in this PR are, ironically, removing the libnatpmp dependency and associated build system and build docs)

  ## TODO

  - [x] Default gateway discovery on Linux / FreeBSD
  - [x] Default gateway discovery on Windows
  - [x] Default gateway discovery on MacOS
  - [x] Either solve FreeBSD compile issue (probably upstream issue) or remove FreeBSD support

  ## Things to consider for follow-up PRs

  - https://github.com/bitcoin/bitcoin/pull/30043#discussion_r1658764974 avoid unreachable nets (not given to -onlynet=)

  - https://github.com/bitcoin/bitcoin/pull/30043#discussion_r1658949236 could announce an addr:port where we do not listen (no -bind)

  - https://github.com/bitcoin/bitcoin/pull/30043#discussion_r1684368824 could announce the wrong port because it uses GetListenPort()

  - https://github.com/bitcoin/bitcoin/pull/30043#discussion_r1679709347 if we requested one port but another was assigned, then which one to use in the renewal?

  - https://github.com/bitcoin/bitcoin/pull/30043#discussion_r1772017020 Use `GetAdapterAddresses` to discover local addresses for Windows

ACKs for top commit:
  Sjors:
    ACK 5c7cacf649
  achow101:
    ACK 5c7cacf649
  vasild:
    ACK 5c7cacf649

Tree-SHA512: e35b69e56d5f5449a3d48a799f9b7b65107c65eeb3e245c2c1e9d42221e469ca5ead90afae423160601cd664dd553a51c859e04f4492f335b064aae3bf23e3bc
2024-09-30 16:27:47 -04:00
laanwj
061c3e32a2 depends: Drop natpmp and associated option from depends 2024-09-30 11:37:55 +02:00
merge-script
29d00a1cee
Merge bitcoin/bitcoin#30940: depends: Fix build with MULTIPROCESS=1 in Guix environment
06b4c339e8 depends: Fix reproducibility when building with `MULTIPROCESS=1` (Hennadii Stepanov)
d8e3afc335 depends: Fix build with `MULTIPROCESS=1` in Guix environment (Hennadii Stepanov)

Pull request description:

  In the Guix environment, `${BASEPREFIX}/${HOST}/native/bin` is added to the `PATH` environment variable:33adc7521c/contrib/guix/libexec/build.sh (L233-L234)

  This causes CMake to search for package configurations in the `native` subdirectory first.

  Explicitly specifying the top-priority search prefixes for the `Libmultiprocess` and `LibmultiprocessNative` packages resolves https://github.com/bitcoin/bitcoin/issues/30931.

  Can be tested on this [branch](https://github.com/hebasto/bitcoin/commits/240921-guix-mp.DEMO/) with an additional [commit](d8ec933456):
  ```
  $ uname -m
  x86_64
  $ env MULTIPROCESS=1 HOSTS=x86_64-linux-gnu ./contrib/guix/guix-build
  $ find guix-build-$(git rev-parse --short=12 HEAD)/output/ -type f -print0 | env LC_ALL=C sort -z | xargs -r0 sha256sum
  70d482a09099931345888a918df5ccc78a0c742b1d18bb8a5d442af9b2717867  guix-build-d8ec933456bc/output/dist-archive/bitcoin-d8ec933456bc.tar.gz
  ea9465517c0e1cc559a6a353f404b2bf47447332c918b69410dc51b6c4fbdedc  guix-build-d8ec933456bc/output/x86_64-linux-gnu/SHA256SUMS.part
  f83a296139d0757abc47d053b8fddebc6d2ccc36dabea9b2d52883d23ba923bb  guix-build-d8ec933456bc/output/x86_64-linux-gnu/bitcoin-d8ec933456bc-x86_64-linux-gnu-debug.tar.gz
  81aed48bece8d9bf5327530763c17d73dd66d5a3c666cbaf9381c03d4a660845  guix-build-d8ec933456bc/output/x86_64-linux-gnu/bitcoin-d8ec933456bc-x86_64-linux-gnu.tar.gz
  ```
  ```
  $ uname -m
  aarch64
  $ env MULTIPROCESS=1 HOSTS=x86_64-linux-gnu ./contrib/guix/guix-build
  $ find guix-build-$(git rev-parse --short=12 HEAD)/output/ -type f -print0 | env LC_ALL=C sort -z | xargs -r0 sha256sum
  70d482a09099931345888a918df5ccc78a0c742b1d18bb8a5d442af9b2717867  guix-build-d8ec933456bc/output/dist-archive/bitcoin-d8ec933456bc.tar.gz
  ea9465517c0e1cc559a6a353f404b2bf47447332c918b69410dc51b6c4fbdedc  guix-build-d8ec933456bc/output/x86_64-linux-gnu/SHA256SUMS.part
  f83a296139d0757abc47d053b8fddebc6d2ccc36dabea9b2d52883d23ba923bb  guix-build-d8ec933456bc/output/x86_64-linux-gnu/bitcoin-d8ec933456bc-x86_64-linux-gnu-debug.tar.gz
  81aed48bece8d9bf5327530763c17d73dd66d5a3c666cbaf9381c03d4a660845  guix-build-d8ec933456bc/output/x86_64-linux-gnu/bitcoin-d8ec933456bc-x86_64-linux-gnu.tar.gz
  ```

ACKs for top commit:
  ryanofsky:
    Code review ACK 06b4c339e8
  fanquake:
    ACK 06b4c339e8

Tree-SHA512: b219ff29723bf571784af11b8d41fdc0f3fe7e21a87493909f9fcc695e37f9dbf2f6eb0fda172a1e0060dec4d2aeaa7017b1078c0ea0040cabfbbe3e8a352c6b
2024-09-27 10:45:32 +01:00
Hennadii Stepanov
4cf84b344d
depends, doc: No need to specify general requirement
CMake is no longer required solely for `libmultiprocess`.
2024-09-26 11:56:15 +01:00
Ryan Ofsky
070e6a32d5 depends: Update libmultiprocess library for cmake headers target
This update brings in the following changes:

https://github.com/chaincodelabs/libmultiprocess/pull/107 example: Remove manual client adding
https://github.com/chaincodelabs/libmultiprocess/pull/108 doc: Add comments for socket descriptor handling when forking
https://github.com/chaincodelabs/libmultiprocess/pull/109 example: Add missing thread.join() call so example can exit cleanly
https://github.com/chaincodelabs/libmultiprocess/pull/110 cmake: add target_capnp_sources headers target
2024-09-23 16:03:04 -04:00
Hennadii Stepanov
06b4c339e8
depends: Fix reproducibility when building with MULTIPROCESS=1 2024-09-23 13:24:08 +01:00
Hennadii Stepanov
d8e3afc335
depends: Fix build with MULTIPROCESS=1 in Guix environment
In the Guix environment, `${BASEPREFIX}/${HOST}/native/bin` is added to
the `PATH` environment variable, causing CMake to search for package
configurations in the `native` subdirectory first.

Explicitly specifying the top-priority search prefixes for the
`Libmultiprocess` and `LibmultiprocessNative` packages resolves the
issue.
2024-09-23 10:58:49 +01:00