Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jonatack/9f57d398656433de5a5e04d5e0e4447e to your computer and use it in GitHub Desktop.
Save jonatack/9f57d398656433de5a5e04d5e0e4447e to your computer and use it in GitHub Desktop.
How to compile Bitcoin Core with wallet, from source, on Linux Debian

How to compile Bitcoin Core from source on Linux Debian and run the unit and functional tests

Last updated: 16 March 2019

Hi! This article now lives at where I will continue to update it. Cheers.

This is a simplified compilation of the various docs in Don't hesitate to read them for more information.

All steps are to be run from your terminal emulator, i.e. the command line.

  1. Ensure the dependencies are installed:

    • sudo apt-get install build-essential libtool autotools-dev automake pkg-config bsdmainutils python3 libssl-dev libevent-dev libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev libminiupnpc-dev libzmq3-dev libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler git ccache
  2. Download the Bitcoin source files by git cloning the repository:

    • git clone
  3. Install Berkeley DB (BDB) v4.8, a backward-compatible version needed for the wallet, using the script in /contrib:

    • Enter your local copy of the bitcoin repository: cd bitcoin
    • Now that you are in the root of the bitcoin repository, run ./contrib/ `pwd`
    • Take note of the instructions displayed in the terminal at the end of the BDB installation process:
      db4 build complete.

      When compiling bitcoind, run `./configure` in the following way:

      export BDB_PREFIX='<PATH-TO>/db4'

      ./configure BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" BDB_CFLAGS="-I${BDB_PREFIX}/include" ...
  1. [Recommended] Compile from a tagged release branch instead of master, unless you really want to test the bleeding edge:

    • git tag -n | sort -V to see tags and descriptions ordered by most recent last
    • git checkout <TAG> to use a tagged release, for example: git checkout v0.18.0rc2
  2. Compile Bitcoin from source, optionally with lcov and gprof enabled:

    • ./
    • Use the output from the BDB build above for the exact export command: export BDB_PREFIX='<PATH-TO>/db4'
    • ./configure BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" BDB_CFLAGS="-I${BDB_PREFIX}/include" --enable-lcov --enable-gprof
    • make, or if you have multiple threads on your machine, you can tell make to utilize all of them and reduce compile time significantly with: make -j"$(($(nproc)+1))"
  3. Run unit tests:

    • Unit tests only: make check
    • Unit tests with coverage report (if lcov was enabled): make cov
  4. Run functional tests:

    • test/functional/ or test/functional/ --extended
Copy link

It went so well, till it came to check it

CXX interfaces/libbitcoin_wallet_a-wallet.o
In file included from ./wallet/walletdb.h:12:0,
from ./wallet/wallet.h:23,
from interfaces/wallet.cpp:32:
./wallet/db.h:24:10: fatal error: db_cxx.h: Datei oder Verzeichnis nicht gefunden
#include <db_cxx.h>
compilation terminated.
Makefile:8223: recipe for target 'interfaces/libbitcoin_wallet_a-wallet.o' failed
make[2]: *** [interfaces/libbitcoin_wallet_a-wallet.o] Error 1
make[2]: Verzeichnis „/usr/phase/bitcoin/bitcoin/src“ wird verlassen
Makefile:12466: recipe for target 'check-recursive' failed
make[1]: *** [check-recursive] Error 1
make[1]: Verzeichnis „/usr/phase/bitcoin/bitcoin/src“ wird verlassen
Makefile:775: recipe for target 'check-recursive' failed
make: *** [check-recursive] Error 1

It is still the Wallet,,, btw i used the 0.18 Final as try to compile on Ubuntu 18.04.2 Full install, no virtual Machine.
Same thing happened with my clone from the Windows 10 Installation tried to make a 3 OS Clone of my old Lady on the other HD, no problems with the Path and everything, but the Wallet, i dont want to run my Node naked, a Wallet is all i want ;)

Copy link

RussHarben commented Jul 2, 2020

Just in case it's not clear, in Step 5, make sure to replace <PATH-TO> in the export command (export BDB_PREFIX='<PATH-TO>/db4') with the actual path from your system produced in the output from Step 3.

Copy link

jonatack commented Jul 3, 2020

Thanks for commenting.

For information, this gist is old (March 2019) and since November 2019 is actively maintained and much more complete at:


Copy link

Thanks @jonatack, That link was super helpful

Copy link

Thank you @Oliver-ke, happy to hear.

Copy link

Does this guide apply for Ubuntu WSL too?

Copy link

@Blazing-Mike I haven't tried (Debian user here), but Ubuntu and Debian should be the same or very close--see Let me know if you encounter issues.

Note that this gist is old (March 2019) and the current version of this doc is here:

Copy link

@jonatack thanks I just wanted to know if procedure for compilation for Ubuntu would work for WSL Ubuntu.... But I have compiled it already 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment