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