大螃嗨

好记性不如烂笔头

用户工具

站点工具


bitcoin编译centos

http://blog.csdn.net/terminatorsong/article/details/74089911

第一步Autogen

$./autogen.sh

报错一:configure.ac:225: error: Autoconf version 2.64 or higher is required
解决方案:升级autoconf
方法:
查询当前版本:$rpm -qf /usr/bin/autoconf
卸载当前版本:$rpm -e –nodeps autoconf-2.63
下载安装新版本:
$wget ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
$tar zxvf autoconf-2.69.tar.gz
$cd autoconf-2.69
$./configure –prefix=/usr/
$make && make install
查看安装完毕的版本号:$/usr/bin/autoconf -V

继续./autogen.sh

报错二:configure.ac:894: error: possibly undefined macro: PKG_CONFIG_LIBDIR
解决方案:
查到文章说在configure.ac文件里加一行(我直接加到文件的第一行)
m4_pattern_allow(PKG_CONFIG_LIBDIR)

第二步 安装Boost

注意事项 先要修改bootstrap.sh
将其中的 PREFIX=/usr/local 修改为 PREFIX=/usr
在下面找到 LIBDIR=”EPREFIX/lib“∗∗修改为∗∗LIBDIR=“EPREFIX/lib64”
根据不同的系统可能会有不同,需要检查 whereis boost 看头文件在哪里引用的,
在最后install的时候会安装头文件到PREFIX/inlcude/boost里,
所以要注意PREFIX的配置;而类库将会安装在LIBDIR里,
有些系统会认/usr/lib,但有些只认/usr/lib64,需要根据情况修改。
不然在bitcoin安装完成后会报找不到boost类库,无法运行的错误。

$wget https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.gz
$tar zxvf boost_1_64_0.tar.gz
$cd boost_1_64_0
$./bootstrap.sh(这一步执行前请阅读上面的注意事项)
$./b2(这一步会出现错误一)

错误一:no command provided, default command 'g++' not found
解决方案:安装g++
安装命令:$sudo yum install gcc-c++

第三步 Configura

$./configure –enable-cxx –disable-shared –with-pic –prefix=/usr/local/bitcoin –with-boost=/usr/local/boost_1_64_0 –with-boost-libdir=/usr/local/boost_1_64_0/stage/lib –without-gui –with-incompatible-bdb

错误一:configure: error: *** A compiler with support for C++11 language features is required. 错误原因:如果使用的CentOS6.7,需要看一下gcc –version,如果版本比较低,如4.4这样的版本,是不支持C++11标准,会在报一些语法错误。 解决方案:
$sudo wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo
$sudo yum install devtoolset-2-gcc devtoolset-2-binutils devtoolset-2-gcc-c++

这样就安装了gcc version4.8的版本。但是并不是默认开启的,需要执行
$scl enable devtoolset-2 bash

然后在当前会话中就会开启使用gcc4.8的编译环境。

也可以在.bashrc里加入

echo “WARNING: devtoolset-2 is enabled!”
. /opt/rh/devtoolset-2/enable

来每次都开启此编译环境。

错误二:configure: error: libdb_cxx headers missing, Bitcoin Core requires this library for wallet functionality (–disable-wallet to disable wallet functionality)
错误原因:看了下文档,提示需要libdb5.1。查查问题的时候都是关于bitcoin的,提到的都是要使用BerkeleyDb4.8NC。CentOS没有libdb,只能手动安装BerkeleyDb5.1。在doc/build-unix.md文档里有详细的说明,按说明操作安装即可。
解决方案: $wget 'http://download.oracle.com/berkeley-db/db-5.1.29.NC.tar.gz'
$echo '08238e59736d1aacdd47cfb8e68684c695516c37f4fbe1b8267dde58dc3a576c db-5.1.29.NC.tar.gz' | sha256sum -c
$tar -xzvf db-5.1.29.NC.tar.gz
$cd db-5.1.29.NC/build_unix/
$../dist/configure –enable-cxx –disable-shared –with-pic –prefix=/usr/local
$make install

错误三:configure: error: libevent not found. 错误原因:缺少libevent 解决方案:卡在这一步了libevent已经安装成功里,但是还是找不到,卡住了。操作环境,本地centos

bitcoin编译centos.txt · 最后更改: 2017/09/20 10:15 由 螃蟹