-
Notifications
You must be signed in to change notification settings - Fork 5
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
Rebased cmake-staging
branch (post PRs 17, 18, 19)
#31
Conversation
@vasild @TheCharlatan @theStack @stickies-v @Sjors @sipsorcery @theuni @willcl-ark Ready for extensive testing :) The next meaningful PR with new commits is going to be based on this branch and will be submitted shortly. |
In this comment I'm going to post tested configurations on particular systems.
|
Co-authored-by: Cory Fields <cory-nospam-@coryfields.com> Co-authored-by: Vasil Dimov <vd@FreeBSD.org>
Co-authored-by: Cory Fields <cory-nospam-@coryfields.com>
f875737
to
9301560
Compare
Fixed a couple of compatibility issues found during testing on a range of platforms. |
I found a bug: it fails to find |
To configure CMake for cross-compiling, use `--toolchain depends/${HOST}/share/toolchain.cmake` command-line option.
9301560
to
c20de96
Compare
Another couple of minor issues have been found during testing and fixed. The list of the tested platforms and configurations has been updated as well. |
Fellow reviewers, I'm going to suggest you hardening and shared libraries :) Any other suggestions? And good news! After that, only two steps remain until switching Guix to CMake: Qt and Guix scripts themselves. |
Tested on Intel macOS 13.5.2 (Ventura). The "configure" step took 53 seconds the first time, 34 seconds the second time (after a The warning when UPNC dependencies are not present is a bit verbose, but fine for now:
I don't see a similar warning for USDT. Since UPNC is disabled by default, we should probably not complain if it's missing unless the user asked for it. (update: yesterday I was on battery, which seems to make a 4x difference; updated the numbers with a plugged in device)
I also briefly tested that |
I'm away on holiday until the 2nd, but will pick this up asap when I return. |
Just given this a quick test run, and was also interested in comparing against autotools... One thing I noticed up front was that with
These are the results I got building with various combinations of cmake, cmake + ninja and autotools:
cmake_script#!/usr/bin/env fish
ccache --clear
mkdir build
cd build
set start_time (date +%s)
# configure
# use CMake to generate and clang as compiler
cmake -S .. -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCCACHE=OFF
set configure_time (date +%s)
set configure_interval (math "$configure_time - $start_time")
# build
cmake --build . -j (nproc)
set build_time (date +%s)
set build_interval (math "$build_time - $configure_time")
# test
# use CTest
ctest -j (nproc)
set end_time (date +%s)
set test_interval (math "$end_time - $build_time")
set total_time (math "$end_time - $start_time")
echo "Time taken for configuration: $configure_interval seconds"
echo "Time taken for build: $build_interval seconds"
echo "Time taken for testing: $test_interval seconds"
echo "Total time: $total_time seconds"
cmake_ninja_script#!/usr/bin/env fish
ccache --clear
mkdir build
cd build
set start_time (date +%s)
# configure
# use CMake to generate, specify Ninja as generator and clang as compiler
# cmake -G Ninja -S .. -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCCACHE=OFF
cmake -S .. -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCCACHE=OFF
set configure_time (date +%s)
set configure_interval (math "$configure_time - $start_time")
# build
# ninja -j (nproc)
cmake --build . -j (nproc)
set build_time (date +%s)
set build_interval (math "$build_time - $configure_time")
# test
# use CTest
ctest -j (nproc)
set end_time (date +%s)
set test_interval (math "$end_time - $build_time")
set total_time (math "$end_time - $start_time")
echo "Time taken for configuration: $configure_interval seconds"
echo "Time taken for build: $build_interval seconds"
echo "Time taken for testing: $test_interval seconds"
echo "Total time: $total_time seconds"
autotools_script#!/usr/bin/env fish
ccache --clear
set start_time (date +%s)
# configure
./configure --without-gui --with-incompatible-bdb
set configure_time (date +%s)
set configure_interval (math "$configure_time - $start_time")
# build
make -j(nproc) -C src bitcoind bitcoin-cli bitcoin-tx bitcoin-util bitcoin-wallet test/test_bitcoin
set build_time (date +%s)
set build_interval (math "$build_time - $configure_time")
# test
set -l test_suites addrman_tests allocator_tests amount_tests argsman_tests arith_uint256_tests banman_tests base32_tests base58_tests base64_tests bech32_tests bip32_tests blockchain_tests blockencodings_tests blockfilter_index_tests blockfilter_tests blockmanager_tests bloom_tests bswap_tests checkqueue_tests coins_tests coinstatsindex_tests compilerbug_tests compress_tests crypto_tests cuckoocache_tests dbwrapper_tests denialofservice_tests descriptor_tests flatfile_tests fs_tests getarg_tests hash_tests headers_sync_chainwork_tests httpserver_tests i2p_tests interfaces_tests key_io_tests key_tests logging_tests mempool_tests merkle_tests merkleblock_tests miner_tests miniscript_tests minisketch_tests multisig_tests net_peer_eviction_tests net_tests netbase_tests orphanage_tests pmt_tests policy_fee_tests policyestimator_tests pow_tests prevector_tests raii_event_tests random_tests rbf_tests rest_tests result_tests reverselock_tests rpc_tests sanity_tests scheduler_tests script_p2sh_tests script_parse_tests script_segwit_tests script_standard_tests script_tests scriptnum_tests serfloat_tests serialize_tests settings_tests sighash_tests sigopcount_tests skiplist_tests sock_tests streams_tests sync_tests system_tests timedata_tests torcontrol_tests transaction_tests translation_tests txindex_tests txpackage_tests txreconciliation_tests txrequest_tests txvalidation_tests txvalidationcache_tests uint256_tests util_tests util_threadnames_tests validation_block_tests validation_chainstate_tests validation_chainstatemanager_tests validation_flush_tests validation_tests validationinterface_tests versionbits_tests xoroshiro128plusplus_tests
echo $test_suites | tr ' ' '\n' | parallel -j (nproc) './src/test/test_bitcoin -t {}'
set end_time (date +%s)
set test_interval (math "$end_time - $build_time")
set total_time (math "$end_time - $start_time")
echo "Time taken for configuration: $configure_interval seconds"
echo "Time taken for build: $build_interval seconds"
echo "Time taken for testing: $test_interval seconds"
echo "Total time: $total_time seconds"
I only ran these twice each (and took the best result of two runs). I also used |
Thank you for testing! I'd like to add a few points as follows.
However, Autotools Do we actually need to test code in subtrees? |
Thanks, I missed
Yes this is what I was trying to correct for, as it makes quite some difference, not that I expected there to be any runtime difference in particular. I think I'd agree that subtrees don't need to be run, although I think it'd be good practice to run them after any update to the subtree, if there was a convenient mechanism to do so... FYI I scratched out a basic CMakePresets.json file to make for faster building which is quite nice. I think packaging some presets (besides the defaults?) could be a nice improvement for us? CMakePresets.json{
"version": 6,
"configurePresets": [
{
"name": "debug",
"description": "Debug configuration with verbose output.",
"binaryDir": "${sourceDir}/build/debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_VERBOSE_MAKEFILE": "ON"
}
},
{
"name": "debug-ninja",
"description": "Debug configuration with ninja.",
"binaryDir": "${sourceDir}/build/debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_VERBOSE_MAKEFILE": "ON"
},
"generator": "Ninja"
},
{
"name": "release",
"description": "Release configuration.",
"binaryDir": "${sourceDir}/build/release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
}
],
"buildPresets": [
{
"name": "debug",
"configurePreset": "debug",
"description": "Build using the debug configuration."
},
{
"name": "debug-ninja",
"configurePreset": "debug-ninja",
"description": "Build the debug configuration using ninja."
},
{
"name": "release",
"configurePreset": "release",
"description": "Build using the release configuration."
}
],
"testPresets": [
{
"name": "all",
"description": "Run all tests.",
"configurePreset": "debug"
}
],
"workflowPresets": [
{
"name": "debug-ninja",
"description": "Configure and build all in debug mode using ninja (auto nproc).",
"steps": [
{
"type": "configure",
"name": "debug-ninja"
},
{
"type": "build",
"name": "debug-ninja"
}
]
}
]
} You can use like: # configure preset
cmake --preset debug-ninja
# build preset
cmake --build --preset debug-ninja
# configure and run preset
cmake --workflow --preset debug-ninja It should be possible to also add test steps to the workflow preset, but I haven't done it yet... |
We definitely should not be reverting to building the BDB wallet by default, without the additional flags. |
On macOS (Xcode 15.0), the linker emits warnings:
I'm going to tackle with them in follow-ups. UPD. There is an ongoing discussion in the CMake community: https://discourse.cmake.org/t/avoid-duplicate-linking-to-avoid-xcode-15-warnings/9084. |
Do you reckon we can move further with this rebasing PR and update the staging branch? |
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.
ACK c20de96
Checked the changes with git range-diff
. I did not do a lot of platform testing, will start doing that with the next feature pull request.
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.
ACK c20de96.
Rebase looks fine to me, added one question about the only thing that stood out about the diff. It's not a big deal though.
I'll also wait to do major platform testing until the next PR.
bitcoind.cpp | ||
init/bitcoind.cpp | ||
) | ||
target_link_libraries(bitcoind |
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.
This is PRIVATE in the staging branch, and I don't see any explanation for the change?
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.
Distinguishing PRIVATE
vs PUBLIC
vs INTERFACE
scopes matters only for targets that have dependants.
That is not the case for executable targets. Therefore, target_link_libraries
with a simpler signature is used.
This particular change has done for the sake of consistency with other similar cases.
This branch has been force pushed into the https://github.com/hebasto/bitcoin/tree/cmake-staging. Closing. |
Fixed in #34. |
Fixed in #37. |
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.
tACK with cmake 3.22.1-1ubuntu1.22.04.1 following instructions above for ubuntu.
Ran both unit & functional tests.
Quick manual tests using bitcoind
& bitcoin-cli
.
ab82110 fixup! cmake: Add `systemtap-sdt` optional package support (Hennadii Stepanov) Pull request description: The bug was [noticed](#31 (comment)) during testing the #31. ACKs for top commit: TheCharlatan: ACK ab82110 Tree-SHA512: ca11ecfb0459defbbf29789b5a077600bbb74a4416f8e1cdad3fe722ea62e89d66102e5423bc91a69abdc6c18fa334745075d587dc28ab6521a099255ab90403
This is the cmake-staging branch rebased on the recent bitcoin/master one with squashed "FIXUP" commits.
Additionally addressed #18 (comment).
Previous linearization PRs:
cmake-staging
branch (post PR#15) #16cmake-staging
branch (post PR#13) #14cmake-staging
branch (post PR#10) #11cmake-staging
branch #8A few notes regarding testing this PR on Windows:
bench_bitcoin.exe
fails due to a bug, For more details, please see test, bench: Initialize and terminate use of Winsock properly bitcoin/bitcoin#28486.KNOWN ISSUES:
cmake-staging
branch (post PRs 17, 18, 19) #31 (comment)cmake-staging
branch (post PRs 17, 18, 19) #31 (comment)