You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

build-unix.txt 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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. UNIX BUILD NOTES
  10. ================
  11. To Build
  12. --------
  13. cd src/
  14. make -f makefile.unix # Headless bitcoin
  15. See readme-qt.rst for instructions on building Bitcoin QT,
  16. the graphical bitcoin.
  17. Dependencies
  18. ------------
  19. Library Purpose Description
  20. ------- ------- -----------
  21. libssl SSL Support Secure communications
  22. libdb4.8 Berkeley DB Blockchain & wallet storage
  23. libboost Boost C++ Library
  24. miinupnpc UPnP Support Optional firewall-jumping support
  25. miniupnpc may be used for UPnP port mapping. It can be downloaded from
  26. http://miniupnp.tuxfamily.org/files/. UPnP support is compiled in and
  27. turned off by default. Set USE_UPNP to a different value to control this:
  28. USE_UPNP= No UPnP support - miniupnp not required
  29. USE_UPNP=0 (the default) UPnP support turned off by default at runtime
  30. USE_UPNP=1 UPnP support turned on by default at runtime
  31. Licenses of statically linked libraries:
  32. Berkeley DB New BSD license with additional requirement that linked
  33. software must be free open source
  34. Boost MIT-like license
  35. miniupnpc New (3-clause) BSD license
  36. Versions used in this release:
  37. GCC 4.3.3
  38. OpenSSL 0.9.8g
  39. Berkeley DB 4.8.30.NC
  40. Boost 1.37
  41. miniupnpc 1.6
  42. Dependency Build Instructions: Ubuntu & Debian
  43. ----------------------------------------------
  44. sudo apt-get install build-essential
  45. sudo apt-get install libssl-dev
  46. sudo apt-get install libdb4.8-dev
  47. sudo apt-get install libdb4.8++-dev
  48. Boost 1.40+: sudo apt-get install libboost-all-dev
  49. or Boost 1.37: sudo apt-get install libboost1.37-dev
  50. If using Boost 1.37, append -mt to the boost libraries in the makefile.
  51. Dependency Build Instructions: Gentoo
  52. -------------------------------------
  53. emerge -av net-libs/miniupnpc boost openssl sys-libs/db
  54. Then take the following steps to build:
  55. cd ${BITCOIN_DIR}/src
  56. sed -i 's/<db_cxx.h>/<db4.8\/db_cxx.h>/' *.h # path fix
  57. sed -i 's/-Bstatic/-Bdynamic/' makefile.unix # dynamic linking
  58. sed -i 's/^USE_UPNP:=0$/USE_UPNP:=/' makefile.unix # disable UPnP
  59. make -f makefile.unix
  60. strip bitcoind
  61. Notes
  62. -----
  63. The release is built with GCC and then "strip bitcoind" to strip the debug
  64. symbols, which reduces the executable size by about 90%.
  65. miniupnpc
  66. ---------
  67. tar -xzvf miniupnpc-1.6.tar.gz
  68. cd miniupnpc-1.6
  69. make
  70. sudo su
  71. make install
  72. Berkeley DB
  73. -----------
  74. You need Berkeley DB 4.8. If you have to build Berkeley DB yourself:
  75. ../dist/configure --enable-cxx
  76. make
  77. Boost
  78. -----
  79. If you need to build Boost yourself:
  80. sudo su
  81. ./bootstrap.sh
  82. ./bjam install
  83. Security
  84. --------
  85. To help make your bitcoin installation more secure by making certain attacks impossible to
  86. exploit even if a vulnerability is found, you can take the following measures:
  87. * Position Independent Executable
  88. Build position independent code to take advantage of Address Space Layout Randomization
  89. offered by some kernels. An attacker who is able to cause execution of code at an arbitrary
  90. memory location is thwarted if he doesn't know where anything useful is located.
  91. The stack and heap are randomly located by default but this allows the code section to be
  92. randomly located as well.
  93. On an Amd64 processor where a library was not compiled with -fPIC, this will cause an error
  94. such as: "relocation R_X86_64_32 against `......' can not be used when making a shared object;"
  95. To build with PIE, use:
  96. make -f makefile.unix ... -e PIE=1
  97. To test that you have built PIE executable, install scanelf, part of paxutils, and use:
  98. scanelf -e ./bitcoin
  99. The output should contain:
  100. TYPE
  101. ET_DYN
  102. * Non-executable Stack
  103. If the stack is executable then trivial stack based buffer overflow exploits are possible if
  104. vulnerable buffers are found. By default, bitcoin should be built with a non-executable stack
  105. but if one of the libraries it uses asks for an executable stack or someone makes a mistake
  106. and uses a compiler extension which requires an executable stack, it will silently build an
  107. executable without the non-executable stack protection.
  108. To verify that the stack is non-executable after compiling use:
  109. scanelf -e ./bitcoin
  110. the output should contain:
  111. STK/REL/PTL
  112. RW- R-- RW-
  113. The STK RW- means that the stack is readable and writeable but not executable.