UNIX BUILD NOTES
Some notes on how to build Bitcoin Core in Unix.
(For BSD specific instructions, see
build-*bsd.md in this directory.)
Note
Always use absolute paths to configure and compile Bitcoin Core and the dependencies. For example, when specifying the path of the dependency:
../dist/configure --enable-cxx --disable-shared --with-pic --prefix=$BDB_PREFIX
Here BDB_PREFIX must be an absolute path - it is defined using $(pwd) which
ensures the usage of the absolute path.
To Build
./autogen.sh
./configure
make # use "-j N" for N parallel jobs
make install # optional
This will build bitcoin-qt as well, if the dependencies are met.
Dependencies
These dependencies are required:
Library
|
Purpose
|
Description
|
libboost |
Utility |
Library for threading, data structures, etc |
libevent |
Networking |
OS independent asynchronous networking |
Optional dependencies:
Library
|
Purpose
|
Description
|
miniupnpc |
UPnP
Support |
Firewall-jumping support |
libnatpmp |
NAT-PMP
Support |
Firewall-jumping support |
libdb4.8 |
Berkeley DB |
Optional, wallet storage (only needed when wallet enabled) |
qt |
GUI |
GUI toolkit (only needed when GUI enabled) |
libqrencode |
QR codes in GUI |
Optional for generating QR codes (only needed when GUI enabled) |
univalue |
Utility |
JSON parsing and encoding (bundled version will be used unless --with-system-univalue passed to configure) |
libzmq3 |
ZMQ notification |
Optional, allows generating ZMQ notifications (requires ZMQ version >= 4.0.0) |
sqlite3 |
SQLite DB |
Optional, wallet storage (only needed when wallet enabled) |
systemtap |
Tracing (USDT) |
Optional, statically defined tracepoints |
For the versions used, see
dependencies.md
Memory Requirements
C++ compilers are memory-hungry. It is recommended to have at least 1.5 GB of memory available when compiling Bitcoin Core. On systems with less, gcc can be tuned to conserve memory with additional CXXFLAGS:
./configure CXXFLAGS="--param ggc-min-expand=1 --param ggc-min-heapsize=32768"
Alternatively, or in addition, debugging information can be skipped for compilation. The default compile flags are -g -O2, and can be changed with:
./configure CXXFLAGS="-O2"
Finally, clang (often less resource hungry) can be used instead of gcc, which is used by default:
./configure CXX=clang++ CC=clang
Linux Distribution Specific Instructions
Ubuntu & Debian
Dependency Build Instructions
Build requirements:
sudo apt-get install build-essential libtool autotools-dev automake pkg-config bsdmainutils python3
Now, you can either build from self-compiled
depends or install the required dependencies:
sudo apt-get install libevent-dev libboost-dev libboost-system-dev libboost-filesystem-dev libboost-test-dev
Berkeley DB is required for the wallet.
Ubuntu and Debian have their own
libdb-dev and
libdb++-dev packages, but these will install Berkeley DB 5.1 or later. This will break binary wallet compatibility with the distributed executables, which are based on BerkeleyDB 4.8. If you do not care about wallet compatibility,
pass --with-incompatible-bdb to configure.
Otherwise, you can build Berkeley DB
yourself.
SQLite is required for the descriptor wallet:
sudo apt install libsqlite3-dev
To build Bitcoin Core without wallet, see
Disable-wallet mode
Optional port mapping libraries (see:
--with-miniupnpc, --enable-upnp-default, and --with-natpmp, --enable-natpmp-default):
sudo apt install libminiupnpc-dev libnatpmp-dev
ZMQ dependencies (provides ZMQ API):
sudo apt-get install libzmq3-dev
User-Space, Statically Defined Tracing (USDT) dependencies:
sudo apt install systemtap-sdt-dev
GUI dependencies:
If you want to build bitcoin-qt, make sure that the required packages for Qt development are installed. Qt 5 is necessary to build the GUI. To build without GUI pass
--without-gui.
To build with Qt 5 you need the following:
sudo apt-get install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools
libqrencode (optional) can be installed with:
sudo apt-get install libqrencode-dev