linux 编译bitcoin,CentOS6.7编译安装bitcoin钱包

如何安装比特币钱包节点

一、github上下载源码

git clone [email protected]:bitcoin/bitcoin.git

git checkout v0.12.1rc2

二、autogen

./autogen.sh

报错如下

Makefile.am:3: Libtool library used but `LIBTOOL' is undefined

Makefile.am:3: The usual way to define `LIBTOOL' is to add `AC_PROG_LIBTOOL'

Makefile.am:3: to `configure.ac' and run `aclocal' and `autoconf' again.

Makefile.am:3: If `AC_PROG_LIBTOOL' is in `configure.ac', make sure

Makefile.am:3: its definition is in aclocal's search path.

autoreconf: automake failed with exit status: 1

原因是没有安装libtool

参考文章:

* LIBTOOL is undefined 问题的解决方法

sudo yum install libtool

然后重复执行autogen.sh,报错

configure.ac:894: error: possibly undefined macro: PKG_CONFIG_LIBDIR

If this token and others are legitimate, please use m4_pattern_allow.

See the Autoconf documentation.

autoreconf: /usr/bin/autoconf failed with exit status: 1

查到文章说在configure.ac文件里加一行

m4_pattern_allow(PKG_CONFIG_LIBDIR)

解决。

三、安装boost

官网上下载boost_1_64

先要修改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

如果报错bzlib.h找不到

sudo yum install bzip2-devel.x86_64

如果报错pyconfig.h找不到

export CPLUS_INCLUDE_PATH=/usr/include/python2.6

如果/usr/include/python2.6里的是pyconfig-64.h,复制一份新的出来,重命名成pyconfig.h

* 如果报错patchlevel.h找不到

sudo yum install python-devel.x86_64

完成后会显示两个路径,分别指向boost的目录与boostlib的目录,一般就是解压后进入的目录。可以将它们复制到/usr/local下。

四、confiugre

./configure --enable-cxx --disable-shared --with-pic --prefix=xxxx/coins/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

报错:

checking for Berkeley DB C++ headers... no

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里带有–with-boost这样的选项,但实际上只在源码目录中完成编译然后在with中指定–with-boost到源码目录里的boost好像并没有什么用,sudo ./b2 install这一步是必须的。但是–with-boost-lib这句是有用的。

五、make && make install

make

如果使用的CentOS6.7,需要看一下gcc –version,如果版本比较低,如4.4这样的版本,是不支持C++11标准,会在bitcoin的make步骤报一些语法错误。

处理办法:

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

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

开启了gcc version4.8版本的编译环境之后就可以正常完成make和make install了。

六、执行bitcoin/bin下的命令

这个时候可能会有找不到类库的错误,这时参才在安装boost的时候配置的boost安装路径,如果没配可以直接复制类库过去。

然后bitcoin安装就完成了。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值