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