Qt5 build support #3346

pull theuni wants to merge 9 commits into bitcoin:master from theuni:qt5-build changing 11 files +465 −216
  1. theuni commented at 1:09 AM on December 3, 2013: member

    Now ready for review.

    Noteworthy changes:

    • --with-qt now accepts a version. --with-qt=no | qt4 | qt5 | auto.
    • If a version is not specified, it will use the first one it can find. Qt4 is searched before Qt5, this will probably be reversed at some point.
    • Ubuntu/Mingw/OSX builds are confirmed working fine.
    • Fixed the search order of --with-qt-bindir (#3063). If that dir is specified, it searches for any usable tool before searching elsewhere.

    Using: Linux: ./configure --with-qt=qt5 Windows: Specify --with-qt-incdir, --with-qt-libdir, --with-qt-plugindir, --with-qt-bindir OSX: ./configure PKG_CONFIG_PATH=/Users/cory/Qt5.0.2/5.0.2/clang_64/lib/pkgconfig --with-qt=qt5 --with-qt-bindir=/Users/cory/Qt5.0.2/5.0.2/clang_64/bin

    OSX is tricky. Because there's no macports build yet, I've tested with a binary download I had laying around. For now, this is how we'll use it.

  2. theuni commented at 1:37 AM on December 3, 2013: member

    Adding those who have asked me about this: @laanwj @gavinandresen @diapolo

  3. laanwj commented at 7:17 AM on December 3, 2013: member

    Cool @theuni I'll give it a try today (both with qt4 and qt5...)

  4. Diapolo commented at 7:37 AM on December 3, 2013: none

    Very nice, thanks for that :).

    Now how do I use Autotools for Qt5 with Qt Creator, I remember I need to enable the Autotools plugin, but what follows?

  5. laanwj commented at 7:40 AM on December 3, 2013: member

    @Diapolo I think it's best to test on the msys command line first, if that works, you can try the Qt Creator approach (which none of us knows anything about).

  6. Diapolo commented at 9:04 AM on December 3, 2013: none

    @laanwj Can you hint me the instructions to build with MSYS?

  7. laanwj commented at 10:04 AM on December 3, 2013: member

    Same as Linux, except that you need to specify the directories manually as they can't be detected, so:

    ./autogen.sh
    ./configure --with-qt-incdir=... --with-qt-libdir=.... --with-qt-plugindir=... --with-qt-bindir=...
    

    You may have to specify the path to bdb and others also manually. With ./configure --help you get a list of options.

  8. laanwj commented at 2:42 PM on December 3, 2013: member

    Successfully tested (against both qt4 and qt5) on Ubuntu 13.10 I verified that the executable is usable, and that the right Qt library is linked. I also checked that the Qt tests run successfully. Also successfully tested (against qt4) on 12.04.

    If a version is not specified, it will use the first one it can find. Qt4 is searched before Qt5, this will probably be reversed at some point.

    Yes, it would make sense to reverse that. By default, use the most recent version of Qt installed.

  9. theuni commented at 6:21 PM on December 3, 2013: member

    @laanwj Great, thanks for testing. As usual, I'd prefer to do that in a separate step. Defaulting to qt5 would mean that some devs would see a behavioral change when this goes in. I'd prefer to save that until there's a consensus on qt5. And since it hasn't been possible to use qt5 with autotools until this PR, there will likely be a few wrinkles to iron out first (mainly distro related, i'd think). @Diapolo: What @laanwj said. Once you have the msys steps figured out, you can replace the build-steps in qt-creator with those tailored to your system. For a hint on what's needed for configure, check out the win32 gitian descriptor.

  10. laanwj commented at 2:25 PM on December 5, 2013: member

    This looks almost ready to merge. Or is there anything holding this back?

    One nit: the "fetch and build inputs" in the release-process.md needs to be updated to update the qt version.

  11. theuni commented at 8:21 PM on December 11, 2013: member

    Working on cleaning this up and documenting for merge. @Diapolo / @gavinandresen: Any feedback?

  12. theuni commented at 3:42 AM on December 17, 2013: member

    quick update for anyone waiting on this: Almost got 'er all cleaned up, will try to push an update tomorrow.

  13. theuni commented at 2:13 AM on December 19, 2013: member

    Updated PR description.

    This has now been refactored to move all of the nasty qt configure bits into its own file, to avoid making a mess of the main configure.ac.

    I consider this merge-able, once reviewed/tested/ack'd.

  14. theuni commented at 5:56 AM on December 19, 2013: member

    Erm. Any clues as to what could cause that?

    bad balance: 21.00000000 (expected 100)
    

    This work is very contained to the qt buildsystem, I'm not sure how core builds could be noticeably affected.

  15. laanwj commented at 7:01 AM on December 19, 2013: member

    I've seen that error before. My guess is that it is one of those transient pull tester problems. At least in this case as you don't touch the non-GUI code at all.

  16. laanwj commented at 7:02 AM on December 19, 2013: member

    @BlueMatt can you please take a look? We have an unexplainable pull tester issue.

  17. gavinandresen commented at 8:06 AM on December 19, 2013: contributor

    Error is qa/rpc-tests/wallet.sh being flaky for some reason; I've seen it do that before, too. Probably the pull-tester machine getting busy with something else at exactly the wrong time...

  18. sipa commented at 10:34 PM on January 6, 2014: member

    Trying to compile with this:

    configure: error: Qt dependencies not found
    make: *** [config.status] Error 1
    

    Anything else I can provide? I assume I only have Qt4 installed.

  19. sipa commented at 10:35 PM on January 6, 2014: member

    BTW, if this is fully ready for review, it's probably better to remove the "work in progress" label from this pull request's title. At least I tend to ignore things labelled that way completely.

  20. theuni commented at 10:37 PM on January 6, 2014: member

    @sipa: Indeed. I updated the description but forgot to change the title. That probably explains why this hasn't really been tested. Changed now, thanks.

    Could you please pastebin the entire config.log? That should show the problem.

  21. sipa commented at 10:40 PM on January 6, 2014: member

    See http://pastebin.com/W1JW7d2H (shell output) and http://pastebin.com/hGVz00Gs (config.log).

  22. theuni commented at 10:51 PM on January 6, 2014: member

    @sipa looks like the --with-qt change is causing a little trouble. Before, it was binary on/off. Now it's meant to be used as --with-qt=qtX.

    Remove --with-qt (for now) and it should work. I'll track down the problem and push the fix.

  23. sipa commented at 10:57 PM on January 6, 2014: member

    Seems to compile, pass tests and run on Ubuntu 13.04 with Qt4. I haven't looked at the code changes.

  24. laanwj commented at 10:03 AM on January 10, 2014: member

    @theuni are you able to do the final changes to this pull request by this/next week?

    I'd like to upgrade to Qt 5.x for version 0.9, so this is sort of a blocker. I can try to fix this on my own, but due to my limited knowledge of autotools I think it's better if you do.

  25. Diapolo commented at 4:13 PM on January 10, 2014: none

    @theuni If you can do some formating magic to the makefiles, so that every .cpp, .h and so on reside in a single line that would make you my hero ^^.

  26. in README.md:None in d4d938b494 outdated
       0 | @@ -1,6 +1,6 @@
       1 |  Bitcoin Core integration/staging tree
       2 |  =====================================
       3 | -
       4 | + 
    


    Diapolo commented at 4:13 PM on January 10, 2014:

    This seems unwanted...

  27. theuni commented at 7:34 PM on January 10, 2014: member

    @laanwj Yep, will get it pushed up today/tomorrow.

  28. theuni commented at 7:36 PM on January 10, 2014: member

    @Diapolo ok, I'll do that in a separate PR after this one.

    Fwiw, I wanted to do it that way originally, but I was afraid that making the makefiles that much longer would make the devs afraid of moving to autotools due to the perceived verbosity :p

  29. sipa commented at 8:08 PM on January 10, 2014: member

    I prefer a single line per source - it results in more mergeable patches in case multiple add new files.

  30. qt5: Ensure correct link order
    If optional libs don't appear in QT_LIBS, they need to be listed first for
    proper static linking.
    328bdb1cd6
  31. qt5: fix a build issue with osx and qtdbus
    See comment in notificator.cpp for details.
    c614bd718b
  32. qt5: split out qt config and add qt5 support
    Qt5 detection is a big ugly mess, but at least we can fence it off.
    c8ba8ef654
  33. qt5: Use the info gleaned from configure for plugin importing 60dc589477
  34. qt5: Use QT_SELECT for debian-based distros.
    At least Debian/Ubuntu use 'qtchooser' for switching between qt4/qt5 binaries.
    It is a wrapper for all qt tools, and calls the named tool of the default
    version unless overridden by the -qt= option or QT_SELECT environment variable.
    QT_SELECT is set by configure once the qt version has been chosen.
    
    Take for example, moc.
    
    $ which moc
        /usr/bin/moc
    
    $ ls -go /usr/bin/moc
        lrwxrwxrwx 1 9 Jul  3 21:33 /usr/bin/moc -> qtchooser
    
    $ qtchooser -print-env
        QT_SELECT="default"
        QTTOOLDIR="/usr/lib/x86_64-linux-gnu/qt4/bin"
        QTLIBDIR="/usr/lib/x86_64-linux-gnu"
    
    $ QT_SELECT=qt5 qtchooser -print-env
        QT_SELECT="qt5"
        QTTOOLDIR="/usr/lib/x86_64-linux-gnu/qt5/bin"
        QTLIBDIR="/usr/lib/x86_64-linux-gnu"
    
    $ moc -v
        Qt Meta Object Compiler version 63 (Qt 4.8.4)
    
    $ QT_SELECT=qt5 moc -v
        Qt Meta Object Compiler version 67 (Qt 5.0.1)
    
    This should be harmless elsewhere.
    47ffb50533
  35. qt5: tests: Make sure static plugin symbols are pulled in
    Since we're now properly linking against static plugins for qt binaries,
    we need to ensure that they're Imported properly.
    
    Without these Imports, the linker drops some of the unused linked libs, causing
    undefined symbols in QtCore.
    8b0f608815
  36. qt5: Force macports default include path to be searched last
    Allows outside includes to take precedence. In particular, this allows for
    a specified Qt to be used without clashing with macports' headers.
    2691cbc4b3
  37. qt5: fix --with-qt with no arguments 371f3f6ba5
  38. qt5: fix typo causing broken selection logic 42cc96737c
  39. theuni commented at 9:43 PM on January 10, 2014: member

    Rebased against master and fixed @sipa's problem.

    Confirmed builds fine and passes tests on Ubuntu 13.04 (qt4/qt5), and win32 (qt4/qt5)

  40. BitcoinPullTester commented at 10:20 PM on January 10, 2014: none

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

  41. theuni commented at 10:58 PM on January 10, 2014: member

    osx+qt4 verified as well.

    osx+qt5 builds, but fails a test:

    FAIL!  : PaymentServerTests::paymentServerTests() Compared values are not the same
       Actual   (merchant): 
       Expected (QString("testmerchant.org")): testmerchant.org
       Loc: [paymentservertests.cpp(72)]
    

    Presumably it's having trouble finding the qt5 root cert store.

    I don't think that's a blocker since qt5 build support is needed in order to find/fix the problem.

  42. laanwj commented at 11:18 PM on January 10, 2014: member

    Nice! Great work

  43. theuni commented at 2:00 AM on January 11, 2014: member

    Ok, got the osx/qt5 issue worked out. It's related to how the official sdk is built. The official sdk is built with openssl runtime detection, meaning that it falls back to what's on the user's machine. Our qt4 builds have historically been built with ssl-linked, meaning that we explicitly link against the version we want.

    runtime:

    Corys-MacBook-Pro:qt cory$ ./test/test_bitcoin-qt
    ********* Start testing of URITests *********
    Config: Using QTest library 5.0.2, Qt 5.0.2
    PASS   : URITests::initTestCase()
    PASS   : URITests::uriTests()
    PASS   : URITests::cleanupTestCase()
    Totals: 3 passed, 0 failed, 0 skipped
    ********* Finished testing of URITests *********
    ********* Start testing of PaymentServerTests *********
    Config: Using QTest library 5.0.2, Qt 5.0.2
    PASS   : PaymentServerTests::initTestCase()
    QDEBUG : PaymentServerTests::paymentServerTests() PaymentRequestPlus::getMerchant : SSL error:  certificate signature failure 
    QDEBUG : PaymentServerTests::paymentServerTests() PaymentServer::processPaymentRequest : Insecure payment request to  "1EcqLEpyu3zY7T5QU7RLrHEQH134KeGPXR" 
    QDEBUG : PaymentServerTests::paymentServerTests() PaymentRequestPlus::getMerchant : SSL error:  certificate signature failure 
    FAIL!  : PaymentServerTests::paymentServerTests() Compared values are not the same
       Actual   (merchant): 
       Expected (QString("testmerchant.org")): testmerchant.org
       Loc: [paymentservertests.cpp(72)]
    PASS   : PaymentServerTests::cleanupTestCase()
    Totals: 2 passed, 1 failed, 0 skipped
    ********* Finished testing of PaymentServerTests *********
    

    hack to force our custom openssl dylib:

    Corys-MacBook-Pro:qt cory$ DYLD_FALLBACK_LIBRARY_PATH=/opt/local/lib/ ./test/test_bitcoin-qt
    ********* Start testing of URITests *********
    Config: Using QTest library 5.0.2, Qt 5.0.2
    PASS   : URITests::initTestCase()
    PASS   : URITests::uriTests()
    PASS   : URITests::cleanupTestCase()
    Totals: 3 passed, 0 failed, 0 skipped
    ********* Finished testing of URITests *********
    ********* Start testing of PaymentServerTests *********
    Config: Using QTest library 5.0.2, Qt 5.0.2
    PASS   : PaymentServerTests::initTestCase()
    QDEBUG : PaymentServerTests::paymentServerTests() PaymentServer::processPaymentRequest : Secure payment request from  "testmerchant.org" 
    QDEBUG : PaymentServerTests::paymentServerTests() PaymentRequestPlus::getMerchant : Payment request: certificate expired or not yet active:  QSslCertificate( "3" , "03" , "LxHILx+N3qwVoAcCmQ5cyw==" , () , ("Expired Test Merchant") , QMap() , QDateTime("Sat Feb 23 21:26:43 2013") , QDateTime("Sun Feb 24 21:26:43 2013") ) 
    QDEBUG : PaymentServerTests::paymentServerTests() PaymentServer::processPaymentRequest : Insecure payment request to  "1EcqLEpyu3zY7T5QU7RLrHEQH134KeGPXR" 
    QDEBUG : PaymentServerTests::paymentServerTests() PaymentRequestPlus::getMerchant : Payment request: certificate expired or not yet active:  QSslCertificate( "3" , "03" , "LxHILx+N3qwVoAcCmQ5cyw==" , () , ("Expired Test Merchant") , QMap() , QDateTime("Sat Feb 23 21:26:43 2013") , QDateTime("Sun Feb 24 21:26:43 2013") ) 
    QDEBUG : PaymentServerTests::paymentServerTests() PaymentServer::processPaymentRequest : Secure payment request from  "testmerchant8.org" 
    QDEBUG : PaymentServerTests::paymentServerTests() PaymentRequestPlus::getMerchant : Payment request: certificate expired or not yet active:  QSslCertificate( "3" , "06" , "MiZaQ+g9lSHZGuHWkXZG+g==" , () , ("Payment Request Intermediate 5") , QMap() , QDateTime("Sat Feb 23 22:59:51 2013") , QDateTime("Sun Feb 24 22:59:51 2013") ) 
    QDEBUG : PaymentServerTests::paymentServerTests() PaymentServer::processPaymentRequest : Insecure payment request to  "1EcqLEpyu3zY7T5QU7RLrHEQH134KeGPXR" 
    QDEBUG : PaymentServerTests::paymentServerTests() PaymentRequestPlus::getMerchant : Payment request: certificate expired or not yet active:  QSslCertificate( "3" , "06" , "MiZaQ+g9lSHZGuHWkXZG+g==" , () , ("Payment Request Intermediate 5") , QMap() , QDateTime("Sat Feb 23 22:59:51 2013") , QDateTime("Sun Feb 24 22:59:51 2013") ) 
    QDEBUG : PaymentServerTests::paymentServerTests() PaymentRequestPlus::getMerchant : SSL error:  certificate signature failure 
    QDEBUG : PaymentServerTests::paymentServerTests() PaymentServer::processPaymentRequest : Insecure payment request to  "1EcqLEpyu3zY7T5QU7RLrHEQH134KeGPXR" 
    QDEBUG : PaymentServerTests::paymentServerTests() PaymentRequestPlus::getMerchant : SSL error:  certificate signature failure 
    QDEBUG : PaymentServerTests::paymentServerTests() PaymentRequestPlus::getMerchant : SSL error:  unable to get local issuer certificate 
    QDEBUG : PaymentServerTests::paymentServerTests() PaymentServer::processPaymentRequest : Insecure payment request to  "1EcqLEpyu3zY7T5QU7RLrHEQH134KeGPXR" 
    QDEBUG : PaymentServerTests::paymentServerTests() PaymentRequestPlus::getMerchant : SSL error:  unable to get local issuer certificate 
    PASS   : PaymentServerTests::paymentServerTests()
    PASS   : PaymentServerTests::cleanupTestCase()
    Totals: 3 passed, 0 failed, 0 skipped
    ********* Finished testing of PaymentServerTests *********
    

    tldr; it's a non-issue once we're building qt5 ourselves using openssl-linked.

  44. laanwj referenced this in commit 6a0e2376a1 on Jan 11, 2014
  45. laanwj merged this on Jan 11, 2014
  46. laanwj closed this on Jan 11, 2014

  47. theuni commented at 3:08 PM on January 11, 2014: member

    @laanwj Thanks for the merge. There are bound to be a few regressions here as it's impossible for me to test all cases (I tried to hit all of the obvious ones of course).

    I'll try to respond quickly to @mentions if/when reports come in.

  48. Bushstar referenced this in commit 56b8e97ab0 on Apr 8, 2020
  49. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-15 15:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me