build-openbsd.md
1 # OpenBSD Build Guide 2 3 **Updated for OpenBSD [7.8](https://www.openbsd.org/78.html)** 4 5 This guide describes how to build bitcoind, command-line utilities, and GUI on OpenBSD. 6 7 ## Preparation 8 9 ### 1. Install Required Dependencies 10 Run the following as root to install the base dependencies for building. 11 12 ```bash 13 pkg_add git cmake boost libevent 14 ``` 15 16 SQLite is required for the wallet: 17 18 ```bash 19 pkg_add sqlite3 20 ``` 21 22 To build Bitcoin Core without the wallet, use `-DENABLE_WALLET=OFF`. 23 24 Cap'n Proto is needed for IPC functionality (see [multiprocess.md](multiprocess.md)): 25 26 ```bash 27 pkg_add capnproto 28 ``` 29 30 Compile with `-DENABLE_IPC=OFF` if you do not need IPC functionality. 31 32 See [dependencies.md](dependencies.md) for a complete overview. 33 34 ### 2. Clone Bitcoin Repo 35 Clone the Bitcoin Core repository to a directory. All build scripts and commands will run from this directory. 36 ``` bash 37 git clone https://github.com/bitcoin/bitcoin.git 38 ``` 39 40 ### 3. Install Optional Dependencies 41 42 #### GUI Dependencies 43 ###### Qt6 44 45 Bitcoin Core includes a GUI built with the cross-platform Qt Framework. To compile the GUI, we need to install 46 the necessary parts of Qt, the libqrencode and pass `-DBUILD_GUI=ON`. Skip if you don't intend to use the GUI. 47 48 ```bash 49 pkg_add qt6-qtbase qt6-qttools 50 ``` 51 52 ###### libqrencode 53 54 The GUI will be able to encode addresses in QR codes unless this feature is explicitly disabled. To install libqrencode, run: 55 56 ```bash 57 pkg_add libqrencode 58 ``` 59 60 Otherwise, if you don't need QR encoding support, use the `-DWITH_QRENCODE=OFF` option to disable this feature in order to compile the GUI. 61 62 --- 63 64 #### Notifications 65 ###### ZeroMQ 66 67 Bitcoin Core can provide notifications via ZeroMQ. If the package is installed, support will be compiled in. 68 ```bash 69 pkg_add zeromq 70 ``` 71 72 #### Test Suite Dependencies 73 There is an included test suite that is useful for testing code changes when developing. 74 To run the test suite (recommended), you will need to have Python 3 installed: 75 76 ```bash 77 pkg_add python py3-zmq # Select the newest version of the python package if necessary. 78 ``` 79 80 ## Building Bitcoin Core 81 82 ### 1. Configuration 83 84 There are many ways to configure Bitcoin Core, here are a few common examples: 85 86 ##### Wallet and GUI: 87 This enables wallet support and the GUI, assuming SQLite and Qt 6 are installed. 88 89 ```bash 90 cmake -B build -DBUILD_GUI=ON 91 ``` 92 93 Run `cmake -B build -LH` to see the full list of available options. 94 95 ### 2. Compile 96 97 ```bash 98 cmake --build build # Append "-j N" for N parallel jobs. 99 ctest --test-dir build # Append "-j N" for N parallel tests. 100 ``` 101 102 ## Resource limits 103 104 If the build runs into out-of-memory errors, the instructions in this section 105 might help. 106 107 The standard ulimit restrictions in OpenBSD are very strict: 108 ```bash 109 data(kbytes) 1572864 110 ``` 111 112 This is, unfortunately, in some cases not enough to compile some `.cpp` files in the project, 113 (see issue [#6658](https://github.com/bitcoin/bitcoin/issues/6658)). 114 If your user is in the `staff` group the limit can be raised with: 115 ```bash 116 ulimit -d 3000000 117 ``` 118 The change will only affect the current shell and processes spawned by it. To 119 make the change system-wide, change `datasize-cur` and `datasize-max` in 120 `/etc/login.conf`, and reboot.