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