leveldb: integrate leveldb into our buildsystem #7911

pull theuni wants to merge 1 commits into bitcoin:master from theuni:leveldb-integration changing 3 files +106 −19
  1. theuni commented at 6:40 PM on April 19, 2016: member

    See discussion at https://github.com/bitcoin/leveldb/pull/11

    leveldb's buildsystem causes us a few problems:

    • breaks out-of-tree builds
    • forces flags used for some tools
    • limits cross builds

    Rather than continuing to add wrappers around it, simply integrate it into our build.

  2. leveldb: integrate leveldb into our buildsystem
    leveldb's buildsystem causes us a few problems:
    - breaks out-of-tree builds
    - forces flags used for some tools
    - limits cross builds
    
    Rather than continuing to add wrappers around it, simply integrate it into our
    build.
    a4625acbf8
  3. jonasschnelli added the label Build system on Apr 19, 2016
  4. laanwj commented at 7:02 AM on April 20, 2016: member

    utACK (will test later).

    More info: this should fix both issues from "Out-of-tree builds don't currently work #7466": out-of-tree builds and LLVM lto ar.

  5. luke-jr commented at 7:27 AM on April 20, 2016: member

    Why not just autotools-ify our LevelDB fork?

  6. theuni commented at 7:54 AM on April 20, 2016: member

    @luke-jr That's exactly what this is. Upstream is dormant enough that there's no need to add an abstraction layer. We were already overriding their entire buildsystem, all we were missing was file enumeration.

  7. sipa commented at 8:44 AM on April 20, 2016: member

    utACK

  8. laanwj commented at 9:19 AM on April 20, 2016: member

    Why not just autotools-ify our LevelDB fork?

    There's a (quite succesful) attempt by @kleetus here: https://github.com/bitcoin/leveldb/pull/11

    If you manage to get upstream to merge and maintain that in favor of their current bag of hacks, that'd be an excellent option. We can switch to that if that happens. However the chances of that are thought to be slim, so the most efficient and least error-prone way (less "moving parts") for us to solve this right now is the way @theuni did.

  9. luke-jr commented at 9:19 AM on April 20, 2016: member

    src/Makefile.leveldb.include isn't inside src/leveldb...

  10. laanwj commented at 9:20 AM on April 20, 2016: member

    src/Makefile.leveldb.include isn't inside src/leveldb...

    That's on purpose. You are basically repeating the discussion done months ago in https://github.com/bitcoin/leveldb/pull/11 and #7466. src/leveldb is still a subtree containing the upstream repository, we shouldn't add files private to ourselves (which aren't useful on their own) there.

  11. sipa commented at 9:49 AM on April 20, 2016: member

    I think both things can be done in parallel: we could try to get an autotoolsification of leveldb accepted upstream (so it benefits more people than just Bitcoin-related projects), and switch to an overridden build system like this PR in the mean time. If the autotoolsification gets upstreamed, we can always switch back.

  12. laanwj commented at 10:02 AM on April 20, 2016: member

    @sipa Indeed

  13. laanwj commented at 12:15 PM on April 20, 2016: member

    Tested ACK https://github.com/bitcoin/bitcoin/pull/7911/commits/a4625acbf8afbe3f698e8dc7936312c9d2b65d22 using both gcc and llvm (+flto). (but this reveals another problem, see below)

  14. laanwj commented at 12:58 PM on April 20, 2016: member

    OK this is really, really strange. With this patch:

    • When I compile the GUI from the bitcoin directory itself, it works as expected.
    • When I build the GUI in an out-of-tree build, I cannot get it to select tabs. When I click, say the "Receive" tab nothing happens, the button selects but it doesn't switch the page. The rest - even the debug window - seems to work.

    I first thought I had found a strange clang issue, but this happens with gcc as well. I cannot wrap my head around this, tried adding debug statements over the place but it's as if the QAction (overviewAction, etc) doesn't generate a signal when building out-of-tree.

    • this is not due to a polluted bitcoin repository shared between the out-of-tree and normal build - I tried the same from a clean checkout
  15. laanwj commented at 1:41 PM on April 20, 2016: member

    @cfields I think I found the issue, or at least one symptom - the .moc file is different between the out-of-tree and normal builds:

    --- bitcoin/src/qt/moc_bitcoingui.cpp   2016-04-20 15:31:42.627847820 +0200
    +++ bitcoin-build/src/qt/moc_bitcoingui.cpp 2016-04-20 15:17:04.295881358 +0200
    @@ -5,7 +5,7 @@
     ** WARNING! All changes made in this file will be lost!
     *****************************************************************************/
    
    -#include "qt/bitcoingui.h"
    +#include "../../bitcoin-clean/src/qt/bitcoingui.h"
     #include <QtCore/qbytearray.h>
     #include <QtCore/qmetatype.h>
     #if !defined(Q_MOC_OUTPUT_REVISION)
    @@ -18,8 +18,8 @@
    
     QT_BEGIN_MOC_NAMESPACE
     struct qt_meta_stringdata_BitcoinGUI_t {
    -    QByteArrayData data[49];
    -    char stringdata[642];
    +    QByteArrayData data[28];
    +    char stringdata[372];
     };
     #define QT_MOC_LITERAL(idx, ofs, len) \
         Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
    @@ -42,54 +42,26 @@
     QT_MOC_LITERAL(11, 111, 5),
     QT_MOC_LITERAL(12, 117, 5),
     QT_MOC_LITERAL(13, 123, 3),
    -QT_MOC_LITERAL(14, 127, 19),
    -QT_MOC_LITERAL(15, 147, 6),
    -QT_MOC_LITERAL(16, 154, 20),
    -QT_MOC_LITERAL(17, 175, 18),
    -QT_MOC_LITERAL(18, 194, 9),
    -QT_MOC_LITERAL(19, 204, 19),
    -QT_MOC_LITERAL(20, 224, 4),
    -QT_MOC_LITERAL(21, 229, 4),
    -QT_MOC_LITERAL(22, 234, 7),
    -QT_MOC_LITERAL(23, 242, 6),
    -QT_MOC_LITERAL(24, 249, 4),
    -QT_MOC_LITERAL(25, 254, 7),
    -QT_MOC_LITERAL(26, 262, 5),
    -QT_MOC_LITERAL(27, 268, 16),
    -QT_MOC_LITERAL(28, 285, 15),
    -QT_MOC_LITERAL(29, 301, 20),
    -QT_MOC_LITERAL(30, 322, 17),
    -QT_MOC_LITERAL(31, 340, 4),
    -QT_MOC_LITERAL(32, 345, 18),
    -QT_MOC_LITERAL(33, 364, 20),
    -QT_MOC_LITERAL(34, 385, 11),
    -QT_MOC_LITERAL(35, 397, 14),
    -QT_MOC_LITERAL(36, 412, 12),
    -QT_MOC_LITERAL(37, 425, 15),
    -QT_MOC_LITERAL(38, 441, 30),
    -QT_MOC_LITERAL(39, 472, 22),
    -QT_MOC_LITERAL(40, 495, 17),
    -QT_MOC_LITERAL(41, 513, 33),
    -QT_MOC_LITERAL(42, 547, 6),
    -QT_MOC_LITERAL(43, 554, 21),
    -QT_MOC_LITERAL(44, 576, 13),
    -QT_MOC_LITERAL(45, 590, 12),
    -QT_MOC_LITERAL(46, 603, 14),
    -QT_MOC_LITERAL(47, 618, 12),
    -QT_MOC_LITERAL(48, 631, 9)
    +QT_MOC_LITERAL(14, 127, 14),
    +QT_MOC_LITERAL(15, 142, 12),
    +QT_MOC_LITERAL(16, 155, 15),
    +QT_MOC_LITERAL(17, 171, 30),
    +QT_MOC_LITERAL(18, 202, 22),
    +QT_MOC_LITERAL(19, 225, 17),
    +QT_MOC_LITERAL(20, 243, 33),
    +QT_MOC_LITERAL(21, 277, 6),
    +QT_MOC_LITERAL(22, 284, 21),
    +QT_MOC_LITERAL(23, 306, 13),
    +QT_MOC_LITERAL(24, 320, 12),
    +QT_MOC_LITERAL(25, 333, 14),
    +QT_MOC_LITERAL(26, 348, 12),
    +QT_MOC_LITERAL(27, 361, 9)
         },
         "BitcoinGUI\0receivedURI\0\0uri\0"
         "setNumConnections\0count\0setNumBlocks\0"
         "blockDate\0nVerificationProgress\0message\0"
    -    "title\0style\0bool*\0ret\0setEncryptionStatus\0"
    -    "status\0handlePaymentRequest\0"
    -    "SendCoinsRecipient\0recipient\0"
    -    "incomingTransaction\0date\0unit\0CAmount\0"
    -    "amount\0type\0address\0label\0gotoOverviewPage\0"
    -    "gotoHistoryPage\0gotoReceiveCoinsPage\0"
    -    "gotoSendCoinsPage\0addr\0gotoSignMessageTab\0"
    -    "gotoVerifyMessageTab\0openClicked\0"
    -    "optionsClicked\0aboutClicked\0showDebugWindow\0"
    +    "title\0style\0bool*\0ret\0optionsClicked\0"
    +    "aboutClicked\0showDebugWindow\0"
         "showDebugWindowActivateConsole\0"
         "showHelpMessageClicked\0trayIconActivated\0"
         "QSystemTrayIcon::ActivationReason\0"
    @@ -105,7 +77,7 @@
            7,       // revision
            0,       // classname
            0,    0, // classinfo
    -      29,   14, // methods
    +      16,   14, // methods
            0,    0, // properties
            0,    0, // enums/sets
            0,    0, // constructors
    @@ -113,37 +85,24 @@
            1,       // signalCount
    
      // signals: name, argc, parameters, tag, flags
    -       1,    1,  159,    2, 0x06,
    +       1,    1,   94,    2, 0x06,
    
      // slots: name, argc, parameters, tag, flags
    -       4,    1,  162,    2, 0x0a,
    -       6,    3,  165,    2, 0x0a,
    -       9,    4,  172,    2, 0x0a,
    -       9,    3,  181,    2, 0x2a,
    -      14,    1,  188,    2, 0x0a,
    -      16,    1,  191,    2, 0x0a,
    -      19,    6,  194,    2, 0x0a,
    -      27,    0,  207,    2, 0x08,
    -      28,    0,  208,    2, 0x08,
    -      29,    0,  209,    2, 0x08,
    -      30,    1,  210,    2, 0x08,
    -      30,    0,  213,    2, 0x28,
    -      32,    1,  214,    2, 0x08,
    -      32,    0,  217,    2, 0x28,
    -      33,    1,  218,    2, 0x08,
    -      33,    0,  221,    2, 0x28,
    -      34,    0,  222,    2, 0x08,
    -      35,    0,  223,    2, 0x08,
    -      36,    0,  224,    2, 0x08,
    -      37,    0,  225,    2, 0x08,
    -      38,    0,  226,    2, 0x08,
    -      39,    0,  227,    2, 0x08,
    -      40,    1,  228,    2, 0x08,
    -      43,    1,  231,    2, 0x08,
    -      43,    0,  234,    2, 0x28,
    -      45,    0,  235,    2, 0x08,
    -      46,    0,  236,    2, 0x08,
    -      47,    2,  237,    2, 0x08,
    +       4,    1,   97,    2, 0x0a,
    +       6,    3,  100,    2, 0x0a,
    +       9,    4,  107,    2, 0x0a,
    +       9,    3,  116,    2, 0x2a,
    +      14,    0,  123,    2, 0x08,
    +      15,    0,  124,    2, 0x08,
    +      16,    0,  125,    2, 0x08,
    +      17,    0,  126,    2, 0x08,
    +      18,    0,  127,    2, 0x08,
    +      19,    1,  128,    2, 0x08,
    +      22,    1,  131,    2, 0x08,
    +      22,    0,  134,    2, 0x28,
    +      24,    0,  135,    2, 0x08,
    +      25,    0,  136,    2, 0x08,
    +      26,    2,  137,    2, 0x08,
    
      // signals: parameters
         QMetaType::Void, QMetaType::QString,    3,
    @@ -153,30 +112,17 @@
         QMetaType::Void, QMetaType::Int, QMetaType::QDateTime, QMetaType::Double,    5,    7,    8,
         QMetaType::Void, QMetaType::QString, QMetaType::QString, QMetaType::UInt, 0x80000000 | 12,   10,    9,   11,   13,
         QMetaType::Void, QMetaType::QString, QMetaType::QString, QMetaType::UInt,   10,    9,   11,
    -    QMetaType::Void, QMetaType::Int,   15,
    -    QMetaType::Bool, 0x80000000 | 17,   18,
    -    QMetaType::Void, QMetaType::QString, QMetaType::Int, 0x80000000 | 22, QMetaType::QString, QMetaType::QString, QMetaType::QString,   20,   21,   23,   24,   25,   26,
    -    QMetaType::Void,
    -    QMetaType::Void,
    -    QMetaType::Void,
    -    QMetaType::Void, QMetaType::QString,   31,
    -    QMetaType::Void,
    -    QMetaType::Void, QMetaType::QString,   31,
    -    QMetaType::Void,
    -    QMetaType::Void, QMetaType::QString,   31,
         QMetaType::Void,
         QMetaType::Void,
         QMetaType::Void,
         QMetaType::Void,
         QMetaType::Void,
    -    QMetaType::Void,
    -    QMetaType::Void,
    -    QMetaType::Void, 0x80000000 | 41,   42,
    -    QMetaType::Void, QMetaType::Bool,   44,
    +    QMetaType::Void, 0x80000000 | 20,   21,
    +    QMetaType::Void, QMetaType::Bool,   23,
         QMetaType::Void,
         QMetaType::Void,
         QMetaType::Void,
    -    QMetaType::Void, QMetaType::QString, QMetaType::Int,   10,   48,
    +    QMetaType::Void, QMetaType::QString, QMetaType::Int,   10,   27,
    
            0        // eod
     };
    @@ -191,31 +137,17 @@
             case 2: _t->setNumBlocks((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< const QDateTime(*)>(_a[2])),(*reinterpret_cast< double(*)>(_a[3]))); break;
             case 3: _t->message((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< const QString(*)>(_a[2])),(*reinterpret_cast< uint(*)>(_a[3])),(*reinterpret_cast< bool*(*)>(_a[4]))); break;
             case 4: _t->message((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< const QString(*)>(_a[2])),(*reinterpret_cast< uint(*)>(_a[3]))); break;
    -        case 5: _t->setEncryptionStatus((*reinterpret_cast< int(*)>(_a[1]))); break;
    -        case 6: { bool _r = _t->handlePaymentRequest((*reinterpret_cast< const SendCoinsRecipient(*)>(_a[1])));
    -            if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; }  break;
    -        case 7: _t->incomingTransaction((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< const CAmount(*)>(_a[3])),(*reinterpret_cast< const QString(*)>(_a[4])),(*reinterpret_cast< const QString(*)>(_a[5])),(*reinterpret_cast< const QString(*)>(_a[6]))); break;
    -        case 8: _t->gotoOverviewPage(); break;
    -        case 9: _t->gotoHistoryPage(); break;
    -        case 10: _t->gotoReceiveCoinsPage(); break;
    -        case 11: _t->gotoSendCoinsPage((*reinterpret_cast< QString(*)>(_a[1]))); break;
    -        case 12: _t->gotoSendCoinsPage(); break;
    -        case 13: _t->gotoSignMessageTab((*reinterpret_cast< QString(*)>(_a[1]))); break;
    -        case 14: _t->gotoSignMessageTab(); break;
    -        case 15: _t->gotoVerifyMessageTab((*reinterpret_cast< QString(*)>(_a[1]))); break;
    -        case 16: _t->gotoVerifyMessageTab(); break;
    -        case 17: _t->openClicked(); break;
    -        case 18: _t->optionsClicked(); break;
    -        case 19: _t->aboutClicked(); break;
    -        case 20: _t->showDebugWindow(); break;
    -        case 21: _t->showDebugWindowActivateConsole(); break;
    -        case 22: _t->showHelpMessageClicked(); break;
    -        case 23: _t->trayIconActivated((*reinterpret_cast< QSystemTrayIcon::ActivationReason(*)>(_a[1]))); break;
    -        case 24: _t->showNormalIfMinimized((*reinterpret_cast< bool(*)>(_a[1]))); break;
    -        case 25: _t->showNormalIfMinimized(); break;
    -        case 26: _t->toggleHidden(); break;
    -        case 27: _t->detectShutdown(); break;
    -        case 28: _t->showProgress((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
    +        case 5: _t->optionsClicked(); break;
    +        case 6: _t->aboutClicked(); break;
    +        case 7: _t->showDebugWindow(); break;
    +        case 8: _t->showDebugWindowActivateConsole(); break;
    +        case 9: _t->showHelpMessageClicked(); break;
    +        case 10: _t->trayIconActivated((*reinterpret_cast< QSystemTrayIcon::ActivationReason(*)>(_a[1]))); break;
    +        case 11: _t->showNormalIfMinimized((*reinterpret_cast< bool(*)>(_a[1]))); break;
    +        case 12: _t->showNormalIfMinimized(); break;
    +        case 13: _t->toggleHidden(); break;
    +        case 14: _t->detectShutdown(); break;
    +        case 15: _t->showProgress((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
             default: ;
             }
         } else if (_c == QMetaObject::IndexOfMethod) {
    @@ -255,13 +187,13 @@
         if (_id < 0)
             return _id;
         if (_c == QMetaObject::InvokeMetaMethod) {
    -        if (_id < 29)
    +        if (_id < 16)
                 qt_static_metacall(this, _c, _id, _a);
    -        _id -= 29;
    +        _id -= 16;
         } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
    -        if (_id < 29)
    +        if (_id < 16)
                 *reinterpret_cast<int*>(_a[0]) = -1;
    -        _id -= 29;
    +        _id -= 16;
         }
         return _id;
     }
    

    The slots for selecting tabs are missing in the out-of-tree build! This could be a matter of Qt's moc not finding the right bitcoin-config.h, or alternatively, not getting -DHAVE_CONFIG_H, and therefore getting a wrong value for ENABLE_WALLET.

    Edit: the -I. is missing for the moc lines:

    -DHAVE_CONFIG_H -I. qt/bitcoingui.h
    

    Becomes

    -DHAVE_CONFIG_H -I../../bitcoin-clean/src ../../bitcoin-clean/src/qt/bitcoingui.h
    
  16. laanwj commented at 2:04 PM on April 20, 2016: member

    @theuni The following solved it for me:

    diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include
    index 8443fe6..3b39919 100644
    --- a/src/Makefile.qt.include
    +++ b/src/Makefile.qt.include
    @@ -424,11 +424,11 @@ ui_%.h: %.ui
            $(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(UIC) -o $@ $< || (echo "Error creating $@"; false)
    
     %.moc: %.cpp
    -       $(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(MOC) $(QT_INCLUDES) $(MOC_DEFS) $< | \
    +       $(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(MOC) $(DEFAULT_INCLUDES) $(QT_INCLUDES) $(MOC_DEFS) $< | \
              $(SED) -e '/^\*\*.*Created:/d' -e '/^\*\*.*by:/d' > $@
    
     moc_%.cpp: %.h
    -       $(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(MOC) $(QT_INCLUDES) $(MOC_DEFS) $< | \
    +       $(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(MOC) $(DEFAULT_INCLUDES) $(QT_INCLUDES) $(MOC_DEFS) $< | \
              $(SED) -e '/^\*\*.*Created:/d' -e '/^\*\*.*by:/d' > $@
    
     %.qm: %.ts
    
  17. theuni commented at 3:46 PM on April 20, 2016: member

    @sipa Fine by me. @laanwj Thanks for tracking that down! Yes, that must've been a very confusing result :)

    There are a few other fixes needed for out-of-tree builds.

    • RCC is particularly unhappy with separate paths, so we have a hackish copy in there right now. I'm sure there's a better way.
    • We do some leveldb copying at the top-level make that should no longer be necessary.
    • Travis and Gitian descriptors should be switched to out-of-tree rather than copying to subtree as they are now

    I'd prefer to do those as a separate PR, but I can tack them on here if you'd prefer.

  18. laanwj commented at 9:39 AM on April 21, 2016: member

    I'd prefer including the changes that get out-of-tree build working here (so that we don't have an intermediate state with known brokenness). I agree with doing optimizations and improvements, as well as using it in gitian separately.

  19. laanwj commented at 7:15 AM on April 22, 2016: member

    Ok, just going ahead and merging this. I'll submit the qt fix myself.

  20. laanwj merged this on Apr 22, 2016
  21. laanwj closed this on Apr 22, 2016

  22. laanwj referenced this in commit 351abf9e03 on Apr 22, 2016
  23. laanwj referenced this in commit f59dceb44f on Apr 22, 2016
  24. jmcorgan referenced this in commit 932aedd99a on Jun 8, 2016
  25. thokon00 referenced this in commit d6843f76e4 on Jun 28, 2016
  26. nomnombtc referenced this in commit 232becc789 on Nov 12, 2016
  27. nomnombtc referenced this in commit 488be94c7c on Nov 12, 2016
  28. nomnombtc referenced this in commit 8106fe0abc on Nov 13, 2016
  29. sickpig referenced this in commit 4637bfc60f on Jan 4, 2017
  30. protonn referenced this in commit 4ac4b4fc81 on Apr 11, 2017
  31. lateminer referenced this in commit cf35a275c4 on Jan 4, 2018
  32. lateminer referenced this in commit 2edb55f44b on Jan 4, 2018
  33. zkbot referenced this in commit 59d6a92e7d on Sep 22, 2020
  34. zkbot referenced this in commit 514d868179 on Sep 25, 2020
  35. MarcoFalke 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-13 18:15 UTC

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