cmake: Remove legacy MSVC build system#117
Conversation
|
Friendly ping @sipsorcery @pablomartin4btc @m3dwards @TheCharlatan @vasild :) Also cc @EthanHeilman regarding the base address randomization feature. |
|
--disable-hardening doesn't work anymore? Is this just a windows think or is it broken on linux as well? I ran into issues with this on OSX: |
On the master branch, while The new CMake-based build system preserves that behaviour. |
So if we wanted the ability to disable windows base address randomization we would need to add it as a CMake flag? |
Yes. Something like that: I'm still curios about the use cases for binaries (1) with disabled ASLR and (2) with disabled PIE. Is it worth considering adding dedicated build configuration options for such cases? |
My main usecase is that bitcoin uses process memory as a source for randomness for it's RNG. In measuring and testing the randomnesss provided by the RNG, I turn all this off to make it is easier to isolate randomness problems. This can also be useful when attempting to replicate heisenbugs. That's a very boutique use case though,
I'll probably add them back in in a PR when restarting the RNG measurement project. It would save me some time if someone else readded them, but given that as far as I am aware I am the primary user of this feature it seems a little unfair to ask someone else to do the work. |
458c1e6 to
8eb45ac
Compare
|
Rebased. |
Amend "displayName" fields.
|
Rebased. |
|
utACK (winx64) 9c0bf9b. |
| cmake -S .. --preset vs2022-static # It might take a while if the vcpkg binary cache is unpopulated or invalidated | ||
| cmake --build . --config Release | ||
| ctest --build-config Release | ||
| cmake --install . --config Release # Optional |
There was a problem hiding this comment.
Is there a reason why install is listed as part of the static linking build and not the dynamic linking build?
There was a problem hiding this comment.
For dynamic linking build, dependency DLLs must be located in the same folder as a binary. That is not implemented for now.
| One can skip vcpkg manifest default features to speedup the configuration step. | ||
| For example, the following invocation will skip all features except for "wallet" and "tests" and their dependencies: | ||
| ``` | ||
| cmake -S .. --preset vs2022 -DVCPKG_MANIFEST_NO_DEFAULT_FEATURES=ON -DVCPKG_MANIFEST_FEATURES="wallet;tests" |
There was a problem hiding this comment.
Is there a way to explain or list what the other manifest features are?
There was a problem hiding this comment.
The features are listed in the <root>\vcpkg.json file. What wording would you suggest to list them in the docs?
There was a problem hiding this comment.
Available features are listed in the <root>\vcpkg.json file.
|
Should the guide mention ccache? What about only building release versions of dependencies with: Add-Content -Path "$env:VCPKG_ROOT\triplets\x64-windows.cmake" -Value "set(VCPKG_BUILD_TYPE release)"
Add-Content -Path "$env:VCPKG_ROOT\triplets\${{ matrix.conf.triplet }}.cmake" -Value "set(VCPKG_BUILD_TYPE release)" |
It is mentioned in https://github.com/bitcoin/bitcoin/blob/master/doc/productivity.md. No other platform-specific build doc mentions it explicitly.
We use this optimization for the CI to speed up the build. However, on the user's machine this vcpkg patching could break other software builds. |
|
I've found that when I change configuration I have to delete the build dir and start again with a fresh one. I assume this is normal and if it is, should this be mentioned? |
These words confuse me a bit, as the MSVC generator is multi-configuration. Could you be more specific please? |
|
If I run: mkdir build
cd build
cmake -S .. --preset vs2022-static
cmake -S .. --preset vs2022 -DVCPKG_MANIFEST_NO_DEFAULT_FEATURES=ON -DVCPKG_MANIFEST_FEATURES="wallet;tests"I get: -- Configuring incomplete, errors occurred!So moving between static and dynamic presets for example. If we think that's it's perfectly obvious that this would be expected then no probs. I did expect it as it's common with autotools / make when running the configure step again without a distclean. |
|
ACK 8d3bb2b Tested with PowerShell on Windows 11 but I want to give the caveat that these steps were not run on a clean install of windows. I do intend to wipe and reinstall my windows box soon and so will go through the steps again. |
Right. When using CMake 3.24 and newer, which is usually the case on Windows, the |
67dc752 cmake, test: Disable tests instead of ignoring them (Hennadii Stepanov) bb9157d cmake, refactor: Switch to `Python3::Interpreter` imported target (Hennadii Stepanov) Pull request description: This PR: 1. Switches to a modern CMake approach by using the `Python3::Interpreter` imported target, which is more robust than using variables. 2. Disables the `util_rpcauth_test` test explicitly instead of silently ignoring it. A build and test log for the case when Python is unavailable is provided below: ``` $ cmake -B build $ cmake --build build -j 16 $ ctest --test-dir build -j $(nproc) -R "^util" Internal ctest changing into directory: /bitcoin/build Test project /bitcoin/build Start 115: util_tests Start 117: util_trace_tests Start 114: util_string_tests Start 116: util_threadnames_tests Start 1: util_rpcauth_test 1/5 Test #1: util_rpcauth_test ................***Not Run (Disabled) 0.00 sec 2/5 Test #114: util_string_tests ................ Passed 0.11 sec 3/5 Test #117: util_trace_tests ................. Passed 0.11 sec 4/5 Test #116: util_threadnames_tests ........... Passed 0.11 sec 5/5 Test #115: util_tests ....................... Passed 0.13 sec 100% tests passed, 0 tests failed out of 4 Total Test time (real) = 0.13 sec The following tests did not run: 1 - util_rpcauth_test (Disabled) ``` ACKs for top commit: purpleKarrot: ACK 67dc752 janb84: tACK 67dc752 Tree-SHA512: 5fc7ebe31ac03f4b8a53ecfcfc1cace0f647a1d2c989651988edae96bdfbbe2dee171714e57cb028e65ead1bb40806a82d9821746451dbf005538601fd33ea88
At this stage, the new CMake-based build system offers a comprehensive set of features, surpassing those of the legacy build system located in the
build_msvcdirectory.As part of the transition to the new build system, the legacy MSVC build system has been removed.
Additionally, a new "Windows / MSVC Build Guide" has been introduced, based on https://gist.github.com/hebasto/32c77c0cd592d13685437271ac6b79f6. Notably, the guide lacks information regarding the disabling of base address randomization (see bitcoin#21045). Even with
-DHARDENING=OFF, this feature remains enabled by default.