在Linux系统中,经常会遇到编译Bitcoin Core过程中会出现Boost库报错的情况,具体表现为:
configure: error: Found a Boost header, but library can't be compiled
或
/usr/bin/ld: cannot find -lboost_system
这是因为Bitcoin Core使用了Boost C++库,而在编译过程中如果Boost库找不到或者版本不对,就会导致编译失败。
解决这个问题的方法是:
sudo apt install libboost-all-dev
dpkg -l | grep libboost
如果版本不对,则可以卸载当前的Boost库,重新安装1.58版本的Boost库。
下载Boost库源码:
wget https://dl.bintray.com/boostorg/release/1.58.0/source/boost_1_58_0.tar.gz
解压缩:
tar -xzvf boost_1_58_0.tar.gz
进入解压缩后的目录,执行以下命令:
./bootstrap.sh ./b2
等待编译完成,然后将编译好的库拷贝到系统目录下:
sudo cp -r stage/lib /usr/local/lib/ sudo cp -r boost /usr/local/include/
之后再尝试编译Bitcoin Core时,应该就能够正常编译了。