-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to explain or list what the other manifest features are?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Available features are listed in the <root>\vcpkg.json
file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Added.
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 |
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_msvc
directory.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.