![在 OpenBSD 上编译 bitcoind](https://linux22.com/image/44972/%E5%9C%A8%20OpenBSD%20%E4%B8%8A%E7%BC%96%E8%AF%91%20bitcoind.png)
构建 bitcoind 的说明很模糊,但我不知道在 OpenBSD 上该怎么做。我已经安装了 boost,并且系统在 OpenBSD 的基本安装中已经安装了 berkeley db 4.6、OpenSSL 等。
# 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
写完这篇文章后,我发现我没有 BDB 4.8,所以我得到了它并将其编译到 /usr/local/BerkeleyDB.4.8
我在github上找到了一些构建说明:https://github.com/bitcoin/bitcoin/pull/1815
我对它们进行了如下修改以适应我安装 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
现在构建失败了,看起来与Boost有关。在最后出现一些错误之前,有数百个错误......
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
答案1
使用 OpenBSD-WIP 的比特币端口:https://github.com/jasperla/openbsd-wip/tree/master/net/bitcoin。