当前位置: 首页 > 工具软件 > Cpp Ethereum > 使用案例 >

以太坊cpp-ethereum源码编译

司徒泰
2023-12-01

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

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

安装工具
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

 

 类似资料: