Merge #12092: [qt] Replaces numbered place marker %2 with %1.
[bitcoinplatinum.git] / doc / build-openbsd.md
blob0817821221d3a5079a9c39d4cbe3b402e27781b5
1 OpenBSD build guide
2 ======================
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.
9 Preparation
10 -------------
12 Run the following as root to install the base dependencies for building:
14 ```bash
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)
19 pkg_add boost
21 git clone https://github.com/bitcoin/bitcoin.git
22 ```
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
42 ```shell
43 ./contrib/install_db4.sh `pwd` CC=cc CXX=c++
44 ```
46 from the root of the repository. Then set `BDB_PREFIX` for the next section:
48 ```shell
49 export BDB_PREFIX="$PWD/db4"
50 ```
52 ### Building Bitcoin Core
54 **Important**: use `gmake`, not `make`. The non-GNU `make` will exit with a horrible error.
56 Preparation:
57 ```bash
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
60 ./autogen.sh
61 ```
62 Make sure `BDB_PREFIX` is set to the appropriate path from the above steps.
64 To configure with wallet:
65 ```bash
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"
68 ```
70 To configure without wallet:
71 ```bash
72 ./configure --disable-wallet --with-gui=no CC=cc CXX=c++
73 ```
75 Build and run the tests:
76 ```bash
77 gmake # use -jX here for parallelism
78 gmake check
79 ```
81 Resource limits
82 -------------------
84 If the build runs into out-of-memory errors, the instructions in this section
85 might help.
87 The standard ulimit restrictions in OpenBSD are very strict:
89     data(kbytes)         1572864
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:
95     ulimit -d 3000000
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.