build: Make sqlite support optional (compile-time) #20156

pull luke-jr wants to merge 3 commits into bitcoin:master from luke-jr:opt_sqlite changing 8 files +57 −5
  1. luke-jr commented at 1:53 pm on October 15, 2020: member

    As a new requirement, sqlite support should be optional. This PR aims to be only minimum/blocker changes for 0.21.

    Potential follow-up PRs after this:

    • Make BDB support optional
    • Nicer error messages when user tries to load an unsupported wallet
    • Don’t compile descriptor wallet code if sqlite disabled
  2. in configure.ac:133 in 0fff198525 outdated
    127@@ -128,6 +128,12 @@ AC_ARG_ENABLE([wallet],
    128   [enable_wallet=$enableval],
    129   [enable_wallet=yes])
    130 
    131+AC_ARG_WITH([sqlite],
    132+  [AS_HELP_STRING([--without-sqlite],
    133+  [disable sqlite wallet support (default is yes if wallet is enabled and sqlite is found)])],
    


    Sjors commented at 2:19 pm on October 15, 2020:
    You mean (default is no? Or less ambiguous: enabled
  3. Sjors commented at 2:36 pm on October 15, 2020: member

    Concept ACK.

    Sqlite is already optional in depends using NO_SQLITE=1, but configure will still look for it (without this PR).

    I prefer to disable the creation of descriptor wallets if this flag is used (createwallet RPC and gui). That gives us the flexibility to use native Sqlite stuff for those wallets in the future, without having to worry about BDB upgrade paths.

  4. DrahtBot added the label Build system on Oct 15, 2020
  5. DrahtBot added the label Docs on Oct 15, 2020
  6. DrahtBot added the label Wallet on Oct 15, 2020
  7. DrahtBot commented at 4:26 pm on October 15, 2020: member

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

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #20206 (wallet, refactor: Include headers instead of function declarations by hebasto)
    • #20202 (wallet: Make BDB support optional by achow101)
    • #18077 (net: Add NAT-PMP port forwarding support by hebasto)
    • #16546 (External signer support - Wallet Box edition by Sjors)

    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.

  8. laanwj commented at 6:59 pm on October 15, 2020: member

    Make BDB support optional

    Making bdb optional would be more interesting looking forward. But no problem with this either, concept ACK.

  9. laanwj added this to the milestone 0.21.0 on Oct 15, 2020
  10. luke-jr force-pushed on Oct 15, 2020
  11. luke-jr commented at 8:21 pm on October 15, 2020: member

    Improved configure help per request, and added nicer behaviour in RPC/GUI around descriptor wallet stuff.

    (A future PR can remove descriptor wallet code entirely if desired.)

  12. Sjors commented at 9:12 am on October 16, 2020: member
    tACK f9b93a0 on macOS (though I couldn’t test the scenario of not having a sqlite library at all on the system)
  13. hebasto commented at 12:11 pm on October 18, 2020: member
    Concept ACK.
  14. in src/wallet/walletutil.cpp:11 in f9b93a0053 outdated
     7@@ -8,7 +8,11 @@
     8 #include <util/system.h>
     9 
    10 bool ExistsBerkeleyDatabase(const fs::path& path);
    11+#ifdef USE_SQLITE
    


    promag commented at 10:20 pm on October 18, 2020:
    nit, do this in definition instead?
  15. in src/wallet/walletdb.cpp:1017 in f9b93a0053 outdated
    1013@@ -1012,6 +1014,7 @@ std::unique_ptr<WalletDatabase> MakeDatabase(const fs::path& path, const Databas
    1014         if (ExistsBerkeleyDatabase(path)) {
    1015             format = DatabaseFormat::BERKELEY;
    1016         }
    1017+#ifdef USE_SQLITE
    


    promag commented at 10:22 pm on October 18, 2020:
    No need for this since ExistsSQLiteDatabase is false.

    hebasto commented at 12:32 pm on October 20, 2020:
    It is needed, as ExistsSQLiteDatabase is defined in wallet/sqlite.h.
  16. in src/wallet/walletdb.cpp:1063 in f9b93a0053 outdated
    1056     if (format && format == DatabaseFormat::SQLITE) {
    1057         return MakeSQLiteDatabase(path, options, status, error);
    1058     }
    1059+#endif
    1060 
    1061     return MakeBerkeleyDatabase(path, options, status, error);
    


    promag commented at 10:23 pm on October 18, 2020:
    nit, assert format == DatabaseFormat::BERKELEY.

    luke-jr commented at 1:37 pm on October 20, 2020:
    It can also be unset. Used assert(format != DatabaseFormat::SQLITE); in an #else
  17. promag commented at 10:25 pm on October 18, 2020: member
    Concept ACK, looks good.
  18. in src/Makefile.am:382 in 5c19bd0f4b outdated
    378   wallet/walletutil.cpp \
    379   wallet/coinselection.cpp \
    380   $(BITCOIN_CORE_H)
    381 
    382+if USE_SQLITE
    383+libbitcoin_wallet_a_SOURCES += wallet/sqlite.cpp
    


    achow101 commented at 7:02 pm on October 19, 2020:
    Shouldn’t wallet/sqlite.h be included here too?

    luke-jr commented at 7:30 pm on October 19, 2020:
    Not based on how we’re handling other stuff

    achow101 commented at 9:27 pm on October 19, 2020:
    Hmm. I would expect that systems without sqlite’s sqlite3.h header would then fail to compile.

    luke-jr commented at 1:38 pm on October 20, 2020:
    It’s not used despite being listed
  19. in src/qt/createwalletdialog.cpp:40 in 08c52bd56b outdated
    33@@ -34,6 +34,11 @@ CreateWalletDialog::CreateWalletDialog(QWidget* parent) :
    34             ui->disable_privkeys_checkbox->setChecked(false);
    35         }
    36     });
    37+
    38+#ifndef USE_SQLITE
    39+    ui->descriptor_checkbox->setToolTip(tr("Compiled without sqlite support (required for descriptor wallets)"));
    40+    ui->descriptor_checkbox->setEnabled(false);
    


    achow101 commented at 9:38 pm on October 19, 2020:
    I think this should also do setChecked(false). When descriptor wallets become the default and this is default checked, that will be necessary.
  20. in configure.ac:133 in 5c19bd0f4b outdated
    127@@ -128,6 +128,12 @@ AC_ARG_ENABLE([wallet],
    128   [enable_wallet=$enableval],
    129   [enable_wallet=yes])
    130 
    131+AC_ARG_WITH([sqlite],
    132+  [AS_HELP_STRING([--without-sqlite],
    133+  [disable sqlite wallet support (default is enabled if wallet is enabled and sqlite is found)])],
    


    hebasto commented at 12:04 pm on October 20, 2020:

    5c19bd0f4b893a91c02e652ac8f45ef0ccdeca1c

    Mind avoiding negative form in help string:

    0  [AS_HELP_STRING([--with-sqlite=yes|no|auto],
    1  [enable sqlite wallet support (default: auto, i.e., enabled if wallet is enabled and sqlite is found)])],
    

    ?


    luke-jr commented at 1:41 pm on October 20, 2020:
    Done
  21. in configure.ac:1238 in 5c19bd0f4b outdated
    1234+    if test "x$use_sqlite" != "xno"; then
    1235+      PKG_CHECK_MODULES([SQLITE], [sqlite3 >= 3.7.17], [have_sqlite=yes], [have_sqlite=no])
    1236+    fi
    1237+    AC_MSG_CHECKING([whether to build wallet with support for sqlite])
    1238+    if test "x$use_sqlite" = "xno"; then
    1239+      use_sqlite=no
    


    hebasto commented at 12:07 pm on October 20, 2020:

    5c19bd0f4b893a91c02e652ac8f45ef0ccdeca1c

    is this a tautology?


    luke-jr commented at 1:43 pm on October 20, 2020:
    Yes, but not having anything here would be a bug.
  22. in src/Makefile.am:359 in 5c19bd0f4b outdated
    355@@ -356,7 +356,7 @@ endif
    356 
    357 # wallet: shared between bitcoind and bitcoin-qt, but only linked
    358 # when wallet enabled
    359-libbitcoin_wallet_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
    360+libbitcoin_wallet_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(SQLITE_CFLAGS)
    


    hebasto commented at 12:21 pm on October 20, 2020:

    5c19bd0f4b893a91c02e652ac8f45ef0ccdeca1c

    Nice! During reviewing #19077 I’ve noticed that the SQLITE_CFLAGS is empty, and I was not worried about adding it to the libbitcoin_wallet_a_CPPFLAGS. But consistency is good, it is not guaranteed the SQLITE_CFLAGS will be empty always :)

  23. hebasto changes_requested
  24. hebasto commented at 12:41 pm on October 20, 2020: member
    Approach ACK f9b93a0053476055759124160efa87978d6b635f
  25. Make sqlite support optional (compile-time) 7b54d768e1
  26. GUI: Create Wallet: Nicely disable descriptor wallet checkbox if sqlite support not compiled in 6608fec332
  27. RPC: createwallet: Nicer error message if descriptor wallet requested and sqlite support not compiled in bbb42a6896
  28. luke-jr force-pushed on Oct 20, 2020
  29. luke-jr commented at 1:45 pm on October 20, 2020: member
    Assert added, checkbox forced off, and help message made to match others
  30. jonasschnelli commented at 2:05 pm on October 20, 2020: contributor
    Concept ACK – however, I agree with @laanwj that making BerkleyDB optional could be more interesting for many users.
  31. luke-jr commented at 2:17 pm on October 20, 2020: member
    @jonasschnelli I don’t disagree, it’s just outside the scope of this PR. Hopefully once it’s merged, someone (maybe me) will extend it to BDB and we can discuss if it belongs in 0.21 or 0.22. :)
  32. jonasschnelli commented at 2:20 pm on October 20, 2020: contributor

    Would detecting an sqlite wallet (look for the sqlite magic) make sense to give more specific errors in case someone tries to load a sqlite wallet with a non-sqlite-supporting bitcoind/qt? (could be a follow up PR is complicated).

    Current error in the deamon…

    02020-10-20T14:17:40Z Error: "/tmp/dummy/regtest/wallets/test/wallet.dat" corrupt. Try using the wallet tool bitcoin-wallet to salvage or restoring a backup.
    1Error: "/tmp/dummy/regtest/wallets/test/wallet.dat" corrupt. Try using the wallet tool bitcoin-wallet to salvage or restoring a backup.
    

    and the GUI:

  33. jonasschnelli commented at 2:54 pm on October 20, 2020: contributor
    Tested ACK bbb42a68961a8ae1e4ef3221ffb1d5ff7272b075
  34. luke-jr commented at 3:12 pm on October 20, 2020: member
    @jonasschnelli Added nicer error messages to the possible followup list
  35. achow101 commented at 4:13 pm on October 20, 2020: member
    ACK bbb42a68961a8ae1e4ef3221ffb1d5ff7272b075
  36. hebasto approved
  37. hebasto commented at 4:36 pm on October 20, 2020: member

    ACK bbb42a68961a8ae1e4ef3221ffb1d5ff7272b075, tested on Linux Mint 20 (x86_64, Qt 5.12.8).

    Also tested with uninstalled libsqlite3-dev package.

  38. MarcoFalke removed the label Docs on Oct 21, 2020
  39. MarcoFalke added the label Needs gitian build on Oct 21, 2020
  40. MarcoFalke added the label Needs Guix build on Oct 21, 2020
  41. Sjors commented at 4:10 pm on October 21, 2020: member
    re-utACK bbb42a68961a8ae1e4ef3221ffb1d5ff7272b075
  42. DrahtBot commented at 7:10 am on October 23, 2020: member

    Gitian builds

    File commit f5bd46a4cc6d395ce71ecb99852c1774235a249c(master) commit 6ffb6bb81f42731dfdf4b5d0cbb30a6674841ab3(master and this pull)
    bitcoin-core-linux-0.21-res.yml d1971dabc444008d... 0798c203b6e09a05...
    bitcoin-core-osx-0.21-res.yml de235a951f7a465e... a94f4cc48a9f1586...
    bitcoin-core-win-0.21-res.yml f75ce7b9355d334c... dad19f4859e2f299...
    *-aarch64-linux-gnu-debug.tar.gz 6ed9c70434fc7fc2... 58b346b18dd66f04...
    *-aarch64-linux-gnu.tar.gz 3af5f18ffa364c24... 304668f0ebf061c7...
    *-arm-linux-gnueabihf-debug.tar.gz 098fc410215e7c42... 766fa391cdcc9bf7...
    *-arm-linux-gnueabihf.tar.gz 3f2c975b713698b2... 6343eb5496bf9006...
    *-osx-unsigned.dmg 012c0dc0e1b3f2ec... 697b8c30db7cef8c...
    *-osx64.tar.gz 6409b02ac19538f2... 8a03777c8d930f6f...
    *-riscv64-linux-gnu-debug.tar.gz 6da1f76714b4dbfe... e1db67a1c0303b33...
    *-riscv64-linux-gnu.tar.gz a90367c39515c3b4... e81e39272fb13dcc...
    *-win64-debug.zip 453e395581992f20... dcc41a9e711c3444...
    *-win64-setup-unsigned.exe 8b50662e73d518ea... aac04da6aebe94f0...
    *-win64.zip aa74cb3b0978fb5a... cf2ea51afa26683c...
    *-x86_64-linux-gnu-debug.tar.gz 7e318d3ab76e48eb... ce3626928a07add9...
    *-x86_64-linux-gnu.tar.gz 6447ef245d9ee8f6... 4200ff1531fdffb0...
    *.tar.gz 8bce7f0b98fd7610... f3498bf706a94c51...
    linux-build.log 3c348dc643432917... e56cf9dad51226b2...
    osx-build.log 083ca63c793f3b21... efc09f7607615616...
    win-build.log 72ceb0afecdf12df... 7f66e15bea4fbcc6...
    bitcoin-core-linux-0.21-res.yml.diff bf7e89aa937f8ecf...
    bitcoin-core-osx-0.21-res.yml.diff d8f55dc5197610b0...
    bitcoin-core-win-0.21-res.yml.diff 79ef4c9af9a45be7...
    linux-build.log.diff 96380729f01a98c7...
    osx-build.log.diff 8999f097f0fa0113...
    win-build.log.diff 10e85d6d03b33e8f...
  43. DrahtBot removed the label Needs gitian build on Oct 23, 2020
  44. DrahtBot commented at 12:38 pm on October 24, 2020: member

    Guix builds

    File commit 9af7c1993b3512a7230f723b1923abd496989c59(master) commit 7599eeae0e860fe281987ae2059a240de8169777(master and this pull)
    *-aarch64-linux-gnu-debug.tar.gz a0883e94fe7d7b45... 0a1e730bd2d66545...
    *-aarch64-linux-gnu.tar.gz f515a87f3d749152... 545103eda676c9d5...
    *-arm-linux-gnueabihf-debug.tar.gz 200e141a7d2c4169... 75ea40a17872c596...
    *-arm-linux-gnueabihf.tar.gz a9f0d5752bab18d4... e550ac81679954d5...
    *-riscv64-linux-gnu-debug.tar.gz 862c0b91637b1d13... 84c2da6f70a1c479...
    *-riscv64-linux-gnu.tar.gz b7ddd167f9c6089c... d2270388bd4aeba0...
    *-win-unsigned.tar.gz d9fd15e501580e57... 8e71354ee506a29e...
    *-win64-debug.zip 65810928272e2290... d8aa8c3210ab0446...
    *-win64-setup-unsigned.exe 95eeb02773751b70... c0bb2c8c61f27617...
    *-win64.zip 39e8e65f96ba0048... 4b68399bc9c1c889...
    *-x86_64-linux-gnu-debug.tar.gz 5dc4fdbe449bd036... 5365546fff5c13b0...
    *-x86_64-linux-gnu.tar.gz 3949c68642f0c01a... b936ca945ddc5a0d...
    *.tar.gz 333868caaa79db4d... 067248d9cc59d710...
    guix_build.log 33920a430da60d00... 0ed036c5f20963a3...
    guix_build.log.diff f3a4bd03af9d9f2a...
  45. DrahtBot removed the label Needs Guix build on Oct 24, 2020
  46. laanwj renamed this:
    Make sqlite support optional (compile-time)
    build: Make sqlite support optional (compile-time)
    on Oct 29, 2020
  47. laanwj merged this on Oct 29, 2020
  48. laanwj closed this on Oct 29, 2020

  49. sidhujag referenced this in commit fecc3a6612 on Oct 29, 2020
  50. meshcollider referenced this in commit 0c2eb7f8de on Nov 1, 2020
  51. laanwj referenced this in commit 86bf3ae3b5 on Nov 23, 2020
  52. DrahtBot locked this on Feb 15, 2022

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: 2024-12-18 18:12 UTC

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