Merge #10574: Remove includes in .cpp files for things the corresponding .h file...
[bitcoinplatinum.git] / doc / build-openbsd.md
blobcd1d217b47a79148c571826eb74ac26296d796b2
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 GCC
27 -------
29 The default C++ compiler that comes with OpenBSD 6.2 is g++ 4.2.1. This version is old (from 2007), and is not able to compile the current version of Bitcoin Core because it has no C++11 support. We'll install a newer version of GCC:
31 ```bash
32  pkg_add g++
33  ```
35  This compiler will not overwrite the system compiler, it will be installed as `egcc` and `eg++` in `/usr/local/bin`.
37 ### Building BerkeleyDB
39 BerkeleyDB is only necessary for the wallet functionality. To skip this, pass `--disable-wallet` to `./configure`.
41 It is recommended to use Berkeley DB 4.8. You cannot use the BerkeleyDB library
42 from ports, for the same reason as boost above (g++/libstd++ incompatibility).
43 If you have to build it yourself, you can use [the installation script included
44 in contrib/](contrib/install_db4.sh) like so
46 ```shell
47 ./contrib/install_db4.sh `pwd` CC=egcc CXX=eg++ CPP=ecpp
48 ```
50 from the root of the repository.
52 ### Resource limits
54 The standard ulimit restrictions in OpenBSD are very strict:
56     data(kbytes)         1572864
58 This, unfortunately, may no longer be enough to compile some `.cpp` files in the project,
59 at least with GCC 4.9.4 (see issue [#6658](https://github.com/bitcoin/bitcoin/issues/6658)).
60 If your user is in the `staff` group the limit can be raised with:
62     ulimit -d 3000000
64 The change will only affect the current shell and processes spawned by it. To
65 make the change system-wide, change `datasize-cur` and `datasize-max` in
66 `/etc/login.conf`, and reboot.
68 ### Building Bitcoin Core
70 **Important**: use `gmake`, not `make`. The non-GNU `make` will exit with a horrible error.
72 Preparation:
73 ```bash
74 export AUTOCONF_VERSION=2.69 # replace this with the autoconf version that you installed
75 export AUTOMAKE_VERSION=1.15 # replace this with the automake version that you installed
76 ./autogen.sh
77 ```
78 Make sure `BDB_PREFIX` is set to the appropriate path from the above steps.
80 To configure with wallet:
81 ```bash
82 ./configure --with-gui=no CC=egcc CXX=eg++ CPP=ecpp \
83     BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" BDB_CFLAGS="-I${BDB_PREFIX}/include"
84 ```
86 To configure without wallet:
87 ```bash
88 ./configure --disable-wallet --with-gui=no CC=egcc CXX=eg++ CPP=ecpp
89 ```
91 Build and run the tests:
92 ```bash
93 gmake # use -jX here for parallelism
94 gmake check
95 ```
97 Clang
98 ------------------------------
100 ```bash
101 pkg_add llvm
103 ./configure --disable-wallet --with-gui=no CC=clang CXX=clang++
104 gmake # use -jX here for parallelism
105 gmake check