Skip to content

Conversation

dongcarl
Copy link
Contributor

@dongcarl dongcarl commented Aug 18, 2020

This PR improves the robustness of our boost package in depends, most notably:

  1. Bumps boost from 1.70.0 to 1.71.0, because 1.71.0:
    1. Removes the need to patch out the unused variable.
      sed -i.old "s/int ret_sig = 0;//" boost/process/detail/posix/wait_group.hpp && \

      Upstream boost patched it out in boostorg/process@d20b64c, which was first included in the 1.71.0 release
    2. Comes packaged with a version of b2 which allows us to override its CXX and CXXFLAGS. Previously, choosing a toolset while building b2 such as clang or gcc would force b2's build system to invoke the compiler as a bare, hardcoded clang or gcc. However, our depends build system often want to customize this behaviour, adding extra flags or invoking the compiler by an alternate name. So this is useful.
      1. Commit where CXX was introduced: boostorg/build@374f965
      2. Commit where CXXFLAGS was introduced: boostorg/build@5d49abc
  2. The boost package is now split into native_b2 and boost, better representing what actually happens.
    • In our depends build system, we have a distinction between native packages and non-native packages. The output of native packages are meant to be used on the machine that's performing the build, and the output of non-native packages are meant to be used on/for the machine that will ultimately be running bitcoin. Previously, boost existed in depends as a non-native package, but that's partly inaccurate because the ./bootstrap.sh invocation in its $(package)_config_cmds stage actually produced a binary called b2, which is run on the machine that's performing the build. This means that b2 is a native package which is being built in an environment set up for the non-native package boost. This reveals a hidden unintended behavior in our depends build system: for linux->darwin cross builds, we use gcc for native packages, and clang for non-native packages. But b2 was actually being built using clang, since it was being built in an environment set up for non-native packages.

theuni you might be interested in taking a look

@Empact
Copy link
Contributor

Empact commented Aug 19, 2020

Could improve the documentation of these changes by including why each change was made, in addition to what was done. https://chris.beams.io/posts/git-commit/#why-not-how

Speaking as someone who is only so familiar with the build system who would like to learn more.

Copy link
Member

@fanquake fanquake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK. Looks like a good cleanup. Bit of a bummer (for slower systems) that we'll have to extract Boost twice now. Do you think using bcp is on the roadmap after this?

@@ -9,7 +9,7 @@ define $(package)_set_vars
$(package)_config_opts_release=variant=release
$(package)_config_opts_debug=variant=debug
$(package)_config_opts=--layout=tagged --build-type=complete --user-config=user-config.jam
$(package)_config_opts+=threading=multi link=static -sNO_BZIP2=1 -sNO_ZLIB=1
$(package)_config_opts+=threading=multi link=static -sNO_COMPRESSION=1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though this option shouldn't affect us, given we don't build iostreams, this is a nice simplification. Easier to pass sNO_COMPRESSION and not worry about new types being added in future, as we were already missing NO_LZMA and NO_ZSTD.

@DrahtBot
Copy link
Contributor

DrahtBot commented Aug 20, 2020

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@dongcarl
Copy link
Contributor Author

@Empact I updated the description with more justification and context, please let me know if anything's unclear!

@theuni
Copy link
Member

theuni commented Aug 27, 2020

Concept ACK.

Bit of a bummer (for slower systems) that we'll have to extract Boost twice now. Do you think using bcp is on the roadmap after this?

Very true, I had completely forgotten about this overhead when we discussed this. +1 for looking into reducing the size of the contents of the tarballs.

Also, it's worth investigating switching from the boost .tar.bz2 to the .tar.gz. Maybe that can make up for some of the slowdown at the cost of a size increase?

@hebasto
Copy link
Member

hebasto commented Sep 16, 2020

Concept ACK. It would be nice to document native_* packages usage in packages.md (maybe in a follow up pull).

maflcko pushed a commit that referenced this pull request Sep 23, 2020
7a89f2e build: Fix target name (Hennadii Stepanov)

