Skip to content

Conversation

@theuni
Copy link
Member

@theuni theuni commented May 26, 2013

This is the beginning of an autotools build-system refactor. My first step is to be able to create a common static lib for the binaries (console/qt/test) to link against, meaning that each of those will need its own entry-point object file.

This series gets rid of the QT_GUI define in favor of letting the build-system link in the proper startup file, and a global var to determine how the binary was started.

I've tried to match this project's formatting and general practices.

@BitcoinPullTester
Copy link

Automatic sanity-testing: FAILED BUILD/TEST, see http://jenkins.bluematt.me/pull-tester/37d4ab5e11da48e7627b446a2fae716555c58f18 for binaries and test log.

This could happen for one of several reasons:

  1. It chanages paths in makefile.linux-mingw or otherwise changes build scripts in a way that made them incompatible with the automated testing scripts (please tweak those patches in contrib/test-scripts)
  2. It adds/modifies tests which test network rules (thanks for doing that), which conflicts with a patch applied at test time
  3. It does not build on either Linux i386 or Win32 (via MinGW cross compile)
  4. The test suite fails on either Linux i386 or Win32
  5. The block test-cases failed (lookup the first bNN identifier which failed in https://github.com/TheBlueMatt/test-scripts/blob/master/FullBlockTestGenerator.java)

If you believe this to be in error, please ping BlueMatt on freenode or TheBlueMatt here.

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.

@BitcoinPullTester
Copy link

Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/feb4b7ef8d3ffb49b9bca41928051f7a8f6b4f29 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.

@jonasschnelli
Copy link
Contributor

What's the benefit of this refactor?
I like ifdefs.
This change will mean we have GUI only code in the non-GUI binary (and vicaversa).

@laanwj
Copy link
Member

laanwj commented May 27, 2013

@jonasschnelli: Compilation speed and sanity. This allows compiling the
core objects only once and storing them in an archive (library) to be used
by the all of bitcoin-qt, bitcoind and the tests.

There are only very few differences left under QT_GUI defines (some help
messages, and the default key which is going away anyway) so I honestly
don't see the "GUI code in non-GUI" problem.

@sipa
Copy link
Member

sipa commented May 27, 2013

Any QT_GUI ifdef in the core code means that the core <-> GUI split wasn't done correctly in the first place. The core semantics shouldn't depend on whether there is a GUI on top of it or not...

Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: move AppInit to this file as well. It is a bit empty, and AppInit is only used by the bitcoind (not by either bitcoin-qt or the tests), so it fits here.

Copy link
Member Author

Choose a reason for hiding this comment

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

I left AppInit where it was because there's no logical reason to split it out (meaning no risk of symbol collisions if left in the static archive). It could feasibly be used to start a non-graphical session via the qt binary using something like 'bitcoin-qt --no-gui' if such behavior was ever desired in the future. But if there's opposition, sure, I can do that.

Copy link
Member

Choose a reason for hiding this comment

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

Such a feature (start a daemon session from bitcoin-qt) will never be
supported. There is already the debug console window and the --server
option.

Functions that are only used by either the UI or daemon should be moved to
their respective frontends (unless there is a very good reason not to, like
keeping methods acting on an object together, but I disagree there is one
in this case).

Copy link
Member Author

Choose a reason for hiding this comment

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

OK. Will move.

@gavinandresen
Copy link
Contributor

ACK on the concept; I haven't compiled/tested.

@jonasschnelli
Copy link
Contributor

ACK
compile and run (Bitcoin-Qt.app and bitcoind) smooth on osx 10.8.

@theuni
Copy link
Member Author

theuni commented May 27, 2013

@jonasschnelli you said: "I like ifdefs". If that's the resounding attitude here, I'll need to reevaluate my autotools work. Ifdefs are a portability nightmare if used to control runtime behavior. In this case, depending on the compiler/linker/settings used, the unreachable paths might be stripped away just as if ifdefs had been used.

Would you mind explaining your position, and if it's common for bitcoin development? I have no problem adapting (even if i disagree), but it may negate the reasoning for my work.

@luke-jr
Copy link
Member

luke-jr commented May 27, 2013

@theuni I don't think @jonasschnelli 's ifdef love is representative of most developers here. It makes sense for some optional build-time features (UPnP, IPv6), but not so much in this case.

@jonasschnelli
Copy link
Contributor

@theuni: no. just go on (even when i – generally – like #ifdef's). I just like binaries that only containing code which will be runned through. But for this case ifdefs are not the right thing.

@theuni
Copy link
Member Author

theuni commented May 27, 2013

Roger, thanks. I have more to say on the subject, but I'll do it in code/PR form as I go rather than discussing vague concepts here.

@jgarzik
Copy link
Contributor

jgarzik commented May 28, 2013

#ifdefs are evaluated on a case-by-case basis, if they make sense. If the GUI supports a runtime switch that forces daemon mode, then "#ifdef GUI" construct is not applicable for that build. It depends on the build and platform. Clearly, #ifdef GUI is applicable to a bitcoind-only build.

Thus, just giving that one example, you can see where #ifdef is, and is not, applicable. Personal preference never enters into the equation. If #ifdef is applicable, it is used. Otherwise it is not.

@jgarzik
Copy link
Contributor

jgarzik commented May 28, 2013

ACK on the general concept

@theuni
Copy link
Member Author

theuni commented May 28, 2013

Ok, I've pushed changes to address comments here. I'll squash it down if everyone is ok with the above.

@BitcoinPullTester
Copy link

Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/c5e9ebcfb206deb19db166db4063120f220a3f3b 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.

@sipa
Copy link
Member

sipa commented May 30, 2013

Any reason why the init_noui code isn't just in noui?

@laanwj
Copy link
Member

laanwj commented May 30, 2013

Agree with @sipa. We could call the resulting file bitcoind.cpp, which is more descriptive than noui.cpp.

@sipa
Copy link
Member

sipa commented May 30, 2013

Good idea.

@theuni
Copy link
Member Author

theuni commented May 30, 2013

yep, makes perfect sense. will do.

@theuni
Copy link
Member Author

theuni commented Jun 4, 2013

renamed init_noui.cpp to bitcoind.cpp, rebased to current HEAD, and squashed logically.

Anything else needed?

@theuni
Copy link
Member Author

theuni commented Jun 4, 2013

Grr, I just reread the comment above and realized I didn't make the change you guys were after. doing now.

@theuni
Copy link
Member Author

theuni commented Jun 4, 2013

Actually, the noui stuff can't move into bitcoind.cpp, as that would defeat the purpose of this rework. That would mean that test_bitcoin would have to link in bitcoind.o for noui_connect(), while also pulling in a conflicting main().

The object containing main() needs to stay as thin as possible.

@BitcoinPullTester
Copy link

Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/6887bb9ad7f6722a64e9fbdf0a780f362dc796a1 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.

@sipa
Copy link
Member

sipa commented Jun 5, 2013

ACK

1 similar comment
@laanwj
Copy link
Member

laanwj commented Jun 5, 2013

ACK

@jgarzik
Copy link
Contributor

jgarzik commented Jun 5, 2013

ACK

Coordination note: Recommend waiting until #2154 is merged, to merge this.

@theuni
Copy link
Member Author

theuni commented Jun 5, 2013

@jgarzik This is holding up my autotools pull request (it depends on this work), and it looks like #2154 could be a while. Could i convince you to change your mind on that?

@jgarzik
Copy link
Contributor

jgarzik commented Jun 5, 2013

#2154 won't be a while. See that pull req already discussing a hold on other pull reqs.

@sipa
Copy link
Member

sipa commented Jun 5, 2013

Just tested: #2700 and #2154 do not conflict with each other, so this can be merged independently.

@jgarzik
Copy link
Contributor

jgarzik commented Jun 5, 2013

Great, best of all worlds :)

jgarzik pushed a commit that referenced this pull request Jun 5, 2013
@jgarzik jgarzik merged commit c94bd68 into bitcoin:master Jun 5, 2013
@theuni
Copy link
Member Author

theuni commented Jun 5, 2013

great, thanks

@theuni theuni deleted the gui-split branch June 6, 2013 03:02
@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.

8 participants