Ubuntu16.04 源码安装Cpp-Ethereum

来源:互联网 发布:centos安装图形界面 编辑:程序博客网 时间:2024/06/05 05:56

Cpp以太坊客户端的安装需要Cmake来产生客户端所需要的文件,大致步骤有三步:

-安装构建工具和外部包(平台依赖)
-获取以太坊客户端源代码
-使用Cmake构建文件并安装

1、安装Git

$ sudo  apt install git

2、安装Cmake

2.1 因为在源码安装Cpp-Ethereum需要https链接到Github上面,所以需要在安装Cmake的时候需要配置SSL链接,所以需要在终端重新安装curl,在终端顺序执行以下指令:

$ sudo apt-get remove curl

$ sudo apt-get install zlib1g

$ sudo apt-get install zlib1g-dev

$ sudo apt-get install libssl-dev

去Curl官网下载最新Curl源码,将文件解压缩之后,进入Curl源码文件夹,并执行以下命令:

$ ./configure --with--ssl

$ make

$ sudo make install

2.2 输入 curl --version,如果显示以下代码,则安装成功:

curl 7.55.1 (x86_64-pc-linux-gnu) libcurl/7.47.0 OpenSSL/1.0.2g zlib/1.2.8 libidn/1.32 librtmp/2.3Release-Date: 2017-08-14Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP UnixSockets 

2.3 进入 Cmake下载页 下载cmake-3.7.1.tar.gz,因为Cpp-ethereum的Cmake配置文件中Cmake版本是3.7.1,所以建议下载3.7.1版本,将Cmake解压之后,进入到源码文件夹,执行以下指令

$ ./bootstrap --system-curl

$ make

$ sudo make install

2.4 输入cmake -version,如果出现以下信息,则表明安装成功

cmake version 3.9.1CMake suite maintained and supported by Kitware (kitware.com/cmake).

3、获取源代码

git clone --recursive https://github.com/ethereum/cpp-ethereum.git

cd cpp-ethereum

注意:--recursive必不可少,其作用是用克隆构建客户端所需要的一些子模块。

4、插入依赖库

以下库文件是客户端必须的:

-boost
-leveldb
-curl
-microhttpd
-miniupnp
-gmp
使用以下指令来插入以上函数库

$ sudo apt-get install libboost-all-dev libleveldb-dev libcurl4-openssl-dev libmicrohttpd-dev libminiupnpc-dev libgmp-dev

5 、安装Cpp-Ethereum

在源码的文件夹,输入以下指令安装Cpp-Ethereum

$ mkdir build; cd build

$ cmake ..

$ cmake --build .

注意最后一行指令还有一个”.”

至此,Cpp-Ethereum的安装就完成了,在安装的过程中碰到了很多问题,我也在Girhub的Cpp-Ethereum官网上对问题进行了讨论,下面是我安装过程中的两个问题:

When build CPP-Ethereum,Each download failed - Ubuntu 16.04
[hunter * FATAL ERROR *] -about boost

参考文献:

https://github.com/ethereum/cpp-ethereum
http://ethdocs.org/en/latest/ethereum-clients/cpp-ethereum/building-from-source/linux.html
http://blog.csdn.net/u013137970/article/details/52255001