在CentOS上编译Qtum是一件非常麻烦的事情,因为CentOS提供的boost库过于老旧。而我们需要自己去手动编译boost库。
添加epel-release仓库,然后安装一些编译工具:
sudo yum install epel-release gcc-c++ git
 
  我们需要至少1.58.0版本的boost库来编译Qtum,但是CentOS 7上只提供了1.53.0版本以下的boost,我们可以选择手动编译。
首先我们需要安装一些依赖:
sudo yum install python-devel bzip2-devel
 
  然后我们从GitHub上克隆boost库:
git clone https://github.com/boostorg/boost.git
cd boost
 
  检出一个发布版本并且初始化子模块:
git checkout boost-1.58.0
git submodule update --init --recursive
 
  编译Boost: 你可以把--prefix和--libdir设置为任意你想要的位置,或者保持默认。但是你需要在编译和运行Qtum的时候把libdir 添加到LD_LIBRARY_PATH环境变量中,多少有些麻烦。
# omit the --libdir option for 32-bit systems
./bootstrap.sh --prefix=/usr --libdir=/usr/lib64
./b2 headers
# 你可以设置-j<N>,其中N是你的电脑的CPU的核心数或线程数。
sudo ./b2 -j4 install
 
  安装依赖:
sudo yum install libtool libdb4-cxx-devel openssl-devel libevent-devel
 
  如果你需要编译Qtum图形化界面qtum-qt,你还需要安装这些依赖:
sudo yum install qt5-qttools-devel protobuf-devel qrencode-devel
 
  克隆仓库并且初始化子模块:
git clone https://github.com/qtumproject/qtum.git
cd qtum
git submodule update --init --recursive
 
  配置参数以及编译:
 如果你把boost安装到了/, /usr, /usr/local以外的路径,你需要在configure的时候指定--with-boost=/path/to/your/boost,以及把/path/to/your/boost/lib添加到LD_LIBRARY_PATH环境变量。
./autogen.sh
./configure
make -j4