bitcoin icon indicating copy to clipboard operation
bitcoin copied to clipboard

CMake-based build system tracking issue

Open hebasto opened this issue 1 year ago • 15 comments

This issue will be updated to reflect the current state of CMake integration.

A brief historical context:

  1. https://github.com/bitcoin/bitcoin/pull/25797 proposed a CMake-based build system with 100% feature parity to the Autotools-based one.
  2. The reviewing process is happening in this repo as suggested in https://github.com/bitcoin/bitcoin/pull/27060#issuecomment-1431798320.
  3. The recent discussion at CoreDev -- https://btctranscripts.com/bitcoin-core-dev-tech/2023-09/cmake/

How reviewing happens:

  1. Pull requests are opened against the https://github.com/hebasto/bitcoin/tree/cmake-staging branch.
  2. After reviewing and merging them, the staging branch get synced with the main branch from this repo.
  3. This loop continues until all commits from https://github.com/bitcoin/bitcoin/pull/25797 get reviewed.

The planned chunks of work:

  • [x] The root CMakeLists.txt and config/bitcoin-config.h files -- https://github.com/hebasto/bitcoin/pull/5
  • [x] Project-wide system introspections; the leveldb build target -- https://github.com/hebasto/bitcoin/pull/6
  • [x] The bitcoind build target -- https://github.com/hebasto/bitcoin/pull/7
  • [x] Cross-compiling support -- https://github.com/hebasto/bitcoin/pull/10
  • [x] Ccache support; libnatpmp, libminiupnpc, libzmq and systemtap-sdt optional packages support -- https://github.com/hebasto/bitcoin/pull/13
  • [x] Utility binaries, wallet functionality, bench_bitcoin and test_bitcoin -- https://github.com/hebasto/bitcoin/pull/15
  • [x] Handling different build configurations -- https://github.com/hebasto/bitcoin/pull/18
  • [x] Hardening, shared libraries -- https://github.com/hebasto/bitcoin/pull/32
  • ~Build libbitcoinconsensus library -- https://github.com/hebasto/bitcoin/pull/41~ See https://github.com/bitcoin/bitcoin/pull/29189
  • [x] Qt stuff -- https://github.com/hebasto/bitcoin/pull/77
  • [x] Guix builds -- https://github.com/hebasto/bitcoin/pull/67
  • [x] Building for fuzzing -- https://github.com/hebasto/bitcoin/pull/43
  • [x] multiprocess support -- https://github.com/hebasto/bitcoin/pull/118
  • [x] libbitcoin-kernel and bitcoin-chainstate -- https://github.com/hebasto/bitcoin/pull/134
  • [x] CI stuff -- https://github.com/hebasto/bitcoin/pull/142
  • ~Building for Android~ See https://github.com/bitcoin/bitcoin/pull/30049

~The current minimum required CMake version is 3.13, which is the system package on Debian 10. Considering the timings of Debian 10 LTS EOL and integrating CMake into this repo, it seems reasonable to bump the minimum supported version up to 3.16, which is the system package on Ubuntu 20.04 LTS.~

  • [x] Bump minimum supported CMake version from 3.13 up to 3.16 -- https://github.com/hebasto/bitcoin/pull/33

To hold the 100% feature parity, the current CMake-based build system implementation can autodetect an optional package and enable it as Autotools-based one does. However, it was suggested to make all optional package opt-in by default. See:

  • https://github.com/hebasto/bitcoin/pull/12#discussion_r1156251913

  • https://github.com/hebasto/bitcoin/pull/12#discussion_r1157570678

  • https://github.com/hebasto/bitcoin/pull/13#discussion_r1164377093

  • [ ] Make all optional package opt-in by default


Autotools vs CMake Feature Parity Table is available here.

To list CMake's options, one might add the -LH option during configuring step.


Updated build docs:

hebasto avatar Oct 06 '23 10:10 hebasto

cc @theuni @TheCharlatan

hebasto avatar Oct 06 '23 10:10 hebasto

The current minimum required CMake version is 3.13, which is the system package on Debian 10. Considering the timings of Debian 10 LTS EOL and integrating CMake into this repo, it seems reasonable to bump the minimum supported version up to 3.16, which is the system package on Ubuntu 20.04 LTS.

Buster Backports has 3.18: https://packages.debian.org/buster-backports/cmake

maflcko avatar Oct 06 '23 11:10 maflcko

Also, on a general note, it would be good to have a "cheat sheet" table for each configure option to list the corresponding cmake option. Maybe also one auto-generated and enforced with a script, to check equality, similar to https://github.com/curl/curl/pull/11964

maflcko avatar Oct 06 '23 11:10 maflcko

Also, on a general note, it would be good to have a "cheat sheet" table for each configure option to list the corresponding cmake option. Maybe also one auto-generated and enforced with a script, to check equality, similar to curl/curl#11964

Thanks! It is available here. It has been added to the top post.

hebasto avatar Oct 06 '23 12:10 hebasto

The next PR to review is https://github.com/hebasto/bitcoin/pull/32.

hebasto avatar Oct 17 '23 22:10 hebasto

The current minimum required CMake version is 3.13, which is the system package on Debian 10. Considering the timings of Debian 10 LTS EOL and integrating CMake into this repo, it seems reasonable to bump the minimum supported version up to 3.16, which is the system package on Ubuntu 20.04 LTS.

Buster Backports has 3.18: packages.debian.org/buster-backports/cmake

The CMake minimum required version has been bumped up to 3.16 in https://github.com/hebasto/bitcoin/pull/33.

hebasto avatar Oct 18 '23 00:10 hebasto

libbitcoin-kernel and bitcoin-chainstate should be on this list too?

ajtowns avatar Oct 30 '23 12:10 ajtowns

libbitcoin-kernel and bitcoin-chainstate should be on this list too?

Sure. Added.

hebasto avatar Oct 30 '23 12:10 hebasto

The new Building Bitcoin Core with Visual Studio doc has been added to the issue description.

hebasto avatar Nov 29 '23 10:11 hebasto

+1

paulocoutinhox avatar Dec 13 '23 09:12 paulocoutinhox

Heads up: here are suggestions regarding the current features that are not expected being ported to the CMake-based build system:

  • https://github.com/bitcoin/bitcoin/pull/29185
  • https://github.com/bitcoin/bitcoin/pull/29189
  • https://github.com/bitcoin/bitcoin/pull/29203

hebasto avatar Jan 08 '24 15:01 hebasto

Next one: Add MULTIPROCESS option.

hebasto avatar Mar 09 '24 17:03 hebasto

What's next?

It would be useful to have a link to build instructions too, not just the cheat cheat (or just add the standard mkdir build, cmake .. incantations to the cheat cheat).

In noticed that in your hebasto/cmake-staging branch the macOS instructions still assume autotools.

Sjors avatar Apr 22 '24 10:04 Sjors

@Sjors

What's next?

It would be useful to have a link to build instructions too, not just the cheat cheat (or just add the standard mkdir build, cmake .. incantations to the cheat cheat).

In noticed that in your hebasto/cmake-staging branch the macOS instructions still assume autotools.

WIP :)

Your testing and reviewing https://github.com/hebasto/bitcoin/pull/163 will be much appreciated!

hebasto avatar Apr 22 '24 10:04 hebasto

The main part of the https://github.com/bitcoin/bitcoin/issues/28607#issue-1929913410 has all checkboxes checked.

Thanks to all reviewers and testers!

Keeping working :)

hebasto avatar May 20 '24 23:05 hebasto