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 5.2KB

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