Commit Graph

79 Commits

Author SHA1 Message Date
merge-script
45e2f8f87d
Merge bitcoin/bitcoin#31173: cmake: Add FindQRencode module and enable libqrencode package for MSVC
9e5089dbb0 build, msvc: Enable `libqrencode` vcpkg package (Hennadii Stepanov)
30089b0cb6 cmake: Add `FindQRencode` module (Hennadii Stepanov)

Pull request description:

  This PR introduces the `FindQRencode` CMake module, following the official CMake [guidelines](https://cmake.org/cmake/help/latest/manual/cmake-developer.7.html#find-modules) for managing [upstream libraries](https://github.com/fukuchi/libqrencode) that lack a config file package. This module enhances flexibility in locating the `libqrencode` library by making the use of `pkg-config` optional.

  With this update, `libqrencode` can be detected on systems where either `pkg-config` or the `libqrencode.pc` file is unavailable, such as Windows environments using the vcpkg package manager. However, if `libqrencode.pc` is available, it remains beneficial as the only direct source of the library's version information.

  Additionally, the `libqrencode` vcpkg package is enabled for MSVC builds.

  Here is a diff for configuration output on Ubuntu 24.10:
  ```diff
   -- Detecting CXX compile features - done
   -- Found SQLite3: /usr/include (found suitable version "3.46.1", minimum required is "3.7.17")
   -- Found PkgConfig: /usr/bin/pkg-config (found version "1.8.1")
  --- Checking for module 'libqrencode'
  ---   Found libqrencode, version 4.1.1
  +-- Found QRencode: /usr/lib/x86_64-linux-gnu/libqrencode.so (found version "4.1.1")
   -- Found Qt: /usr/lib/x86_64-linux-gnu/cmake/Qt5 (found suitable version "5.15.15", minimum required is "5.11.3")
   -- Performing Test CXX_SUPPORTS__WERROR
   -- Performing Test CXX_SUPPORTS__WERROR - Success
  ```

ACKs for top commit:
  fanquake:
    ACK 9e5089dbb0

Tree-SHA512: bb9baca64386772f2f4752b1cbff1230792562ca6b2e37c56ad28580b55b1ae6ff65c2cf0d8ab026111d7b5a056d7ac672496a3cfd1a81e4fdd2b84c8cf75fff
2024-11-06 12:11:39 +00:00
merge-script
85224f92d5
Merge bitcoin/bitcoin#30811: build: Unify -logsourcelocations format
788c1324f3 build: Unify `-logsourcelocations` format (Hennadii Stepanov)

Pull request description:

  Closes https://github.com/bitcoin/bitcoin/issues/30799:

  ```
  $ ./build/src/bitcoind -logsourcelocations -asmap=/tmp/no_file 2>&1 | head -1
  2024-11-04T11:40:36Z [init/common.cpp:149] [LogPackageVersion] Bitcoin Core version v28.99.0-788c1324f3d8 (release build)
  ```

ACKs for top commit:
  maflcko:
    re-ACK 788c1324f3
  fanquake:
    ACK 788c1324f3

Tree-SHA512: 5e2ac9c3fda148717271c0fa765382cfdfc8e714e5173095ca528ab7026bf0c422222d7da56f55c082c56fc64fd25b5ba71a05e54f6226be327be4598ad9a9f3
2024-11-06 09:57:56 +00:00
Hennadii Stepanov
30089b0cb6
cmake: Add FindQRencode module 2024-11-05 16:38:19 +00:00
Ryan Ofsky
03cff2c142
Merge bitcoin/bitcoin#31191: build: Make G_FUZZING constexpr, require -DBUILD_FOR_FUZZING=ON to fuzz
fafbf8acf4 Make G_FUZZING constexpr, require -DBUILD_FOR_FUZZING=ON to execute a fuzz target (MarcoFalke)
fae3cf0ffa ci: Temporarily disable macOS/Windows fuzz step (MarcoFalke)

Pull request description:

  `g_fuzzing` is used inside `Assume` at runtime, causing significant overhead in hot paths. See https://github.com/bitcoin/bitcoin/issues/31178

  One could simply remove the `g_fuzzing` check from the `Assume`, but this would make fuzzing a bit less useful. Also, it would be unclear if `g_fuzzing` adds a runtime overhead in other code paths today or in the future.

  Fix all issues by making `G_FUZZING` equal to the build option `BUILD_FOR_FUZZING`, and for consistency in fuzzing, require it to be set when executing any fuzz target.

  Fixes https://github.com/bitcoin/bitcoin/issues/31178

  Temporarily this drops fuzzing from two CI tasks, but they can be re-added in a follow-up with something like https://github.com/bitcoin/bitcoin/pull/31073

ACKs for top commit:
  marcofleon:
    Tested ACK fafbf8acf4
  davidgumberg:
    I still ACK fafbf8acf4 for fixing the regression measured in #31178.
  ryanofsky:
    Code review ACK fafbf8acf4 but approach -0, because this approach means libraries built for fuzz testing do not function correctly if used in a release, and libraries built for releases are mostly useless for fuzz testing. So I would like to at least consider other solutions to this problem even if we go with this one.
  dergoegge:
    utACK fafbf8acf4

Tree-SHA512: 124fc2e8b35e0c4df414436556a7a0a36cd1bec4b3000b40dcf2ab8c85f32e0610bf7f70d2fd79223d62f3c3665b6c09da21241654c7b9859461b8ca340d5421
2024-11-05 06:05:27 -05:00
Hennadii Stepanov
788c1324f3
build: Unify -logsourcelocations format 2024-11-04 11:30:43 +00:00
MarcoFalke
fafbf8acf4
Make G_FUZZING constexpr, require -DBUILD_FOR_FUZZING=ON to execute a fuzz target 2024-10-31 13:51:37 +01:00
Ava Chow
6251610553
Merge bitcoin/bitcoin#31015: build: have "make test" depend on "make all"
2957ca9611 build: have "make test" depend on "make all" (Cory Fields)

Pull request description:

  See [Upstream docs](https://cmake.org/cmake/help/latest/variable/CMAKE_SKIP_TEST_ALL_DEPENDENCY.html) for specifics.

  Unfortunately, this **seems to have no effect when directly executing `ctest`** :(

  This brings the test -> hack -> test cycle more inline with how it worked with autotools.

  With `CMAKE_SKIP_TEST_ALL_DEPENDENCY` set to FALSE, `make test` will trigger a rebuild, ensuring that test binaries are current before running them.

  To test:
  ```
  cmake -S . -B build
  make -C build -j24
  touch src/primitives/transaction.cpp
  make -C build test ARGS=-j24
  ```

  Without this commit, the above will not rebuild before running tests.

ACKs for top commit:
  tdb3:
    ACK 2957ca9611
  itornaza:
    ACK 2957ca9611
  laanwj:
    ACK 2957ca9611

Tree-SHA512: 46e6d53fd9c28b2f47b34c42ae0b061b01ef7614cdf5ee7d49fb9d3413ca92983d8a996379a9067ac8a8cfc16b230946401e68cf114bd4e3c5c02db2c55ec6bb
2024-10-30 17:11:10 -04:00
merge-script
dc97e7f6db
Merge bitcoin/bitcoin#30903: cmake: Add FindZeroMQ module
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
332655cb52
build: Rename PACKAGE_* variables to CLIENT_*
The use of `PACKAGE_NAME` for the project's variable name is
problematic, as this name is commonly used in CMake's interface
variables. If third-party CMake code handles with scopes improperly,
our `PACKAGE_NAME` variable could end up with an unexpected value.

This change avoids such conflicts by renaming all `PACKAGE_*` variables
to `CLIENT_*`.
2024-10-28 12:35:55 +00:00
merge-script
1c7ca6e64d
Merge bitcoin/bitcoin#31093: Introduce g_fuzzing global for fuzzing checks
9f243cd7fa Introduce `g_fuzzing` global for fuzzing checks (dergoegge)

Pull request description:

  This PR introduces a global `g_fuzzing` that indicates if we are fuzzing.

  If `g_fuzzing` is `true` then:

  * Assume checks are enabled
  * Special fuzzing paths are taken (e.g. pow check is reduced to one bit)

  Closes #30950 #31057

ACKs for top commit:
  maflcko:
    review ACK 9f243cd7fa 🗜
  brunoerg:
    crACK 9f243cd7fa
  marcofleon:
    Tested ACK 9f243cd7fa

Tree-SHA512: 56e4cad0555dec0c565ea5ecc529628ee4f37d20dc660c647fdc6948fbeed8291e6fe290de514bd4c2c7089654d9ce1add607dc9855462828b62be9ee45e4999
2024-10-28 11:05:50 +00:00
Hennadii Stepanov
6b8a74463b
cmake: Add FindZeroMQ module 2024-10-25 18:09:36 +01:00
dergoegge
9f243cd7fa Introduce g_fuzzing global for fuzzing checks 2024-10-25 13:12:55 +01:00
Antoine Poinsot
a9598e5eaa
build: drop miniupnpc dependency 2024-10-24 18:23:31 +02:00
LÅ‘rinc
6c6b2442ed build: Replace MAC_OSX macro with existing __APPLE__
Adopting `__APPLE__` aligns our project with broader industry practices, including those in prominent projects such as the Linux kernel (and even our own code).

See: https://sourceforge.net/p/predef/wiki/OperatingSystems/#macos
2024-10-24 12:29:26 +02:00
Ava Chow
2123c94448
Merge bitcoin/bitcoin#30527: Bump python minimum supported version to 3.10
fa1b139d17 Bump python minimum supported version to 3.10 (MarcoFalke)

Pull request description:

  All supported operating systems ship with python 3.10 (or later), so bumping the minimum should not cause any issues. A bump will allow new code to use new python features.

  For reference:
  * https://packages.debian.org/bookworm/python3
  * https://packages.ubuntu.com/jammy/python3
  * FreeBSD 13/14 ships with 3.11
  * CentOS-like 8/9 ships with 3.11/3.12 (via `appstream`)
  * OpenSuse Tumbleweed ships with all python versions, e.g. https://software.opensuse.org/package/python312-base

  This is for Bitcoin Core 29.0 in 2025 (next year), not the soon upcoming 28.0 this fall.

ACKs for top commit:
  achow101:
    ACK fa1b139d17
  AngusP:
    ACK fa1b139d17
  l0rinc:
    ACK fa1b139d17
  stickies-v:
    ACK fa1b139d17

Tree-SHA512: 910b202ff2374bb21c93e5249a151fd2c8f63759bed5659676b0e467afa6e8e977be797c3fccceca303c82575e11ec236a8d7c5880910e4314b3875b820e7e8a
2024-10-16 08:35:26 -04:00
Cory Fields
2957ca9611 build: have "make test" depend on "make all" 2024-10-01 18:42:14 +00:00
Hennadii Stepanov
deacf3c7cd
cmake: Avoid hardcoding Qt's major version in Find module
This change facilitates future migration to Qt 6.
2024-10-01 13:43:30 +01:00
laanwj
20a18bf6aa build: Drop libnatpmp from build system 2024-09-30 11:37:55 +02:00
glozow
2bf721e76a
Merge bitcoin/bitcoin#30661: fuzz: Test headers pre-sync through p2p
a97f43d63a fuzz: Add harness for p2p headers sync (marcofleon)
a0eaa4749f Add FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION in PoW check (marcofleon)
a3f6f5acd8 build: Automatically define FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION for fuzz builds (marcofleon)
0c02d4b2bd net_processing: Make MAX_HEADERS_RESULTS a PeerManager option (marcofleon)

Pull request description:

  This PR reopens https://github.com/bitcoin/bitcoin/pull/28043. It's a regression fuzz test for https://github.com/bitcoin/bitcoin/pull/26355 and [a couple bugs](ed6cddd98e) that were addressed in https://github.com/bitcoin/bitcoin/pull/25717. This should help us move forward with the [removal of mainnet checkpoints](https://github.com/bitcoin/bitcoin/pull/25725).

  It seems like the main concern in https://github.com/bitcoin/bitcoin/pull/28043 was the global mock function for proof of work. This PR aims to be an improvement by replacing the previous approach with a fuzz build configured using `FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION`. This ensures that the simplified test code will never be in a release binary. If we agree this is the way to go, there are some other places (for future targets) where this method could be used.

  In this target, PoW isn't being tested, so the goal is to bypass the check and let the fuzzer do its thing. In the other harnesses where PoW is actually being fuzzed, `CheckProofOfWork` is now `CheckProofOfWorkImpl`. So, the only change to that function is in the name.

  More about `FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION` can be found at https://llvm.org/docs/LibFuzzer.html#fuzzer-friendly-build-mode and https://github.com/AFLplusplus/AFLplusplus/blob/stable/docs/fuzzing_in_depth.md#d-modifying-the-target.

ACKs for top commit:
  naumenkogs:
    ACK a97f43d63a
  dergoegge:
    reACK a97f43d63a
  instagibbs:
    tested ACK a97f43d63a
  brunoerg:
    ACK a97f43d63a

Tree-SHA512: 60b0bc6aadd8ca4c39db9cbba2da2debaaf68afcb6a8dd75c1ce48ca9e3996948fda8020930b6771a424e0f7c41b0b1068db4aa7dbe517f8fc152f1f712058ad
2024-09-16 13:59:22 -04:00
fanquake
001b1cf010
build: use standard branch-protection for aarch64-linux 2024-09-13 11:26:40 +01:00
merge-script
db8350b0e3
Merge bitcoin/bitcoin#30803: build: Minor build system fixes and amendments
1cc93fe7b4 build: Delete dead code that implements `IF_CHECK_FAILED` option (Hennadii Stepanov)
341ad23809 build: Delete MSVC special case for `BUILD_FOR_FUZZING` option (Hennadii Stepanov)
fdad128b52 build: Stop enabling CMake's CMP0141 policy (Hennadii Stepanov)
b2a6f545b4 doc: Drop `ctest` command from Windows cross-compiling instructions (Hennadii Stepanov)
73b618582d build: Print `CMAKE_CXX_COMPILER_ARG1` in summary (Hennadii Stepanov)
f03c942095 build, test: Add missed log options (Hennadii Stepanov)
6f2cb0eafd doc: Amend comment about ZeroMQ config files (Hennadii Stepanov)

Pull request description:

  This PR addresses the following comments:
  - https://github.com/bitcoin/bitcoin/pull/30454#discussion_r1742342524
  - https://github.com/bitcoin/bitcoin/pull/30454#discussion_r1728692369
  - https://github.com/bitcoin/bitcoin/pull/30454#discussion_r1736110362
  - https://github.com/bitcoin/bitcoin/pull/30454#discussion_r1742931121
  - https://github.com/bitcoin/bitcoin/pull/30454#discussion_r1747723657
  - https://github.com/bitcoin/bitcoin/pull/30454#discussion_r1742328675
  - https://github.com/bitcoin/bitcoin/pull/30454#discussion_r1723106474

ACKs for top commit:
  sipsorcery:
    tACK 1cc93fe7b4 (win11 msvc).
  maflcko:
    re-ACK 1cc93fe7b4

Tree-SHA512: a390797bb4d3b7eb9163653b6c9c324e7a01090f6cdda74df7349a24a5c4a2084e5912878747f56561315afc70cae9adb1c363f47ceb0af96004ea591d25171b
2024-09-12 10:30:06 +01:00
Hennadii Stepanov
0037d53d1a
build: Fix ENABLE_WALLET option
The removed commands were left over from the transition from
autodetection to explicit options. These commands prevented the
`-DENABLE_WALLET=OFF` option from being work properly when building with
depends.
2024-09-10 22:13:09 +01:00
merge-script
94bc3c4cc0
Merge bitcoin/bitcoin#30824: cmake: decouple FORTIFY_SOURCE check from Debug build type
30803a35d5 cmake: decouple FORTIFY_SOURCE check from Debug build type (fanquake)

Pull request description:

  `FORTIFY_SOURCE` should be used if `ENABLE_HARDENING=ON` and optimisations are being used. This should not be coupled to any particular build type, because even if the build type is `Debug`, optimisations might still be in use.

  Fixes: #30800.
  Also somewhat of a followup to https://github.com/bitcoin/bitcoin/pull/30778#discussion_r1742257436.

ACKs for top commit:
  ryanofsky:
    Code review ACK 30803a35d5
  TheCharlatan:
    ACK 30803a35d5

Tree-SHA512: 298f8805a5bb2f1ff54e51ea31324d712c2070cc3eba26561c31001ace4bfa37ae6d18531cbd45e2faf610a0a1b83b420fcde6e329e17f02b021d26563583913
2024-09-09 12:33:57 +01:00
Hennadii Stepanov
341ad23809
build: Delete MSVC special case for BUILD_FOR_FUZZING option 2024-09-08 11:03:32 +01:00
Hennadii Stepanov
fdad128b52
build: Stop enabling CMake's CMP0141 policy
The `CMAKE_MSVC_DEBUG_INFORMATION_FORMAT` variable has not been used
since the merge of https://github.com/hebasto/bitcoin/pull/215 in the
CMake staging branch.
2024-09-06 22:07:31 +01:00
Hennadii Stepanov
6f2cb0eafd
doc: Amend comment about ZeroMQ config files 2024-09-06 21:59:46 +01:00
fanquake
1f054eca4e
cmake: add USE_SOURCE_PERMISSIONS to all configure_file usage
`USE_SOURCE_PERMISSIONS` is the default, so this should not change
behaviour. However, being explicit makes it clear what we are doing.

Related to #30815.

See
https://cmake.org/cmake/help/latest/command/configure_file.html#options.
2024-09-06 10:52:19 +01:00
fanquake
30803a35d5
cmake: decouple FORTIFY_SOURCE check from Debug build type
`FORTIFY_SOURCE` should be used if `ENABLE_HARDENING=ON` and optimisations
are being used. This should not be coupled to any particular build type,
because even if the build type is `Debug`, optimisations might still
be in use.

Fixes: #30800.
2024-09-05 16:34:17 +01:00
marcofleon
a3f6f5acd8 build: Automatically define FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION for fuzz builds 2024-09-02 15:43:33 +01:00
Hennadii Stepanov
66dd1b4e58
build: Drop no longer needed workaround 2024-08-29 14:13:48 +01:00
MarcoFalke
fa1b139d17
Bump python minimum supported version to 3.10 2024-08-28 15:53:07 +02:00
MarcoFalke
fa053ab7c0
build: Add Centos Stream 9 EOL URL
To match the format of the previous section about the Ubuntu 22.04 EOL.
2024-08-28 15:05:52 +02:00
fanquake
680f05ee98
build: fix version number post CMake
CMake was merged after branching-off for 28.x.
2024-08-28 11:08:37 +01:00
Hennadii Stepanov
8b6f1c4353
cmake: Add Coverage and CoverageFuzz scripts 2024-08-16 21:19:12 +01:00
Hennadii Stepanov
65bdbc1ff2
cmake: Add docs build target 2024-08-16 21:19:12 +01:00
Hennadii Stepanov
fb75ebbc33
cmake: Add compiler diagnostic flags 2024-08-16 21:19:12 +01:00
Hennadii Stepanov
747adb6ffe
cmake: Add Maintenance module 2024-08-16 21:19:11 +01:00
Hennadii Stepanov
1f60b30df0
cmake: Add APPEND_{CPP,C,CXX,LD}FLAGS cache variables
The content of those variables is appended to the each target after the
flags added by the build system.
2024-08-16 21:19:11 +01:00
Hennadii Stepanov
973a3b0c5d
cmake: Implement install build target 2024-08-16 21:19:11 +01:00
Hennadii Stepanov
84ac35cfd4
cmake: Add cross-compiling support
To configure CMake for cross-compiling, use
`--toolchain depends/${HOST}/toolchain.cmake` command-line option.
2024-08-16 21:19:11 +01:00
Hennadii Stepanov
90cec4d251
cmake: Add MULTIPROCESS option 2024-08-16 21:19:10 +01:00
Hennadii Stepanov
bb1a450dcb
cmake: Build bitcoin-chainstate executable 2024-08-16 21:19:09 +01:00
Hennadii Stepanov
aed38ea58c
cmake: Build bitcoinkernel library
Co-authored-by: TheCharlatan <seb.kung@gmail.com>
2024-08-16 21:19:09 +01:00
Hennadii Stepanov
975d67369b
cmake: Build test_bitcoin-qt executable 2024-08-16 19:28:59 +01:00
Hennadii Stepanov
10fcc668a3
cmake: Add WITH_DBUS option 2024-08-16 19:27:42 +01:00
Hennadii Stepanov
5bb5a4bc75
cmake: Add libqrencode optional package support 2024-08-16 19:27:42 +01:00
Hennadii Stepanov
57a6e2ef4a
cmake: Build bitcoin-qt executable 2024-08-16 19:27:42 +01:00
Hennadii Stepanov
30f642952c
cmake: Add WERROR option 2024-08-16 19:27:42 +01:00
Hennadii Stepanov
c98d4a4c34
cmake: Add REDUCE_EXPORTS option 2024-08-16 19:27:42 +01:00
Hennadii Stepanov
a01cb6e63f
cmake: Add HARDENING option 2024-08-16 19:27:42 +01:00