Skip to content

Conversation

theuni
Copy link
Member

@theuni theuni commented May 28, 2014

I decided to take care of this before handling the libsecp256k1 changes, because this should end up making future work much less tangled.

The point of this work is to avoid having separate logical builds for each directory. That causes complications because one target cannot know about changes in another directory. For example, if bitcoin/net.h changes, the qt target does not know that, and will continue to happily build/link against the stale intermediate libraries.

With a non-recursive system, however, each target is aware of all of its own components. In the example above, changing src/net.h would force a rebuild of all files that include that header, regardless of where they're located. Non-recursive also means that lots of spaghetti can go away, because we can include any dependency anywhere we want.

It also helps with parallelism because multiple targets can be compiling at once. A quick test shows that a fully ccached make -j8 of src/ (eliminating compiler time) is reduced from 20.4 sec to 13.7 sec. A make -j8 without ccache is reduced from 73.6 sec to 62.1.

Good/Simple description of the difference here: https://www.flameeyes.eu/autotools-mythbuster/automake/nonrecursive.html

Build logic moves from individual Makefile.am's to include files, which the main src/Makefile.am includes. This avoids having to manage a gigantic single Makefile.

Stub Makefiles have been added to imitate previous behavior, for those who may have gotten used to doing a make or clean in specific subdirs. These can be expanded as desired, they're very simple for now.

Most deviations from the original Makefile.am's involve eliminating $(BUILT_SOURCES), so that generated files are created as late as possible, and without requiring a vanilla 'make' (without a target) as they do currently.

@theuni
Copy link
Member Author

theuni commented May 28, 2014

@jgarzik You originally nack'd non-recursive, but I think your opinion has shifted since. You've got right of first refusal :)

@gavinandresen
Copy link
Contributor

Untested ACK.

Build-system changes like this shouldn't require extensive review; if the pull-tester is happy, I say pull it and do the final changes/tweaks as future pull requests.

@laanwj
Copy link
Member

laanwj commented May 28, 2014

Build works fine for me.

I tried to reproduce #3955:

