Skip to content

Commit 6915f93

Browse files
committed
doc: Update OpenBSD build instructions for 6.2
There is no more need to install a compiler. This simplifies instructions a lot.
1 parent 180a255 commit 6915f93

File tree

1 file changed

+33
-39
lines changed

1 file changed

+33
-39
lines changed

doc/build-openbsd.md

Lines changed: 33 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -23,47 +23,31 @@ git clone https://github.com/bitcoin/bitcoin.git
2323

2424
See [dependencies.md](dependencies.md) for a complete overview.
2525

26-
GCC
27-
-------
28-
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:
30-
31-
```bash
32-
pkg_add g++
33-
```
34-
35-
This compiler will not overwrite the system compiler, it will be installed as `egcc` and `eg++` in `/usr/local/bin`.
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.
3631

3732
### Building BerkeleyDB
3833

39-
BerkeleyDB is only necessary for the wallet functionality. To skip this, pass `--disable-wallet` to `./configure`.
34+
BerkeleyDB is only necessary for the wallet functionality. To skip this, pass
35+
`--disable-wallet` to `./configure` and skip to the next section.
4036

4137
It is recommended to use Berkeley DB 4.8. You cannot use the BerkeleyDB library
4238
from ports, for the same reason as boost above (g++/libstd++ incompatibility).
4339
If you have to build it yourself, you can use [the installation script included
44-
in contrib/](contrib/install_db4.sh) like so
40+
in contrib/](/contrib/install_db4.sh) like so
4541

4642
```shell
47-
./contrib/install_db4.sh `pwd` CC=egcc CXX=eg++ CPP=ecpp
43+
./contrib/install_db4.sh `pwd` CC=cc CXX=c++
4844
```
4945

50-
from the root of the repository.
51-
52-
### Resource limits
53-
54-
The standard ulimit restrictions in OpenBSD are very strict:
55-
56-
data(kbytes) 1572864
46+
from the root of the repository. Then set `BDB_PREFIX` for the next section:
5747

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:
61-
62-
ulimit -d 3000000
63-
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.
48+
```shell
49+
export BDB_PREFIX="$PWD/db4"
50+
```
6751

6852
### Building Bitcoin Core
6953

@@ -79,13 +63,13 @@ Make sure `BDB_PREFIX` is set to the appropriate path from the above steps.
7963

8064
To configure with wallet:
8165
```bash
82-
./configure --with-gui=no CC=egcc CXX=eg++ CPP=ecpp \
66+
./configure --with-gui=no CC=cc CXX=c++ \
8367
BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" BDB_CFLAGS="-I${BDB_PREFIX}/include"
8468
```
8569

8670
To configure without wallet:
8771
```bash
88-
./configure --disable-wallet --with-gui=no CC=egcc CXX=eg++ CPP=ecpp
72+
./configure --disable-wallet --with-gui=no CC=cc CXX=c++
8973
```
9074

9175
Build and run the tests:
@@ -94,13 +78,23 @@ gmake # use -jX here for parallelism
9478
gmake check
9579
```
9680

97-
Clang
98-
------------------------------
81+
Resource limits
82+
-------------------
9983

100-
```bash
101-
pkg_add llvm
84+
If the build runs into out-of-memory errors, the instructions in this section
85+
might help.
86+
87+
The standard ulimit restrictions in OpenBSD are very strict:
88+
89+
data(kbytes) 1572864
90+
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:
94+
95+
ulimit -d 3000000
96+
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.
102100

103-
./configure --disable-wallet --with-gui=no CC=clang CXX=clang++
104-
gmake # use -jX here for parallelism
105-
gmake check
106-
```

0 commit comments

Comments
 (0)