2021-06-18 21:18:35 +02:00
|
|
|
# Unix Build of Dogecoin Core
|
2010-08-29 18:58:15 +02:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
1. [Install dependencies](#install-dependencies)
|
|
|
|
* [Ubuntu & Debian](#ubuntu--debian)
|
|
|
|
* [Fedora](#Fedora)
|
|
|
|
* [FreeBSD](#FreeBSD)
|
|
|
|
2. [Build steps](#build-steps)
|
|
|
|
3. [Build configuration](#build-configuration)
|
|
|
|
* [Enable Qt GUI](#enable-qt-gui)
|
|
|
|
* [Wallet](#wallet)
|
|
|
|
* [Disable-wallet mode](#disable-wallet-mode)
|
|
|
|
* [Miniupnpc](#miniupnpc)
|
|
|
|
* [Security](#security)
|
|
|
|
* [Memory requirements](#memory-requirements)
|
|
|
|
4. [ARM Cross-compilation](#arm-cross-compilation)
|
2015-09-28 11:24:23 +02:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
## Install dependencies
|
2014-05-19 12:42:57 +02:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
You must install required dependencies to build a basic Dogecoin daemon, optional dependencies may vary according to your requirements.
|
2014-05-19 12:42:57 +02:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
Wallet is optional to run a node, see [Wallet](#wallet) section to enable them.
|
2014-05-19 12:42:57 +02:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
**Required dependencies :**
|
2014-11-19 16:15:39 +01:00
|
|
|
|
2014-03-08 22:07:59 +01:00
|
|
|
Library | Purpose | Description
|
|
|
|
------------|------------------|----------------------
|
2015-09-04 10:59:34 +02:00
|
|
|
libssl | Crypto | Random Number Generation, Elliptic Curve Cryptography
|
|
|
|
libboost | Utility | Library for threading, data structures, etc
|
|
|
|
libevent | Networking | OS independent asynchronous networking
|
2013-05-20 06:30:00 +02:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
**Optional dependencies:**
|
2011-10-09 11:04:35 +02:00
|
|
|
|
2014-11-19 16:15:39 +01:00
|
|
|
Library | Purpose | Description
|
|
|
|
------------|------------------|----------------------
|
|
|
|
miniupnpc | UPnP Support | Firewall-jumping support
|
2017-04-18 14:40:50 +02:00
|
|
|
libdb5.1 | Berkeley DB | Wallet storage (only needed when wallet enabled)
|
2014-11-19 16:15:39 +01:00
|
|
|
qt | GUI | GUI toolkit (only needed when GUI enabled)
|
|
|
|
protobuf | Payments in GUI | Data interchange format used for payment protocol (only needed when GUI enabled)
|
|
|
|
libqrencode | QR codes in GUI | Optional for generating QR codes (only needed when GUI enabled)
|
2016-02-01 19:49:24 +01:00
|
|
|
univalue | Utility | JSON parsing and encoding (bundled version will be used unless --with-system-univalue passed to configure)
|
2015-09-29 19:48:45 +02:00
|
|
|
libzmq3 | ZMQ notification | Optional, allows generating ZMQ notifications (requires ZMQ version >= 4.x)
|
2011-10-09 11:04:35 +02:00
|
|
|
|
2014-11-19 16:15:39 +01:00
|
|
|
For the versions used in the release, see [release-process.md](release-process.md) under *Fetch and build inputs*.
|
2011-10-09 11:04:35 +02:00
|
|
|
|
2014-03-31 05:59:11 +02:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
### Ubuntu & Debian
|
2016-01-28 04:17:02 +01:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
**Required dependencies** :
|
|
|
|
```bash
|
|
|
|
sudo apt-get install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils
|
|
|
|
sudo apt-get install libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-program-options-dev libboost-test-dev libboost-thread-dev
|
|
|
|
```
|
2013-05-20 06:30:00 +02:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
**Optional dependencies** :
|
|
|
|
```bash
|
|
|
|
# Qt (required for dogecoin-qt GUI)
|
|
|
|
sudo apt-get install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler libqrencode-dev
|
2015-11-03 11:36:09 +01:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
# BerkeleyDB (version 5.3)
|
|
|
|
sudo apt install libdb5.3++-dev libdb5.3++ libdb5.3-dev
|
2015-11-03 11:36:09 +01:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
# ZMQ (provides ZMQ API 4.x)
|
|
|
|
sudo apt-get install libzmq3-dev
|
2016-10-18 21:43:03 +02:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
# Miniupnpc
|
|
|
|
sudo apt-get install libminiupnpc-dev
|
|
|
|
```
|
2014-02-27 10:29:18 +01:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
## Build steps
|
2012-08-30 05:19:00 +02:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
According to installed dependencies, the following steps will compile `dogecoind`, `dogecoin-cli` and `dogecoin-qt`.
|
2014-03-13 18:15:51 +01:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
```bash
|
|
|
|
./autogen.sh
|
|
|
|
./configure
|
|
|
|
make
|
|
|
|
make install # optional
|
|
|
|
```
|
|
|
|
See [Build configuration](#build-configuration) for extra settings.
|
2012-08-30 05:19:00 +02:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
## Build configuration
|
2013-05-20 06:30:00 +02:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
Configurations are done during the `./configure` step. Use `--help` to see all available options.
|
2010-08-29 18:58:15 +02:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
#### Enable Qt GUI
|
|
|
|
Create `dogecoin-qt`, the core wallet GUI.
|
|
|
|
```bash
|
|
|
|
./configure --with-gui
|
|
|
|
```
|
2015-09-29 19:48:45 +02:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
#### Wallet
|
|
|
|
BerkeleyDB is required for wallet functionality and use the `wallet.dat` file.
|
2015-09-29 19:48:45 +02:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
By default, **Dogecoin Core expect BerkeleyDB 5.1**.
|
|
|
|
You can use a different version by specifying `--with-incompatible-bdb` flag.
|
2013-10-15 14:34:12 +02:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
If no package is available for your distribution in optional dependencies, you can build BerkeleyDB from source :
|
|
|
|
```bash
|
|
|
|
# Install script for BerkeleyDB 5.1
|
2013-10-15 14:34:12 +02:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
# BerkeleyDB installation directory
|
|
|
|
BDB_PREFIX=$(pwd)/bdb
|
|
|
|
mkdir $BDB_PREFIX
|
2013-10-15 14:34:12 +02:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
# Fetch the source and verify shasum
|
|
|
|
wget 'http://download.oracle.com/berkeley-db/db-5.1.29.NC.tar.gz'
|
|
|
|
echo '08238e59736d1aacdd47cfb8e68684c695516c37f4fbe1b8267dde58dc3a576c db-5.1.29.NC.tar.gz' | sha256sum -c
|
2013-10-15 14:34:12 +02:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
# Extract sources
|
|
|
|
tar -xzvf db-5.1.29.NC.tar.gz
|
|
|
|
cd db-5.1.29.NC/build_unix/
|
2014-01-21 09:05:39 +01:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
# Apply patch (see https://gist.github.com/danieldk/5700533)
|
|
|
|
sed -i 's/__atomic_compare_exchange/__atomic_compare_exchange_db/g' ../src/dbinc/atomic.h
|
2014-01-21 09:05:39 +01:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
# Note: Do a static build so that it can be embedded into the executable, instead of having to find a .so at runtime
|
|
|
|
../dist/configure --prefix=$BDB_PREFIX --enable-cxx --disable-shared --with-pic
|
|
|
|
make install
|
|
|
|
```
|
2013-10-15 14:34:12 +02:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
Then use `LDFLAGS` and `CPPFLAGS` during configuration to link the database :
|
|
|
|
```bash
|
|
|
|
./configure LDFLAGS="-L${BDB_PREFIX}/lib/" CPPFLAGS="-I${BDB_PREFIX}/include/"
|
|
|
|
```
|
2013-10-15 14:34:12 +02:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
#### Disable-wallet mode
|
|
|
|
When the intention is to run only a P2P node without a wallet, Dogecoin may be compiled in
|
|
|
|
disable-wallet mode with:
|
2011-03-26 13:01:27 +01:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
```bash
|
|
|
|
./configure --disable-wallet
|
|
|
|
```
|
2010-08-29 18:58:15 +02:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
Mining is also possible in disable-wallet mode, but only using the `getblocktemplate` RPC
|
|
|
|
call, not `getwork`.
|
2010-08-29 18:58:15 +02:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
#### Miniupnpc
|
2014-11-19 16:15:39 +01:00
|
|
|
|
|
|
|
[miniupnpc](http://miniupnp.free.fr/) may be used for UPnP port mapping. It can be downloaded from [here](
|
|
|
|
http://miniupnp.tuxfamily.org/files/). UPnP support is compiled in and
|
|
|
|
turned off by default. See the configure options for upnp behavior desired:
|
|
|
|
|
2014-05-01 09:56:36 +02:00
|
|
|
```bash
|
2021-06-18 21:18:35 +02:00
|
|
|
--without-miniupnpc #No UPnP support miniupnp not required
|
|
|
|
--disable-upnp-default #(the default) UPnP support turned off by default at runtime
|
|
|
|
--enable-upnp-default #UPnP support turned on by default at runtime
|
2014-05-01 09:56:36 +02:00
|
|
|
```
|
2010-08-29 18:58:15 +02:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
#### Security
|
2018-01-20 19:35:31 +01:00
|
|
|
To help make your Dogecoin installation more secure by making certain attacks impossible to
|
2013-05-28 01:55:01 +02:00
|
|
|
exploit even if a vulnerability is found, binaries are hardened by default.
|
|
|
|
This can be disabled with:
|
|
|
|
|
2013-12-09 11:08:08 +01:00
|
|
|
Hardening Flags:
|
2021-06-18 21:18:35 +02:00
|
|
|
```bash
|
|
|
|
./configure --enable-hardening
|
|
|
|
./configure --disable-hardening
|
|
|
|
```
|
2013-05-28 01:55:01 +02:00
|
|
|
|
|
|
|
Hardening enables the following features:
|
2011-09-08 18:50:54 +02:00
|
|
|
|
|
|
|
* Position Independent Executable
|
|
|
|
Build position independent code to take advantage of Address Space Layout Randomization
|
2015-04-28 16:48:28 +02:00
|
|
|
offered by some kernels. Attackers who can cause execution of code at an arbitrary memory
|
|
|
|
location are thwarted if they don't know where anything useful is located.
|
2011-09-08 18:50:54 +02:00
|
|
|
The stack and heap are randomly located by default but this allows the code section to be
|
|
|
|
randomly located as well.
|
|
|
|
|
2015-04-28 16:48:28 +02:00
|
|
|
On an AMD64 processor where a library was not compiled with -fPIC, this will cause an error
|
2021-06-18 21:18:35 +02:00
|
|
|
such as: `relocation R_X86_64_32 against '......' can not be used when making a shared object;`
|
2011-09-08 18:50:54 +02:00
|
|
|
|
|
|
|
To test that you have built PIE executable, install scanelf, part of paxutils, and use:
|
2013-05-20 06:30:00 +02:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
`scanelf -e ./dogecoin`
|
2011-09-08 18:50:54 +02:00
|
|
|
|
|
|
|
The output should contain:
|
2015-11-04 13:22:45 +01:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
`TYPE ET_DYN`
|
2011-09-08 18:50:54 +02:00
|
|
|
|
|
|
|
* Non-executable Stack
|
2018-01-20 19:35:31 +01:00
|
|
|
If the stack is executable, trivial stack-based buffer overflow exploits are possible if
|
|
|
|
vulnerable buffers are found. By default, Dogecoin should be built with a non-executable stack,
|
2011-09-08 18:50:54 +02:00
|
|
|
but if one of the libraries it uses asks for an executable stack or someone makes a mistake
|
|
|
|
and uses a compiler extension which requires an executable stack, it will silently build an
|
|
|
|
executable without the non-executable stack protection.
|
|
|
|
|
2018-01-20 19:35:31 +01:00
|
|
|
To verify that the stack is non-executable after compiling, use:
|
|
|
|
`scanelf -e ./dogecoin`
|
2011-09-08 18:50:54 +02:00
|
|
|
|
|
|
|
the output should contain:
|
2021-06-18 21:18:35 +02:00
|
|
|
`STK/REL/PTL RW- R-- RW-`
|
2013-11-29 18:37:29 +01:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
The `STK RW-` means that the stack is readable and writeable, but not executable.
|
2013-11-29 18:37:29 +01:00
|
|
|
|
2013-12-08 15:26:08 +01:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
#### Memory Requirements
|
2016-01-28 18:10:15 +01:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
C++ compilers are memory-hungry. It is recommended to have at
|
|
|
|
least 1.5 GB of memory available when compiling Dogecoin Core.
|
|
|
|
On systems with less, gcc can be tuned to conserve memory with additional CXXFLAGS:
|
2016-01-28 18:10:15 +01:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
```bash
|
|
|
|
./configure CXXFLAGS="--param ggc-min-expand=1 --param ggc-min-heapsize=32768"
|
|
|
|
```
|
2016-03-30 16:29:56 +02:00
|
|
|
|
2021-06-18 21:18:35 +02:00
|
|
|
## ARM Cross-compilation
|
2016-03-30 16:29:56 +02:00
|
|
|
|
|
|
|
These steps can be performed on, for example, an Ubuntu VM. The depends system
|
|
|
|
will also work on other Linux distributions, however the commands for
|
|
|
|
installing the toolchain will be different.
|
|
|
|
|
2016-08-29 10:33:36 +02:00
|
|
|
Make sure you install the build requirements mentioned above.
|
|
|
|
Then, install the toolchain and curl:
|
2021-06-18 21:18:35 +02:00
|
|
|
```bash
|
|
|
|
sudo apt-get install g++-arm-linux-gnueabihf curl
|
|
|
|
```
|
2016-03-30 16:29:56 +02:00
|
|
|
|
|
|
|
To build executables for ARM:
|
2021-06-18 21:18:35 +02:00
|
|
|
```bash
|
|
|
|
cd depends
|
|
|
|
make HOST=arm-linux-gnueabihf NO_QT=1
|
|
|
|
cd ..
|
|
|
|
./configure --prefix=$PWD/depends/arm-linux-gnueabihf --enable-glibc-back-compat --enable-reduce-exports LDFLAGS=-static-libstdc++
|
|
|
|
make
|
|
|
|
```
|
2016-04-09 02:15:41 +02:00
|
|
|
For further documentation on the depends system see [README.md](../depends/README.md) in the depends directory.
|