$ touch src/checkpoints.cpp
$ make src/bitcoind
make: `src/bitcoind' is up to date.

Seems it doesn't detect the change in another directory even with the non-recursive make.

@theuni
Copy link
Member Author

theuni commented May 28, 2014

The top-level is disconnected from the others, that hasn't changed. You're looking for: make -C src bitcoind.

I could move it all up a dir so that would work, but I'm not sure there's much to gain from that?

@sipa
Copy link
Member

sipa commented May 28, 2014

Don't care much, but changes look fine to me.

@theuni theuni closed this May 28, 2014
@theuni theuni reopened this May 28, 2014
@theuni
Copy link
Member Author

theuni commented May 28, 2014

Whoops, didn't mean to close.

@laanwj
Copy link
Member

laanwj commented May 29, 2014

@theuni I don't mind, but I'd like to be able to close that issue and others that claim 'the build system is broken!&!!'. Thanks for explaining.

ACK in any case as this speeds up the build.

@jgarzik
Copy link
Contributor

jgarzik commented Jun 4, 2014

No objection if others want it.

theuni added 8 commits June 5, 2014 16:05
Build logic moves from individual Makefile.am's to include files, which
the main src/Makefile.am includes. This avoids having to manage a gigantic
single Makefile.

TODO: Move the rules from the old Makefile.include to where they actually
belong and nuke the old file.
Rules and targets no longer need to be shared between subdirectories, so
this is no longer needed.
- Some file generation was still noisy, silence it.
- AM_V_GEN is used rather than @ so that 'make V=1' works as intended
- Cut down on file copies and moves when using sed, use pipes instead
- Avoid the use of top_ and abs_ dirs where possible
Using them has the side effect of confusing the dependency-tracking logic.
Now that the build is non-recursive, adding to AM_CPPFLAGS means adding to
_all_ cppflags.

Logical groups of includes have been added instead, and are used individually
by various targets.
@theuni theuni changed the title RFC: Non-recursive make Non-recursive make Jun 5, 2014
@theuni
Copy link
Member Author

theuni commented Jun 5, 2014

Pushed a cleaned up and rebased version with some additional changes. On @gavinandresen's advise, I'm not going to bother breaking the move from .am's to .include's into smaller chunks for the sake of easier review. It's a pretty straightforward change.

Now that we're non-recursive, things like AM_CPPFLAGS become global to all builds. I've removed our usage of those globals in favor of setting the flags per-target.

Also (mainly to help in my testing of the changes) I've silenced the qt build spew. Now, the usual make V=1 shows the full output as would be expected.

As discussed with @laanwj yesterday: This does not address the issue in #3955, but it doesn't regress it eaither. That can be addressed as a follow-up.

I've removed the RFC description as (if pull-tester is happy) I believe this is now merge-ready.

@BitcoinPullTester
Copy link

Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/efe6888407186b8a468f357fa7084c0a8c3de503 for binaries and test log.
This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/
Contact BlueMatt on freenode if something looks broken.

@laanwj
Copy link
Member

laanwj commented Jun 6, 2014

Pulltester is happy. I've done some testing as well

  • Normal build: OK
  • Disablewallet build: OK
  • -DDEBUG_LOCKORDER build: OK

Note that before pulling you need to remove the old generated Makefles, as otherwise you get a file collision error.

rm src/test/Makefile src/qt/Makefile src/qt/test/Makefile

(or alternatively, git clean -f -x -d to return to a clean working directory)

@laanwj laanwj merged commit efe6888 into bitcoin:master Jun 6, 2014
laanwj added a commit that referenced this pull request Jun 6, 2014
efe6888 build: fix version dependency (Cory Fields)
f4d8112 build: quit abusing AM_CPPFLAGS (Cory Fields)
56c157d build: avoid the use of top_ and abs_ dir paths (Cory Fields)
70c71c5 build: Tidy up file generation output (Cory Fields)
6b9f0d5 build: nuke Makefile.include from orbit (Cory Fields)
8b09ef7 build: add stub makefiles for easier subdir builds (Cory Fields)
be4e9ae build: delete old Makefile.am's (Cory Fields)
65e8ba4 build: Switch to non-recursive make (Cory Fields)
@sipa
Copy link
Member

sipa commented Jun 6, 2014

Doing make -j2 check in src/:

It seems that when descending into make check-TESTS, all libbitcoin_server and libbitcoin_common objects are rebuilt (very fast, probably ccache'd), but still... I'd expect the makefiles to only build them once?

@hebasto hebasto mentioned this pull request Jul 7, 2019
pull bot pushed a commit to jaschadub/bitcoin that referenced this pull request Jul 8, 2019
d003110 Remove unused guard (Hennadii Stepanov)

Pull request description:

  `BITCOIN_QT_TEST` is no longer used since switching to autotools build system.

  Some historical refs:
  - #807
  - bitcoin#4241

ACKs for top commit:
  practicalswift:
    utACK d003110
  promag:
    ACK d003110.
  jonasschnelli:
    Verified ACK d003110

Tree-SHA512: 1242ef7927d2dbd2e47cdb50de6ebb20e4ac427a66a37b4d4de8ca1b50581d34f818cb576fc9fdfb3e7dd7259d11812e3807da33b3357850d67548b837d5549b
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Oct 9, 2020
Summary:
PR description:
> BITCOIN_QT_TEST is no longer used since switching to autotools build system.
>
> Some historical refs:
>
>    bitcoin/bitcoin#807
>    bitcoin/bitcoin#4241

Backport of Core [[bitcoin/bitcoin#16350 | PR16350]]

Test Plan:
```
grep -r BITCOIN_QT_TEST[^_] .
cd build
ninja && ninja check
```

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, Fabien

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D7846
laanwj added a commit that referenced this pull request May 10, 2021
f52fafc build: Drop pointless sed commands (Hennadii Stepanov)

Pull request description:

  Since moving to Autotools build system (35b8af9, #2943, 2013-09), tag strings created by Qt specialized compilers ([uic](https://doc.qt.io/qt-5/uic.html), [moc](https://doc.qt.io/qt-5/moc.html), [rcc](https://doc.qt.io/qt-5/rcc.html)) were being removed.

  A bit later (70c71c5, #4241, 2014-06) this rule was dropped for the uic, and since then all of the generated `ui_*.h` files contain the following string:
  ```
  ** Created by: Qt User Interface Compiler version 5.12.8
  ```

  Such strings do not contain any timestamps, and cannot cause any non-determinism. The removing of them seems pointless.

  Diffs for some files:
  ```diff
  --- master/intro.moc
  +++ pr/intro.moc
  @@ -1,6 +1,7 @@
   /****************************************************************************
   ** Meta object code from reading C++ file 'intro.cpp'
   **
  +** Created by: The Qt Meta Object Compiler version 67 (Qt 5.12.8)
   **
   ** WARNING! All changes made in this file will be lost!
   *****************************************************************************/
  ```
  ```diff
  --- master/moc_addressbookpage.cpp
  +++ pr/moc_addressbookpage.cpp
  @@ -1,6 +1,7 @@
   /****************************************************************************
   ** Meta object code from reading C++ file 'addressbookpage.h'
   **
  +** Created by: The Qt Meta Object Compiler version 67 (Qt 5.12.8)
   **
   ** WARNING! All changes made in this file will be lost!
   *****************************************************************************/
  ```
  ```diff
  --- master/qrc_bitcoin.cpp
  +++ pr/qrc_bitcoin.cpp
  @@ -1,6 +1,7 @@
   /****************************************************************************
   ** Resource object code
   **
  +** Created by: The Resource Compiler for Qt version 5.12.8
   **
   ** WARNING! All changes made in this file will be lost!
   *****************************************************************************/
  ```

ACKs for top commit:
  laanwj:
    ACK f52fafc

Tree-SHA512: 31f5c19b37645b4914f17d8c234b7ae8781a0499c4b250ffef07d70b7552954fb682f58a75d76162f98ab5e1667288b3a041df2705573fb00523e87b9c1fd47f
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants