]> Git Repo - VerusCoin.git/blame - doc/build-unix.md
Use -debug=zrpc for z_* rpc calls (#1504)
[VerusCoin.git] / doc / build-unix.md
CommitLineData
fb537854
NW
1*** Warning: This document has not been updated for Zcash and may be inaccurate. ***
2
0a61b0df 3UNIX BUILD NOTES
2341e9b5 4====================
00a88745 5Some notes on how to build Bitcoin in Unix.
0a61b0df 6
f701da8f
KZ
7Note
8---------------------
9Always use absolute paths to configure and compile bitcoin and the dependencies,
10for example, when specifying the the path of the dependency:
11
12 ../dist/configure --enable-cxx --disable-shared --with-pic --prefix=$BDB_PREFIX
13
14Here BDB_PREFIX must absolute path - it is defined using $(pwd) which ensures
15the usage of the absolute path.
16
b1a657a0 17To Build
2341e9b5 18---------------------
b1a657a0 19
f60dc15c
W
20```bash
21./autogen.sh
22./configure
23make
24make install # optional
25```
84c3fb07 26
35b8af92 27This will build bitcoin-qt as well if the dependencies are met.
b1a657a0 28
0a61b0df 29Dependencies
2341e9b5 30---------------------
7b465b66 31
b5d1b109
WL
32These dependencies are required:
33
a75cacda
TH
34 Library | Purpose | Description
35 ------------|------------------|----------------------
36 libssl | SSL Support | Secure communications
a75cacda 37 libboost | Boost | C++ Library
2341e9b5 38
b5d1b109 39Optional dependencies:
7b465b66 40
b5d1b109
WL
41 Library | Purpose | Description
42 ------------|------------------|----------------------
43 miniupnpc | UPnP Support | Firewall-jumping support
44 libdb4.8 | Berkeley DB | Wallet storage (only needed when wallet enabled)
45 qt | GUI | GUI toolkit (only needed when GUI enabled)
46 protobuf | Payments in GUI | Data interchange format used for payment protocol (only needed when GUI enabled)
47 libqrencode | QR codes in GUI | Optional for generating QR codes (only needed when GUI enabled)
7b465b66 48
b5d1b109 49For the versions used in the release, see [release-process.md](release-process.md) under *Fetch and build inputs*.
7b465b66 50
4babd081
WL
51System requirements
52--------------------
53
54C++ compilers are memory-hungry. It is recommended to have at least 1 GB of
55memory available when compiling Bitcoin Core. With 512MB of memory or less
56compilation will take much longer due to swap thrashing.
57
7b465b66 58Dependency Build Instructions: Ubuntu & Debian
59----------------------------------------------
a21bdda7 60Build requirements:
2341e9b5 61
ffe32914 62 sudo apt-get install build-essential libtool autotools-dev autoconf pkg-config libssl-dev
e5f0247b 63
d7101a6d 64For Ubuntu 12.04 and later or Debian 7 and later libboost-all-dev has to be installed:
a21bdda7 65
2341e9b5 66 sudo apt-get install libboost-all-dev
67
68 db4.8 packages are available [here](https://launchpad.net/~bitcoin/+archive/bitcoin).
f8a7b503
D
69 You can add the repository using the following command:
70
71 sudo add-apt-repository ppa:bitcoin/bitcoin
72 sudo apt-get update
a21bdda7 73
29a41463 74 Ubuntu 12.04 and later have packages for libdb5.1-dev and libdb5.1++-dev,
a21bdda7 75 but using these will break binary wallet compatibility, and is not recommended.
6603b09e 76
d7101a6d 77For other Debian & Ubuntu (with ppa):
2341e9b5 78
e5f0247b 79 sudo apt-get install libdb4.8-dev libdb4.8++-dev
a21bdda7 80
81Optional:
2341e9b5 82
35b8af92 83 sudo apt-get install libminiupnpc-dev (see --with-miniupnpc and --enable-upnp-default)
0a61b0df 84
29a41463
WL
85Dependencies for the GUI: Ubuntu & Debian
86-----------------------------------------
87
88If you want to build Bitcoin-Qt, make sure that the required packages for Qt development
54d2b91c
WL
89are installed. Either Qt 4 or Qt 5 are necessary to build the GUI.
90If both Qt 4 and Qt 5 are installed, Qt 4 will be used. Pass `--with-gui=qt5` to configure to choose Qt5.
91To build without GUI pass `--without-gui`.
29a41463
WL
92
93To build with Qt 4 you need the following:
94
7211bceb 95 sudo apt-get install libqt4-dev libprotobuf-dev protobuf-compiler
29a41463 96
54d2b91c
WL
97For Qt 5 you need the following:
98
be7b0bff 99 sudo apt-get install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler
54d2b91c 100
29a41463
WL
101libqrencode (optional) can be installed with:
102
7211bceb 103 sudo apt-get install libqrencode-dev
29a41463
WL
104
105Once these are installed, they will be found by configure and a bitcoin-qt executable will be
106built by default.
8bb5edc1 107
0a61b0df 108Notes
109-----
7b465b66 110The release is built with GCC and then "strip bitcoind" to strip the debug
0a61b0df 111symbols, which reduces the executable size by about 90%.
112
113
8bb5edc1
MC
114miniupnpc
115---------
b5d1b109
WL
116
117[miniupnpc](http://miniupnp.free.fr/) may be used for UPnP port mapping. It can be downloaded from [here](
118http://miniupnp.tuxfamily.org/files/). UPnP support is compiled in and
119turned off by default. See the configure options for upnp behavior desired:
120
121 --without-miniupnpc No UPnP support miniupnp not required
122 --disable-upnp-default (the default) UPnP support turned off by default at runtime
123 --enable-upnp-default UPnP support turned on by default at runtime
124
125To build:
126
2341e9b5 127 tar -xzvf miniupnpc-1.6.tar.gz
128 cd miniupnpc-1.6
129 make
130 sudo su
131 make install
8bb5edc1
MC
132
133
0a61b0df 134Berkeley DB
135-----------
bfb154e9
WL
136It is recommended to use Berkeley DB 4.8. If you have to build it yourself:
137
138```bash
139BITCOIN_ROOT=$(pwd)
140
141# Pick some path to install BDB to, here we create a directory within the bitcoin directory
142BDB_PREFIX="${BITCOIN_ROOT}/db4"
143mkdir -p $BDB_PREFIX
144
145# Fetch the source and verify that it is not tampered with
146wget 'http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz'
147echo '12edc0df75bf9abd7f82f821795bcee50f42cb2e5f76a6a281b85732798364ef db-4.8.30.NC.tar.gz' | sha256sum -c
148# -> db-4.8.30.NC.tar.gz: OK
149tar -xzvf db-4.8.30.NC.tar.gz
150
151# Build the library and install to our prefix
152cd db-4.8.30.NC/build_unix/
3800135a 153# Note: Do a static build so that it can be embedded into the executable, instead of having to find a .so at runtime
bfb154e9
WL
154../dist/configure --enable-cxx --disable-shared --with-pic --prefix=$BDB_PREFIX
155make install
156
157# Configure Bitcoin Core to use our own-built instance of BDB
158cd $BITCOIN_ROOT
159./configure (other args...) LDFLAGS="-L${BDB_PREFIX}/lib/" CPPFLAGS="-I${BDB_PREFIX}/include/"
160```
0a61b0df 161
bfb154e9 162**Note**: You only need Berkeley DB if the wallet is enabled (see the section *Disable-Wallet mode* below).
0a61b0df 163
164Boost
165-----
166If you need to build Boost yourself:
2341e9b5 167
168 sudo su
169 ./bootstrap.sh
170 ./bjam install
3f94dfa2 171
172
173Security
174--------
175To help make your bitcoin installation more secure by making certain attacks impossible to
35b8af92
CF
176exploit even if a vulnerability is found, binaries are hardened by default.
177This can be disabled with:
178
08b93f9a
H
179Hardening Flags:
180
181 ./configure --enable-hardening
182 ./configure --disable-hardening
35b8af92
CF
183
184
185Hardening enables the following features:
3f94dfa2 186
187* Position Independent Executable
188 Build position independent code to take advantage of Address Space Layout Randomization
7e6d23b1
CD
189 offered by some kernels. Attackers who can cause execution of code at an arbitrary memory
190 location are thwarted if they don't know where anything useful is located.
3f94dfa2 191 The stack and heap are randomly located by default but this allows the code section to be
192 randomly located as well.
193
7e6d23b1 194 On an AMD64 processor where a library was not compiled with -fPIC, this will cause an error
3f94dfa2 195 such as: "relocation R_X86_64_32 against `......' can not be used when making a shared object;"
196
3f94dfa2 197 To test that you have built PIE executable, install scanelf, part of paxutils, and use:
2341e9b5 198
199 scanelf -e ./bitcoin
3f94dfa2 200
201 The output should contain:
202 TYPE
203 ET_DYN
204
205* Non-executable Stack
206 If the stack is executable then trivial stack based buffer overflow exploits are possible if
207 vulnerable buffers are found. By default, bitcoin should be built with a non-executable stack
208 but if one of the libraries it uses asks for an executable stack or someone makes a mistake
209 and uses a compiler extension which requires an executable stack, it will silently build an
210 executable without the non-executable stack protection.
211
212 To verify that the stack is non-executable after compiling use:
2341e9b5 213 `scanelf -e ./bitcoin`
3f94dfa2 214
215 the output should contain:
2341e9b5 216 STK/REL/PTL
217 RW- R-- RW-
3f94dfa2 218
219 The STK RW- means that the stack is readable and writeable but not executable.
ae6ea5a6
WL
220
221Disable-wallet mode
222--------------------
223When the intention is to run only a P2P node without a wallet, bitcoin may be compiled in
224disable-wallet mode with:
225
226 ./configure --disable-wallet
227
228In this case there is no dependency on Berkeley DB 4.8.
4a85e067
WL
229
230Mining is also possible in disable-wallet mode, but only using the `getblocktemplate` RPC
231call not `getwork`.
232
This page took 0.189891 seconds and 4 git commands to generate.