以太坊

  1. 源代码下载
  2. 环境
  3. 安装工具
  4. gcc g++ 安装
  5. CMake 安装
  6. 克隆代码编译并安装

源代码下载

C++ 版本源码:https://github.com/ethereum/aleth
以太坊维基百科:https://github.com/ethereum/wiki/wiki

环境

ubuntu18.04虚拟机  分配8个CPU,16G内存,内存太小编译会报错。

安装工具

sudo apt-get install vim
sudo apt-get install gcc g++ 版本太低编译不支持
sudo apt-get install git
sudo apt-get install cmake  版本太低编译不支持
sudo apt-get install libboost-all-dev libleveldb-dev libcurl4-openssl-dev libmicrohttpd-dev libminiupnpc-dev libgmp-dev

gcc g++ 安装

参考:https://www.linuxidc.com/Linux/2016-02/128327.htm
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install software-properties-common
sudo apt-get upgrade
sudo apt-get install gcc-5 g++-5

sudo updatedb && sudo ldconfig
locate gcc

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 53 \
--slave /usr/bin/g++ g++ /usr/bin/g++-5 \
--slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-5 \
--slave /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-5 \
--slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-5

CMake 安装

下载地址:https://cmake.org/download/
卸载CMake:sudo apt-get autoremove cmake
tar -xvf cmake-3.12.1.tar.gz
cd cmake-3.12.1 
sudo ./bootstrap 
sudo make 
sudo make install 
cmake –version 

参考WIKI进行编译:http://ethdocs.org/en/latest/ethereum-clients/cpp-ethereum/building-from-source/linux.html

克隆代码编译并安装

git clone --recursive https://github.com/ethereum/cpp-ethereum.git
cd cpp-ethereum
scripts/install_deps.sh
mkdir build 
cd build 
cmake ..
make -j8
sudo make install
ethereum@vm:~/cpp-ethereum/build$ sudo make install
[sudo] password for ethereum: 
Install the project...
-- Install configuration: "RelWithDebInfo"
-- Installing: /usr/local/share/aleth/buildinfo.json
-- Installing: /usr/local/include/evmc
-- Installing: /usr/local/include/evmc/utils.h
-- Installing: /usr/local/include/evmc/evmc.h
-- Installing: /usr/local/include/evmc/helpers.h
-- Installing: /usr/local/include/evmc/loader.h
-- Installing: /usr/local/include/evmc/instructions.h
-- Installing: /usr/local/lib/cmake/evmc/evmcTargets.cmake
-- Installing: /usr/local/lib/cmake/evmc/evmcTargets-relwithdebinfo.cmake
-- Installing: /usr/local/lib/cmake/evmc/evmcConfig.cmake
-- Installing: /usr/local/lib/cmake/evmc/evmcConfigVersion.cmake
-- Installing: /usr/local/lib/libevmc-instructions.a
-- Installing: /usr/local/lib/libevmc-loader.a
-- Installing: /usr/local/bin/aleth
-- Installing: /usr/local/bin/aleth-key
-- Installing: /usr/local/bin/aleth-vm
-- Installing: /usr/local/bin/testeth
ethereum@vm:~/cpp-ethereum/build$ ls /usr/local/bin/
aleth  aleth-key  aleth-vm   testeth

转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 ancjf@163.com

文章标题:以太坊

本文作者:ancjf

发布时间:2018-07-29, 20:50:06

最后更新:2020-09-15, 08:24:58

原始链接:http://ancjf.com/2018/07/29/%E4%BB%A5%E5%A4%AA%E5%9D%8A/

版权声明: "署名-非商用-相同方式共享 4.0" 转载请保留原文链接及作者。

目录
×

喜欢就点赞,疼爱就打赏