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-openbsd.md 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. OpenBSD build guide
  2. ======================
  3. (updated for OpenBSD 6.2)
  4. This guide describes how to build bitcoind and command-line utilities on OpenBSD.
  5. OpenBSD is most commonly used as a server OS, so this guide does not contain instructions for building the GUI.
  6. Preparation
  7. -------------
  8. Run the following as root to install the base dependencies for building:
  9. ```bash
  10. pkg_add git gmake libevent libtool
  11. pkg_add autoconf # (select highest version, e.g. 2.69)
  12. pkg_add automake # (select highest version, e.g. 1.15)
  13. pkg_add python # (select highest version, e.g. 3.6)
  14. pkg_add boost
  15. git clone https://github.com/bitcoin/bitcoin.git
  16. ```
  17. See [dependencies.md](dependencies.md) for a complete overview.
  18. **Important**: From OpenBSD 6.2 onwards a C++11-supporting clang compiler is
  19. part of the base image, and while building it is necessary to make sure that this
  20. compiler is used and not ancient g++ 4.2.1. This is done by appending
  21. `CC=cc CXX=c++` to configuration commands. Mixing different compilers
  22. within the same executable will result in linker errors.
  23. ### Building BerkeleyDB
  24. BerkeleyDB is only necessary for the wallet functionality. To skip this, pass
  25. `--disable-wallet` to `./configure` and skip to the next section.
  26. It is recommended to use Berkeley DB 4.8. You cannot use the BerkeleyDB library
  27. from ports, for the same reason as boost above (g++/libstd++ incompatibility).
  28. If you have to build it yourself, you can use [the installation script included
  29. in contrib/](/contrib/install_db4.sh) like so
  30. ```shell
  31. ./contrib/install_db4.sh `pwd` CC=cc CXX=c++
  32. ```
  33. from the root of the repository. Then set `BDB_PREFIX` for the next section:
  34. ```shell
  35. export BDB_PREFIX="$PWD/db4"
  36. ```
  37. ### Building Bitcoin Core
  38. **Important**: use `gmake`, not `make`. The non-GNU `make` will exit with a horrible error.
  39. Preparation:
  40. ```bash
  41. export AUTOCONF_VERSION=2.69 # replace this with the autoconf version that you installed
  42. export AUTOMAKE_VERSION=1.15 # replace this with the automake version that you installed
  43. ./autogen.sh
  44. ```
  45. Make sure `BDB_PREFIX` is set to the appropriate path from the above steps.
  46. To configure with wallet:
  47. ```bash
  48. ./configure --with-gui=no CC=cc CXX=c++ \
  49. BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" BDB_CFLAGS="-I${BDB_PREFIX}/include"
  50. ```
  51. To configure without wallet:
  52. ```bash
  53. ./configure --disable-wallet --with-gui=no CC=cc CXX=c++
  54. ```
  55. Build and run the tests:
  56. ```bash
  57. gmake # use -jX here for parallelism
  58. gmake check
  59. ```
  60. Resource limits
  61. -------------------
  62. If the build runs into out-of-memory errors, the instructions in this section
  63. might help.
  64. The standard ulimit restrictions in OpenBSD are very strict:
  65. data(kbytes) 1572864
  66. This, unfortunately, in some cases not enough to compile some `.cpp` files in the project,
  67. (see issue [#6658](https://github.com/bitcoin/bitcoin/issues/6658)).
  68. If your user is in the `staff` group the limit can be raised with:
  69. ulimit -d 3000000
  70. The change will only affect the current shell and processes spawned by it. To
  71. make the change system-wide, change `datasize-cur` and `datasize-max` in
  72. `/etc/login.conf`, and reboot.