Update build instructions for the new, no-wxwidgets world
[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 sudo apt-get install build-essential
26 sudo apt-get install libssl-dev
27 sudo apt-get install libdb4.8-dev
28 sudo apt-get install libdb4.8++-dev
29 Boost 1.40+: sudo apt-get install libboost-all-dev
30 or Boost 1.37: sudo apt-get install libboost1.37-dev
31
32 If using Boost 1.37, append -mt to the boost libraries in the makefile.
33
34 Requires miniupnpc 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 Licenses of statically linked libraries:
42 Berkeley DB    New BSD license with additional requirement that linked software must be free open source
43 Boost          MIT-like license
44 miniupnpc      New (3-clause) BSD license
45
46 Versions used in this release:
47 GCC          4.3.3
48 OpenSSL      0.9.8g
49 Berkeley DB  4.8.30.NC
50 Boost        1.37
51 miniupnpc    1.6
52
53
54 Notes
55 -----
56 The release is built with GCC and then "strip bitcoin" to strip the debug
57 symbols, which reduces the executable size by about 90%.
58
59
60 miniupnpc
61 ---------
62 tar -xzvf miniupnpc-1.6.tar.gz
63 cd miniupnpc-1.6
64 make
65 sudo su
66 make install
67
68
69 Berkeley DB
70 -----------
71 You need Berkeley DB 4.8.  If you have to build Berkeley DB yourself:
72 ../dist/configure --enable-cxx
73 make
74
75
76 Boost
77 -----
78 If you need to build Boost yourself:
79 sudo su
80 ./bootstrap.sh
81 ./bjam install
82
83
84 Security
85 --------
86 To help make your bitcoin installation more secure by making certain attacks impossible to
87 exploit even if a vulnerability is found, you can take the following measures:
88
89 * Position Independent Executable
90     Build position independent code to take advantage of Address Space Layout Randomization
91     offered by some kernels. An attacker who is able to cause execution of code at an arbitrary
92     memory location is thwarted if he doesn't know where anything useful is located.
93     The stack and heap are randomly located by default but this allows the code section to be
94     randomly located as well.
95
96     On an Amd64 processor where a library was not compiled with -fPIC, this will cause an error
97     such as: "relocation R_X86_64_32 against `......' can not be used when making a shared object;"
98
99     To build with PIE, use:
100     make -f makefile.unix ... -e PIE=1
101
102     To test that you have built PIE executable, install scanelf, part of paxutils, and use:
103     scanelf -e ./bitcoin
104
105     The output should contain:
106      TYPE
107     ET_DYN
108
109 * Non-executable Stack
110     If the stack is executable then trivial stack based buffer overflow exploits are possible if
111     vulnerable buffers are found. By default, bitcoin should be built with a non-executable stack
112     but if one of the libraries it uses asks for an executable stack or someone makes a mistake
113     and uses a compiler extension which requires an executable stack, it will silently build an
114     executable without the non-executable stack protection.
115
116     To verify that the stack is non-executable after compiling use:
117     scanelf -e ./bitcoin
118
119     the output should contain:
120     STK/REL/PTL
121     RW- R-- RW-
122
123     The STK RW- means that the stack is readable and writeable but not executable.