Skip to content

Commit f3e3563

Browse files
committed
Merge bitcoin/bitcoin#24652: doc: rewrite OpenBSD build docs for 7.0
a2b56dc doc: update OpenBSD build docs for 7.0 (fanquake) Pull request description: Removes redundant notes for setting `CC` &`CXX` now that Clang is well and truly the base compiler. See: https://www.openbsd.org/70.html > Disabled base-gcc on amd64. Cleans up the wallet docs, i.e #23446. Make the notes more similar to the FreeBSD notes. ACKs for top commit: shaavan: ACK a2b56dc theStack: ACK a2b56dc Tree-SHA512: a0494de3b168e5c35f541edf62dcb42529b23387febbe4c004eb82ef9aff6f97def43b6cd5c91e13612c5247767d79553efcd21b9792ccb6a9608302c5d082f1
2 parents 79bf1a0 + a2b56dc commit f3e3563

File tree

1 file changed

+71
-61
lines changed

1 file changed

+71
-61
lines changed

doc/build-openbsd.md

Lines changed: 71 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,123 +1,133 @@
1-
OpenBSD build guide
2-
======================
3-
(updated for OpenBSD 6.9)
1+
# OpenBSD Build Guide
42

5-
This guide describes how to build bitcoind, bitcoin-qt, and command-line utilities on OpenBSD.
3+
**Updated for OpenBSD [7.0](https://www.openbsd.org/70.html)**
64

7-
Preparation
8-
-------------
5+
This guide describes how to build bitcoind, command-line utilities, and GUI on OpenBSD.
96

10-
Run the following as root to install the base dependencies for building:
7+
## Preparation
8+
9+
### 1. Install Required Dependencies
10+
Run the following as root to install the base dependencies for building.
1111

1212
```bash
13-
pkg_add git gmake libevent libtool boost
14-
pkg_add qt5 # (optional for enabling the GUI)
15-
pkg_add autoconf # (select highest version, e.g. 2.69)
16-
pkg_add automake # (select highest version, e.g. 1.16)
17-
pkg_add python # (select highest version, e.g. 3.8)
18-
pkg_add bash
13+
pkg_add bash git gmake libevent libtool boost
14+
# Select the newest version of the follow packages:
15+
pkg_add autoconf automake python
16+
```
1917

18+
See [dependencies.md](dependencies.md) for a complete overview.
19+
20+
### 2. Clone Bitcoin Repo
21+
Clone the Bitcoin Core repository to a directory. All build scripts and commands will run from this directory.
22+
``` bash
2023
git clone https://github.com/bitcoin/bitcoin.git
2124
```
2225

23-
See [dependencies.md](dependencies.md) for a complete overview.
26+
### 3. Install Optional Dependencies
2427

25-
**Important**: From OpenBSD 6.2 onwards a C++11-supporting clang compiler is
26-
part of the base image, and while building it is necessary to make sure that
27-
this compiler is used and not ancient g++ 4.2.1. This is done by appending
28-
`CC=cc CXX=c++` to configuration commands. Mixing different compilers within
29-
the same executable will result in errors.
28+
#### Wallet Dependencies
3029

31-
### Building BerkeleyDB
30+
It is not necessary to build wallet functionality to run either `bitcoind` or `bitcoin-qt`.
31+
32+
###### Descriptor Wallet Support
33+
34+
`sqlite3` is required to support [descriptor wallets](descriptors.md).
35+
36+
``` bash
37+
pkg_add install sqlite3
38+
```
3239

33-
BerkeleyDB is only necessary for the wallet functionality. To skip this, pass
34-
`--disable-wallet` to `./configure` and skip to the next section.
40+
###### Legacy Wallet Support
41+
BerkeleyDB is only required to support legacy wallets.
3542

3643
It is recommended to use Berkeley DB 4.8. You cannot use the BerkeleyDB library
37-
from ports, for the same reason as boost above (g++/libstd++ incompatibility).
38-
If you have to build it yourself, you can use [the installation script included
39-
in contrib/](/contrib/install_db4.sh) like so:
44+
from ports. However you can build it yourself, [using the installation script included in contrib/](/contrib/install_db4.sh), like so, from the root of the repository.
4045

4146
```bash
42-
./contrib/install_db4.sh `pwd` CC=cc CXX=c++
47+
./contrib/install_db4.sh `pwd`
4348
```
4449

45-
from the root of the repository. Then set `BDB_PREFIX` for the next section:
50+
Then set `BDB_PREFIX`:
4651

4752
```bash
4853
export BDB_PREFIX="$PWD/db4"
4954
```
5055

51-
### Building Bitcoin Core
56+
#### GUI Dependencies
57+
###### Qt5
58+
59+
Bitcoin Core includes a GUI built with the cross-platform Qt Framework. To compile the GUI, Qt 5 is required.
60+
61+
```bash
62+
pkg_add qt5
63+
```
64+
65+
## Building Bitcoin Core
5266

5367
**Important**: Use `gmake` (the non-GNU `make` will exit with an error).
5468

5569
Preparation:
5670
```bash
5771

58-
# Replace this with the autoconf version that you installed. Include only
59-
# the major and minor parts of the version: use "2.69" for "autoconf-2.69p2".
60-
export AUTOCONF_VERSION=2.69
61-
62-
# Replace this with the automake version that you installed. Include only
63-
# the major and minor parts of the version: use "1.16" for "automake-1.16.1".
72+
# Adapt the following for the version you installed (major.minor only):
73+
export AUTOCONF_VERSION=2.71
6474
export AUTOMAKE_VERSION=1.16
6575

6676
./autogen.sh
6777
```
68-
Make sure `BDB_PREFIX` is set to the appropriate path from the above steps.
78+
79+
### 1. Configuration
6980

7081
Note that building with external signer support currently fails on OpenBSD,
7182
hence you have to explicitly disable it by passing the parameter
72-
`--disable-external-signer` to the configure script.
73-
(Background: the feature requires the header-only library boost::process, which
74-
is available on OpenBSD 6.9 via Boost 1.72.0, but contains certain system calls
75-
and preprocessor defines like `waitid()` and `WEXITED` that are not available.)
83+
`--disable-external-signer` to the configure script. The feature requires the
84+
header-only library boost::process, which is available on OpenBSD, but contains
85+
certain system calls and preprocessor defines like `waitid()` and `WEXITED` that
86+
are not available.
7687

77-
To configure with wallet:
78-
```bash
79-
./configure --with-gui=no --disable-external-signer CC=cc CXX=c++ \
80-
BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" \
81-
BDB_CFLAGS="-I${BDB_PREFIX}/include" \
82-
MAKE=gmake
83-
```
88+
There are many ways to configure Bitcoin Core, here are a few common examples:
89+
90+
##### Descriptor Wallet and GUI:
91+
This enables the GUI and descriptor wallet support, assuming `sqlite` and `qt5` are installed.
8492

85-
To configure without wallet:
8693
```bash
87-
./configure --disable-wallet --with-gui=no --disable-external-signer CC=cc CXX=c++ MAKE=gmake
94+
./configure --disable-external-signer MAKE=gmake
8895
```
8996

90-
To configure with GUI:
97+
##### Descriptor & Legacy Wallet. No GUI:
98+
This enables support for both wallet types and disables the GUI:
99+
91100
```bash
92-
./configure --with-gui=yes --disable-external-signer CC=cc CXX=c++ \
101+
./configure --disable-external-signer --with-gui=no \
93102
BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" \
94103
BDB_CFLAGS="-I${BDB_PREFIX}/include" \
95104
MAKE=gmake
96105
```
97106

98-
Build and run the tests:
107+
### 2. Compile
108+
**Important**: Use `gmake` (the non-GNU `make` will exit with an error).
109+
99110
```bash
100-
gmake # use "-j N" here for N parallel jobs
101-
gmake check
111+
gmake # use "-j N" for N parallel jobs
112+
gmake check # Run tests if Python 3 is available
102113
```
103114

104-
Resource limits
105-
-------------------
115+
## Resource limits
106116

107117
If the build runs into out-of-memory errors, the instructions in this section
108118
might help.
109119

110120
The standard ulimit restrictions in OpenBSD are very strict:
111-
112-
data(kbytes) 1572864
121+
```bash
122+
data(kbytes) 1572864
123+
```
113124

114125
This is, unfortunately, in some cases not enough to compile some `.cpp` files in the project,
115126
(see issue [#6658](https://github.com/bitcoin/bitcoin/issues/6658)).
116127
If your user is in the `staff` group the limit can be raised with:
117-
118-
ulimit -d 3000000
119-
128+
```bash
129+
ulimit -d 3000000
130+
```
120131
The change will only affect the current shell and processes spawned by it. To
121132
make the change system-wide, change `datasize-cur` and `datasize-max` in
122133
`/etc/login.conf`, and reboot.
123-

0 commit comments

Comments
 (0)