Skip to content

Commit 6275123

Browse files
committed
doc: Update build-openbsd for 0.13.0+ and OpenBSD 5.9
- Python 3 now supported. - Bump boost version to 1.61 - one boost patch no longer needed. - All checked with OpenBSD 5.9, except for the clang part, I left this as-is for someone adventurous. - Mention overriding resource limits, OpenBSD's default ulimit does not suffice for building Bitcoin Core with gcc 4.9.3.
1 parent 883175f commit 6275123

File tree

1 file changed

+29
-17
lines changed

1 file changed

+29
-17
lines changed

doc/build-openbsd.md

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
OpenBSD build guide
22
======================
3-
(updated for OpenBSD 5.7)
3+
(updated for OpenBSD 5.9)
44

55
This guide describes how to build bitcoind and command-line utilities on OpenBSD.
66

@@ -15,19 +15,18 @@ Run the following as root to install the base dependencies for building:
1515
pkg_add gmake libtool libevent
1616
pkg_add autoconf # (select highest version, e.g. 2.69)
1717
pkg_add automake # (select highest version, e.g. 1.15)
18-
pkg_add python # (select version 2.7.x, not 3.x)
19-
ln -sf /usr/local/bin/python2.7 /usr/local/bin/python2
18+
pkg_add python # (select highest version, e.g. 3.5)
2019
```
2120

22-
The default C++ compiler that comes with OpenBSD 5.7 is g++ 4.2. This version is old (from 2007), and is not able to compile the current version of Bitcoin Core. It is possible to patch it up to compile, but with the planned transition to C++11 this is a losing battle. So here we will be installing a newer compiler.
21+
The default C++ compiler that comes with OpenBSD 5.9 is g++ 4.2. This version is old (from 2007), and is not able to compile the current version of Bitcoin Core, primarily as it has no C++11 support, but even before there were issues. So here we will be installing a newer compiler.
2322

2423
GCC
2524
-------
2625

2726
You can install a newer version of gcc with:
2827

2928
```bash
30-
pkg_add g++ # (select newest 4.x version, e.g. 4.9.2)
29+
pkg_add g++ # (select newest 4.x version, e.g. 4.9.3)
3130
```
3231

3332
This compiler will not overwrite the system compiler, it will be installed as `egcc` and `eg++` in `/usr/local/bin`.
@@ -49,18 +48,15 @@ BOOST_PREFIX="${BITCOIN_ROOT}/boost"
4948
mkdir -p $BOOST_PREFIX
5049
5150
# Fetch the source and verify that it is not tampered with
52-
wget http://heanet.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.bz2
53-
echo '727a932322d94287b62abb1bd2d41723eec4356a7728909e38adb65ca25241ca boost_1_59_0.tar.bz2' | sha256 -c
54-
# MUST output: (SHA256) boost_1_59_0.tar.bz2: OK
55-
tar -xjf boost_1_59_0.tar.bz2
51+
curl -o boost_1_61_0.tar.bz2 http://heanet.dl.sourceforge.net/project/boost/boost/1.61.0/boost_1_61_0.tar.bz2
52+
echo 'a547bd06c2fd9a71ba1d169d9cf0339da7ebf4753849a8f7d6fdb8feee99b640 boost_1_61_0.tar.bz2' | sha256 -c
53+
# MUST output: (SHA256) boost_1_61_0.tar.bz2: OK
54+
tar -xjf boost_1_61_0.tar.bz2
5655
57-
# Boost 1.59 needs two small patches for OpenBSD
58-
cd boost_1_59_0
56+
# Boost 1.61 needs one small patch for OpenBSD
57+
cd boost_1_61_0
5958
# Also here: https://gist.githubusercontent.com/laanwj/bf359281dc319b8ff2e1/raw/92250de8404b97bb99d72ab898f4a8cb35ae1ea3/patch-boost_test_impl_execution_monitor_ipp.patch
6059
patch -p0 < /usr/ports/devel/boost/patches/patch-boost_test_impl_execution_monitor_ipp
61-
# https://github.com/boostorg/filesystem/commit/90517e459681790a091566dce27ca3acabf9a70c
62-
sed 's/__OPEN_BSD__/__OpenBSD__/g' < libs/filesystem/src/path.cpp > libs/filesystem/src/path.cpp.tmp
63-
mv libs/filesystem/src/path.cpp.tmp libs/filesystem/src/path.cpp
6460
6561
# Build w/ minimum configuration necessary for bitcoin
6662
echo 'using gcc : : eg++ : <cxxflags>"-fvisibility=hidden -fPIC" <linkflags>"" <archiver>"ar" <striper>"strip" <ranlib>"ranlib" <rc>"" : ;' > user-config.jam
@@ -84,7 +80,7 @@ BDB_PREFIX="${BITCOIN_ROOT}/db4"
8480
mkdir -p $BDB_PREFIX
8581

8682
# Fetch the source and verify that it is not tampered with
87-
wget 'http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz'
83+
curl -o db-4.8.30.NC.tar.gz 'http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz'
8884
echo '12edc0df75bf9abd7f82f821795bcee50f42cb2e5f76a6a281b85732798364ef db-4.8.30.NC.tar.gz' | sha256 -c
8985
# MUST output: (SHA256) db-4.8.30.NC.tar.gz: OK
9086
tar -xzf db-4.8.30.NC.tar.gz
@@ -93,9 +89,25 @@ tar -xzf db-4.8.30.NC.tar.gz
9389
cd db-4.8.30.NC/build_unix/
9490
# Note: Do a static build so that it can be embedded into the executable, instead of having to find a .so at runtime
9591
../dist/configure --enable-cxx --disable-shared --with-pic --prefix=$BDB_PREFIX CC=egcc CXX=eg++ CPP=ecpp
96-
make install
92+
make install # do NOT use -jX, this is broken
9793
```
9894

95+
### Resource limits
96+
97+
The standard ulimit restrictions in OpenBSD are very strict:
98+
99+
data(kbytes) 1572864
100+
101+
This is, unfortunately, no longer enough to compile some `.cpp` files in the project,
102+
at least with gcc 4.9.3 (see issue https://github.com/bitcoin/bitcoin/issues/6658).
103+
If your user is in the `staff` group the limit can be raised with:
104+
105+
ulimit -d 3000000
106+
107+
The change will only affect the current shell and processes spawned by it. To
108+
make the change system-wide, change `datasize-cur` and `datasize-max` in
109+
`/etc/login.conf`, and reboot.
110+
99111
### Building Bitcoin Core
100112

101113
**Important**: use `gmake`, not `make`. The non-GNU `make` will exit with a horrible error.
@@ -123,7 +135,7 @@ To configure without wallet:
123135

124136
Build and run the tests:
125137
```bash
126-
gmake
138+
gmake # can use -jX here for parallelism
127139
gmake check
128140
```
129141

0 commit comments

Comments
 (0)