Notes fix
[novacoin.git] / doc / build-unix.txt
1 Copyright (c) 2009-2012 Bitcoin Developers
2 Distributed under the MIT/X11 software license, see the accompanying
3 file license.txt or http://www.opensource.org/licenses/mit-license.php.
4 This product includes software developed by the OpenSSL Project for use in
5 the OpenSSL Toolkit (http://www.openssl.org/).  This product includes
6 cryptographic software written by Eric Young (eay@cryptsoft.com) and UPnP
7 software written by Thomas Bernard.
8
9
10 UNIX BUILD NOTES
11 ================
12
13 To Build
14 --------
15
16 cd src/
17 make -f makefile.unix            # Headless bitcoin
18
19 See readme-qt.rst for instructions on building Bitcoin QT,
20 the graphical bitcoin.
21
22 Dependencies
23 ------------
24
25  Library     Purpose           Description
26  -------     -------           -----------
27  libssl      SSL Support       Secure communications
28  libdb4.8    Berkeley DB       Blockchain & wallet storage
29  libboost    Boost             C++ Library
30  miniupnpc   UPnP Support      Optional firewall-jumping support
31  libqrencode QRCode generation Optional QRCode generation
32
33 Note that libexecinfo should be installed, if you building under *BSD systems. 
34 This library provides backtrace facility.
35
36 miniupnpc may be used for UPnP port mapping.  It can be downloaded from
37 http://miniupnp.tuxfamily.org/files/.  UPnP support is compiled in and
38 turned off by default.  Set USE_UPNP to a different value to control this:
39  USE_UPNP=-    No UPnP support - miniupnp not required
40  USE_UPNP=0    (the default) UPnP support turned off by default at runtime
41  USE_UPNP=1    UPnP support turned on by default at runtime
42
43 libqrencode may be used for QRCode image generation. It can be downloaded
44 from http://fukuchi.org/works/qrencode/index.html.en, or installed via
45 your package manager. Set USE_QRCODE to control this:
46  USE_QRCODE=0   (the default) No QRCode support - libqrcode not required
47  USE_QRCODE=1   QRCode support enabled
48
49 Licenses of statically linked libraries:
50  Berkeley DB   New BSD license with additional requirement that linked
51                software must be free open source
52  Boost         MIT-like license
53  miniupnpc     New (3-clause) BSD license
54
55 Versions used in this release:
56  GCC           4.3.3
57  OpenSSL       0.9.8g
58  Berkeley DB   4.8.30.NC
59  Boost         1.37
60  miniupnpc     1.6
61
62 Dependency Build Instructions: Ubuntu & Debian
63 ----------------------------------------------
64 sudo apt-get install build-essential
65 sudo apt-get install libssl-dev
66 sudo apt-get install libdb4.8-dev
67 sudo apt-get install libdb4.8++-dev
68  Boost 1.40+: sudo apt-get install libboost-all-dev
69  or Boost 1.37: sudo apt-get install libboost1.37-dev
70 sudo apt-get install libqrencode-dev
71
72 If using Boost 1.37, append -mt to the boost libraries in the makefile.
73
74
75 Dependency Build Instructions: Gentoo
76 -------------------------------------
77
78 Note: If you just want to install bitcoind on Gentoo, you can add the Bitcoin
79       overlay and use your package manager:
80           layman -a bitcoin && emerge bitcoind
81
82 emerge -av1 --noreplace boost glib openssl sys-libs/db:4.8
83
84 Take the following steps to build (no UPnP support):
85  cd ${BITCOIN_DIR}/src
86  make -f makefile.unix USE_UPNP= BDB_INCLUDE_PATH='/usr/include/db4.8'
87  strip bitcoind
88
89
90 Notes
91 -----
92 The release is built with GCC and then "strip bitcoind" to strip the debug
93 symbols, which reduces the executable size by about 90%.
94
95
96 miniupnpc
97 ---------
98 tar -xzvf miniupnpc-1.6.tar.gz
99 cd miniupnpc-1.6
100 make
101 sudo su
102 make install
103
104
105 Berkeley DB
106 -----------
107 You need Berkeley DB 4.8.  If you have to build Berkeley DB yourself:
108 ../dist/configure --enable-cxx
109 make
110
111
112 Boost
113 -----
114 If you need to build Boost yourself:
115 sudo su
116 ./bootstrap.sh
117 ./bjam install
118
119
120 Security
121 --------
122 To help make your bitcoin installation more secure by making certain attacks impossible to
123 exploit even if a vulnerability is found, you can take the following measures:
124
125 * Position Independent Executable
126     Build position independent code to take advantage of Address Space Layout Randomization
127     offered by some kernels. An attacker who is able to cause execution of code at an arbitrary
128     memory location is thwarted if he doesn't know where anything useful is located.
129     The stack and heap are randomly located by default but this allows the code section to be
130     randomly located as well.
131
132     On an Amd64 processor where a library was not compiled with -fPIC, this will cause an error
133     such as: "relocation R_X86_64_32 against `......' can not be used when making a shared object;"
134
135     To build with PIE, use:
136     make -f makefile.unix ... -e PIE=1
137
138     To test that you have built PIE executable, install scanelf, part of paxutils, and use:
139     scanelf -e ./bitcoin
140
141     The output should contain:
142      TYPE
143     ET_DYN
144
145 * Non-executable Stack
146     If the stack is executable then trivial stack based buffer overflow exploits are possible if
147     vulnerable buffers are found. By default, bitcoin should be built with a non-executable stack
148     but if one of the libraries it uses asks for an executable stack or someone makes a mistake
149     and uses a compiler extension which requires an executable stack, it will silently build an
150     executable without the non-executable stack protection.
151
152     To verify that the stack is non-executable after compiling use:
153     scanelf -e ./bitcoin
154
155     the output should contain:
156     STK/REL/PTL
157     RW- R-- RW-
158
159     The STK RW- means that the stack is readable and writeable but not executable.