From e07a3ede52dfefe1a5977d51f2454f59616b1409 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Fri, 6 Sep 2024 12:19:26 +0100 Subject: [PATCH 1/3] ci: Add missed configuration options to "Win64 native" job --- .github/workflows/ci.yml | 2 +- CMakePresets.json | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 73ead66f21700..fa4b04b5e6345 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -182,7 +182,7 @@ jobs: - name: Generate build system run: | - cmake -B build --preset vs2022-static -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT\scripts\buildsystems\vcpkg.cmake" -DBUILD_BENCH=ON -DBUILD_FUZZ_BINARY=ON -DWERROR=ON + cmake -B build --preset vs2022-static -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT\scripts\buildsystems\vcpkg.cmake" -DBUILD_GUI=ON -DWITH_BDB=ON -DWITH_MINIUPNPC=ON -DWITH_ZMQ=ON -DBUILD_BENCH=ON -DBUILD_FUZZ_BINARY=ON -DWERROR=ON - name: Save vcpkg binary cache uses: actions/cache/save@v4 diff --git a/CMakePresets.json b/CMakePresets.json index a5f2ce79191fe..018906c66b65c 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -16,8 +16,7 @@ "cacheVariables": { "VCPKG_TARGET_TRIPLET": "x64-windows", "BUILD_GUI": "ON", - "WITH_QRENCODE": "OFF", - "WITH_NATPMP": "OFF" + "WITH_QRENCODE": "OFF" } }, { @@ -34,8 +33,7 @@ "cacheVariables": { "VCPKG_TARGET_TRIPLET": "x64-windows-static", "BUILD_GUI": "ON", - "WITH_QRENCODE": "OFF", - "WITH_NATPMP": "OFF" + "WITH_QRENCODE": "OFF" } } ] From c07fdd654616e384ad4e686d75b3a979c1921d27 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Mon, 2 Sep 2024 11:07:19 +0100 Subject: [PATCH 2/3] fuzz: Don't compile BDB-specific code on MSVC in `wallet_bdb_parser.cpp` --- src/wallet/test/fuzz/wallet_bdb_parser.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/wallet/test/fuzz/wallet_bdb_parser.cpp b/src/wallet/test/fuzz/wallet_bdb_parser.cpp index 6fbd695fc5ee2..5ec24faede60c 100644 --- a/src/wallet/test/fuzz/wallet_bdb_parser.cpp +++ b/src/wallet/test/fuzz/wallet_bdb_parser.cpp @@ -18,6 +18,13 @@ #include #include +// There is an inconsistency in BDB on Windows. +// See: https://github.com/bitcoin/bitcoin/pull/26606#issuecomment-2322763212 +#undef USE_BDB_NON_MSVC +#if defined(USE_BDB) && !defined(_MSC_VER) +#define USE_BDB_NON_MSVC +#endif + using wallet::DatabaseOptions; using wallet::DatabaseStatus; @@ -50,7 +57,7 @@ FUZZ_TARGET(wallet_bdb_parser, .init = initialize_wallet_bdb_parser) } g_setup->m_args.ForceSetArg("-dumpfile", fs::PathToString(bdb_ro_dumpfile)); -#ifdef USE_BDB +#ifdef USE_BDB_NON_MSVC bool bdb_ro_err = false; bool bdb_ro_strict_err = false; #endif @@ -58,7 +65,7 @@ FUZZ_TARGET(wallet_bdb_parser, .init = initialize_wallet_bdb_parser) if (db) { assert(DumpWallet(g_setup->m_args, *db, error)); } else { -#ifdef USE_BDB +#ifdef USE_BDB_NON_MSVC bdb_ro_err = true; #endif if (error.original.starts_with("AutoFile::ignore: end of file") || @@ -90,7 +97,7 @@ FUZZ_TARGET(wallet_bdb_parser, .init = initialize_wallet_bdb_parser) error.original == "Subdatabase has an unexpected name" || error.original == "Unsupported BDB data file version number" || error.original == "BDB builtin encryption is not supported") { -#ifdef USE_BDB +#ifdef USE_BDB_NON_MSVC bdb_ro_strict_err = true; #endif } else { @@ -98,7 +105,7 @@ FUZZ_TARGET(wallet_bdb_parser, .init = initialize_wallet_bdb_parser) } } -#ifdef USE_BDB +#ifdef USE_BDB_NON_MSVC // Try opening with BDB fs::path bdb_dumpfile{g_setup->m_args.GetDataDirNet() / "fuzzed_dumpfile_bdb.dump"}; if (fs::exists(bdb_dumpfile)) { // Writing into an existing dump file will throw an exception From ee22bf55e39e4a40c31465e8ef2663eb7fefc783 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Fri, 6 Sep 2024 12:10:25 +0100 Subject: [PATCH 3/3] doc: Update and amend MSVC build guide --- doc/build-windows-msvc.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/doc/build-windows-msvc.md b/doc/build-windows-msvc.md index 1daca1f93e258..c894c26d83950 100644 --- a/doc/build-windows-msvc.md +++ b/doc/build-windows-msvc.md @@ -42,27 +42,31 @@ Available presets can be listed as follows: cmake --list-presets ``` +By default, all presets: +- Set `BUILD_GUI` to `ON`. +- Set `WITH_QRENCODE` to `OFF`, due to known build issues when using vcpkg's `libqrencode` package. + ## Building CMake will put the resulting object files, libraries, and executables into a dedicated build directory. In the following instructions, the "Debug" configuration can be specified instead of the "Release" one. -### 4. Building with Dynamic Linking with GUI +### 4. Building with Static Linking with GUI ``` -cmake -B build --preset vs2022 -DBUILD_GUI=ON # It might take a while if the vcpkg binary cache is unpopulated or invalidated. +cmake -B build --preset vs2022-static # It might take a while if the vcpkg binary cache is unpopulated or invalidated. cmake --build build --config Release # Use "-j N" for N parallel jobs. ctest --test-dir build --build-config Release # Use "-j N" for N parallel tests. Some tests are disabled if Python 3 is not available. +cmake --install build --config Release # Optional. ``` -### 5. Building with Static Linking without GUI +### 5. Building with Dynamic Linking without GUI ``` -cmake -B build --preset vs2022-static # It might take a while if the vcpkg binary cache is unpopulated or invalidated. +cmake -B build --preset vs2022 -DBUILD_GUI=OFF # It might take a while if the vcpkg binary cache is unpopulated or invalidated. cmake --build build --config Release # Use "-j N" for N parallel jobs. ctest --test-dir build --build-config Release # Use "-j N" for N parallel tests. Some tests are disabled if Python 3 is not available. -cmake --install build --config Release # Optional. ``` ## Performance Notes