Pull request description:

  It seems like a typo :)
  This PR:
  - fixes errors when building a package in depends for `HOST=x86_64-apple-darwin16` (fix #19799)
  - is a correct alternative to d25e0e3 from #19764

ACKs for top commit:
  icota:
    tACK 7a89f2e
  dongcarl:
    Code Review ACK 7a89f2e
  theuni:
    ACK 7a89f2e.

Tree-SHA512: a0bcbc6805d3450e201476ef1e22e0eb53903db1586c5515314c19afd337bded887e56de0fbe62feaf359b2de15dbccd49a44f1a8b566b4c64f5ae3d94a2ab6d
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Sep 23, 2020
7a89f2e build: Fix target name (Hennadii Stepanov)

Pull request description:

  It seems like a typo :)
  This PR:
  - fixes errors when building a package in depends for `HOST=x86_64-apple-darwin16` (fix bitcoin#19799)
  - is a correct alternative to bitcoin@d25e0e3 from bitcoin#19764

ACKs for top commit:
  icota:
    tACK bitcoin@7a89f2e
  dongcarl:
    Code Review ACK 7a89f2e
  theuni:
    ACK 7a89f2e.

Tree-SHA512: a0bcbc6805d3450e201476ef1e22e0eb53903db1586c5515314c19afd337bded887e56de0fbe62feaf359b2de15dbccd49a44f1a8b566b4c64f5ae3d94a2ab6d
@dongcarl dongcarl force-pushed the 2020-08-boost-build-pickup branch from 8c38443 to 68d53e8 Compare September 23, 2020 19:11
@dongcarl
Copy link
Contributor Author

Rebased over #19868 and dropped my solution.

@practicalswift
Copy link
Contributor

Concept ACK

Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basic code review ACK 68d53e8. I was looking at this and didn't dig into all the details of all the changes, but did think they all look safe and sane and were well motivated.

I guess most ideally the boost build system would accept different build and host toolchains in its configuration, and use the right tools for the right things, so everything could be built in one package. But I guess its bootstrap script isn't really written to work this way, so the separate native b2 package makes sense and is a reasonable way to get the right compiler used.

@bitcoin bitcoin deleted a comment from DrahtBot Sep 26, 2020
@bitcoin bitcoin deleted a comment from DrahtBot Sep 26, 2020
Copy link
Member

@fanquake fanquake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, great PR description 👍 . However in 6cba51e you've forgotten to remove the unused_var_in_process.patch file.

@dongcarl dongcarl force-pushed the 2020-08-boost-build-pickup branch from 68d53e8 to 207f820 Compare November 6, 2020 15:35
@dongcarl dongcarl force-pushed the 2020-08-boost-build-pickup branch from 207f820 to f190343 Compare November 23, 2020 20:51
@dongcarl
Copy link
Contributor Author

Pushed a pure-rebase. Still ready for merge!

@laanwj
Copy link
Member

laanwj commented Nov 24, 2020

Concept and code review ACK f190343

@laanwj laanwj merged commit 7ebbee5 into bitcoin:master Nov 24, 2020
laanwj added a commit to laanwj/bitcoin that referenced this pull request Nov 24, 2020
maflcko pushed a commit to maflcko/bitcoin-core that referenced this pull request Nov 24, 2020
0918eb4 doc: Document current boost dependency as 1.71.0 (Wladimir J. van der Laan)

Pull request description:

  This was forgotten in bitcoin#19764.

ACKs for top commit:
  practicalswift:
    ACK 0918eb4
  fanquake:
    ACK 0918eb4

Tree-SHA512: bd4a39b96b95adeb725767b283f4cf04d9f0d6ac352e7dc67f88cf575b00a24c6d3f4bf51fe362e0c89aeebb6c7e8e9add9f9f17e843121efd30f8edef6128bc
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Nov 24, 2020
…bump + cleanup

f190343 depends: boost: Specify cflags+compileflags (Carl Dong)
b2328b7 depends: boost: Remove unnecessary _archiver_ (Carl Dong)
ab9e047 depends: boost: Cleanup toolset selection (Carl Dong)
86002e7 depends: boost: Cleanup architecture/address-model (Carl Dong)
d7048fa depends: boost: Disable all compression (Carl Dong)
9cf2ee5 depends: boost: Split into non-/native packages (Carl Dong)
a57b498 depends: boost: Bump to 1.71.0 (Carl Dong)
800655f depends: boost: Refer to version in URL (Carl Dong)

Pull request description:

  This PR improves the robustness of our boost package in depends, most notably:
  1. Bumps boost from `1.70.0` to `1.71.0`, because `1.71.0`:
  	1. Removes the need to patch out the unused variable.
  		https://github.com/bitcoin/bitcoin/blob/f8462a6d2794be728cf8550f45d19a354aae59cf/depends/packages/boost.mk#L36
  		Upstream boost patched it out in boostorg/process@d20b64c, which was first included in the `1.71.0` release
  	2. Comes packaged with a version of `b2` which allows us to override its `CXX` and `CXXFLAGS`. Previously, choosing a toolset while building `b2` such as `clang` or `gcc` would force `b2`'s build system to invoke the compiler as a bare, hardcoded `clang` or `gcc`. However, our `depends` build system often want to customize this behaviour, adding extra flags or invoking the compiler by an alternate name. So this is useful.
  		1. Commit where `CXX` was introduced: boostorg/build@374f965
  		2. Commit where `CXXFLAGS` was introduced: boostorg/build@5d49abc
  2. The boost package is now split into `native_b2` and `boost`, better representing what actually happens.
  	- In our `depends` build system, we have a distinction between `native` packages and non-`native` packages. The output of `native` packages are meant to be used on the machine that's performing the build, and the output of non-`native` packages are meant to be used on/for the machine that will ultimately be running bitcoin. Previously, `boost` existed in `depends` as a non-`native` package, but that's partly inaccurate because the `./bootstrap.sh` invocation in its `$(package)_config_cmds` stage actually produced a binary called `b2`, which is run on the machine that's performing the build. This means that `b2` is a `native` package which is being built in an environment set up for the non-`native` package `boost`. This reveals a hidden unintended behavior in our `depends` build system: for linux->darwin cross builds, we use `gcc` for `native` packages, and `clang` for non-`native` packages. But `b2` was actually being built using `clang`, since it was being built in an environment set up for non-`native` packages.

  theuni you might be interested in taking a look

ACKs for top commit:
  laanwj:
    Concept and code review ACK f190343

Tree-SHA512: f8b728a34da4f0a9a985a819a5762f2fc2689ea24c7eba1d24d26dfbd4c59f202227c699b0a4069dab10b6329cf9f4c6dd95082685776ee43dd5f7b659acdef1
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Nov 24, 2020
0918eb4 doc: Document current boost dependency as 1.71.0 (Wladimir J. van der Laan)

Pull request description:

  This was forgotten in bitcoin#19764.

ACKs for top commit:
  practicalswift:
    ACK 0918eb4
  fanquake:
    ACK 0918eb4

Tree-SHA512: bd4a39b96b95adeb725767b283f4cf04d9f0d6ac352e7dc67f88cf575b00a24c6d3f4bf51fe362e0c89aeebb6c7e8e9add9f9f17e843121efd30f8edef6128bc
zkbot added a commit to zcash/zcash that referenced this pull request Jan 15, 2021
Boost build backports

Cherry-picked from the following upstream PRs:
- bitcoin/bitcoin#17087
- bitcoin/bitcoin#17231
- bitcoin/bitcoin#17928
- bitcoin/bitcoin#18820
- bitcoin/bitcoin#19764

Kudos to @dongcarl for all the excellent upstream depends system hackery!
furszy added a commit to PIVX-Project/PIVX that referenced this pull request May 9, 2021
de7766c Build: Update Boost download URL (Fuzzbawls)
7be66c9 Doc: document updated boost version in dependencies.md (Fuzzbawls)
bcb77b6 depends: boost: Specify cflags+compileflags (Carl Dong)
b8f8574 depends: boost: Remove unnecessary _archiver_ (Carl Dong)
29fdbd9 depends: boost: Cleanup toolset selection (Carl Dong)
28393b6 depends: boost: Cleanup architecture/address-model (Carl Dong)
6af3ffa depends: boost: Disable all compression (Carl Dong)
0f09788 depends: boost: Split into non-/native packages (Carl Dong)
de97b06 depends: boost: Bump to 1.71.0 (Carl Dong)
19f474b depends: boost: Refer to version in URL (Carl Dong)
7d4257c depends: Propagate only specific CLI variables to sub-makes (Carl Dong)
fcbf870 depends: boost: Use clang toolset if clang in CXX (Carl Dong)
aad5009 depends: boost: Split target-os from toolset (Carl Dong)
fae749b depends: boost: Specify toolset to bootstrap.sh (Carl Dong)
c2bfedb depends: Propagate well-known vars into depends (Carl Dong)
091ae4a depends: Consistent use of package variable (Peter Bushnell)
635bdc1 depends: fix boost mac cross build with clang 9+ (Cory Fields)
d796365 build: Add variable printing target to Makefiles (Carl Dong)

Pull request description:

  Backports the following upstream PRs to clean up and update the Boost dependency

  - bitcoin#17087
  - bitcoin#17231
  - bitcoin#17928
  - bitcoin#18820
  - bitcoin#19764

ACKs for top commit:
  random-zebra:
    ACK de7766c
  furszy:
    no code changes after rebase, utACK de7766c and merging..

Tree-SHA512: 4abe88718892bce40a2df023e99a26a16ce3c5d470f55e70d6c6cca117ee8b8bb29968be6d40873bc9ece3f9df769bea248cbb38c1c5c2f318016702533f2736
kwvg added a commit to kwvg/dash that referenced this pull request Aug 22, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Aug 22, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Aug 27, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Aug 27, 2021
The bare minimum necessary change for bitcoin#19764. Marked as "partial merge" for attribution only, otherwise considered unmerged
PastaPastaPasta added a commit to dashpay/dash that referenced this pull request Aug 31, 2021
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Sep 17, 2021
7a89f2e build: Fix target name (Hennadii Stepanov)

Pull request description:

  It seems like a typo :)
  This PR:
  - fixes errors when building a package in depends for `HOST=x86_64-apple-darwin16` (fix bitcoin#19799)
  - is a correct alternative to bitcoin@d25e0e3 from bitcoin#19764

ACKs for top commit:
  icota:
    tACK bitcoin@7a89f2e
  dongcarl:
    Code Review ACK 7a89f2e
  theuni:
    ACK 7a89f2e.

Tree-SHA512: a0bcbc6805d3450e201476ef1e22e0eb53903db1586c5515314c19afd337bded887e56de0fbe62feaf359b2de15dbccd49a44f1a8b566b4c64f5ae3d94a2ab6d
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Sep 24, 2021
7a89f2e build: Fix target name (Hennadii Stepanov)

Pull request description:

  It seems like a typo :)
  This PR:
  - fixes errors when building a package in depends for `HOST=x86_64-apple-darwin16` (fix bitcoin#19799)
  - is a correct alternative to bitcoin@d25e0e3 from bitcoin#19764

ACKs for top commit:
  icota:
    tACK bitcoin@7a89f2e
  dongcarl:
    Code Review ACK 7a89f2e
  theuni:
    ACK 7a89f2e.

Tree-SHA512: a0bcbc6805d3450e201476ef1e22e0eb53903db1586c5515314c19afd337bded887e56de0fbe62feaf359b2de15dbccd49a44f1a8b566b4c64f5ae3d94a2ab6d
kwvg pushed a commit to kwvg/dash that referenced this pull request Oct 12, 2021
7a89f2e build: Fix target name (Hennadii Stepanov)

Pull request description:

  It seems like a typo :)
  This PR:
  - fixes errors when building a package in depends for `HOST=x86_64-apple-darwin16` (fix bitcoin#19799)
  - is a correct alternative to bitcoin@d25e0e3 from bitcoin#19764

ACKs for top commit:
  icota:
    tACK bitcoin@7a89f2e
  dongcarl:
    Code Review ACK 7a89f2e
  theuni:
    ACK 7a89f2e.

Tree-SHA512: a0bcbc6805d3450e201476ef1e22e0eb53903db1586c5515314c19afd337bded887e56de0fbe62feaf359b2de15dbccd49a44f1a8b566b4c64f5ae3d94a2ab6d
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants