Compiling bitcoind on OpenBSD

compilingopenbsd

The instructions to build bitcoind are vague enough, but I can't work out what to do on OpenBSD. I've installed boost, and the system has berkeley db 4.6, OpenSSL, etc already in the base install of OpenBSD.

# gmake -f makefile.unix                             
Building LevelDB ...
gmake[1]: Entering directory `/root/bitcoin/bitcoin-0.8.3/src/leveldb'
g++ -I. -I./include -fno-builtin-memcmp -D_REENTRANT -DOS_OPENBSD -DLEVELDB_PLATFORM_POSIX -O2 -pthread -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -g -DBOOST_SPIRIT_THREADSAFE -D_FILE_OFFSET_BITS=64 -I/root/bitcoin/bitcoin-0.8.3/src -I/root/bitcoin/bitcoin-0.8.3/src/obj -I/usr/local/include/boost -DUSE_UPNP=0 -DUSE_IPV6=1 -I/root/bitcoin/bitcoin-0.8.3/src/leveldb/include -I/root/bitcoin/bitcoin-0.8.3/src/leveldb/helpers -DHAVE_BUILD_INFO -fno-stack-protector -fstack-protector-all -Wstack-protector -D_FORTIFY_SOURCE=2  -c db/builder.cc -o db/builder.o
In file included from ./port/port.h:14,
             from ./db/filename.h:14,
             from db/builder.cc:7:
./port/port_posix.h:80: error: '__BYTE_ORDER' was not declared in this scope
./port/port_posix.h:80: error: '__LITTLE_ENDIAN' was not declared in this scope
gmake[1]: *** [db/builder.o] Error 1
gmake[1]: Leaving directory `/root/bitcoin/bitcoin-0.8.3/src/leveldb'
gmake: *** [leveldb/libleveldb.a] Error 2

Since writing I found I didn't have BDB 4.8 so I got it and compiled it into /usr/local/BerkeleyDB.4.8

I found some build instructions on github: https://github.com/bitcoin/bitcoin/pull/1815

I modified these as follows to suit where I installed BDB…

BOOST_INCLUDE_PATH=/usr/local/include \
BOOST_LIB_PATH=/usr/local/lib \
BDB_INCLUDE_PATH=/usr/local/BerkeleyDB.4.8/include \
BDB_LIB_PATH=/usr/local/BerkeleyDB.4.8/lib \
BOOST_LIB_SUFFIX=-mt \
gmake -f makefile.unix -j8 USE_UPNP= bitcoind test_bitcoin

Now the build fails, it looks boost related. There are hundreds of errors until some final ones…

db.cpp:510: error: 'boost' has not been declared
db.cpp:510: error: expected `;' before 'pathTmp'
db.cpp:511: error: 'pathTmp' was not declared in this scope
db.cpp:527: error: 'pathAddr' was not declared in this scope
db.cpp:527: error: 'RenameOver' cannot be used as a function
db.cpp: In member function 'bool CAddrDB::Read(CAddrMan&)':
db.cpp:536: error: 'pathAddr' was not declared in this scope
gmake: *** [obj/alert.o] Error 1
gmake: *** [obj/db.o] Error 1
gmake: *** [obj/checkpoints.o] Error 1

Best Answer

Use the bitcoin port from OpenBSD-WIP: https://github.com/jasperla/openbsd-wip/tree/master/net/bitcoin.

Related Question