GitHub安装说明
https://github.com/EOSIO/eos/tree/dawn-2.x
macOS 下安装
- 升级系统到macOS High Sierra。
- 安装Xcode最新版本。
- 从github克隆代码,执行安装脚本。
git clone https://github.com/eosio/eos --recursive
# 本文发布时master不稳定,切换到dawn-2.x分支
git checkout dawn-2.x
cd eos
./build.sh darwin
# 启动eosd sever进程,首次执行会自动停止,产生data-dir/config.ini文件
./build/eosd/eosd
# 修改config.ini文件,见下方问题区。
# 启动eosd
./build/eosd/eosd
# 启动eosc,命令行工具eosc查看eosd的信息
./build/eosc/eosc get info
注意:版本问题。
eos-build1.png
安装过程中遇到的问题
说在前面
我最早是从master分支直接安装的,中间遇到了一些问题,知道最后启动服务发现没有产生区块,才改成稳定的dawn-2.x版本。所以,如果你直接从dawn-2.x版本开始安装的话,下面的一些问题不一定会遇到。
磁盘空间
磁盘空间要求至少100GB,否则报错。先修改脚本scripts/eosio/build/darwin.sh,先绕过去限制。
# if [ $DISK_AVAIL -lt 100 ]; then
if [ $DISK_AVAIL -lt 10 ]; then # 修改为10GB
printf "\tYou must have at least 100GB of available storage to install EOSIO.\n"
printf "\tExiting now.\n"
exit 1
fi
autoreconf -i 报错
Usage: autoreconf [-f] [-h] [--help] [-m dir] [--macrodir=dir]
[-l dir] [--localdir=dir] [--force] [--verbose] [--version]
解决:更新版本autoconf 到2.69, 原本PATH里有指向低版本autoconf 2.10的路径,删掉。
libtoolize 报错
Can't exec "libtoolize": No such file or directory at /usr/local/share/autoconf/Autom4te/FileUtils.pm line 345, <GEN3> line 5.
autoreconf: failed to run libtoolize: No such file or directory
autoreconf: libtoolize is needed because this package uses Libtool
Error running autogen
解决:
要用glibtool,参考
https://stackoverflow.com/questions/15448582/installed-libtool-but-libtoolize-not-found
http://blog.csdn.net/diandianxiyu_geek/article/details/56667415
解法:
#添加PATH /usr/local/Cellar/libtool/2.4.6_1/bin
export PATH=/usr/local/Cellar/libtool/2.4.6_1/bin:$PATH
brew install boost double-conversion gflags glog libevent
sudo ln -s /usr/local/bin/glibtoolize /usr/local/bin/libtoolize
openssl问题
在编译的时候遇到openssl版本问题。报错如下:
CMake Error at /usr/local/Cellar/cmake/3.7.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:138 (message):
Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
system variable OPENSSL_ROOT_DIR (missing: OPENSSL_LIBRARIES
OPENSSL_INCLUDE_DIR)
原因在于安装脚本里为Darwin指定了openssl的路径如下,默认版本为1.1:
if [ $ARCH == "Darwin" ]; then
OPENSSL_ROOT_DIR=/usr/local/opt/openssl@1.1
OPENSSL_LIBRARIES=/usr/local/opt/openssl@1.1/lib
但是系统里安装的是1.0.2版本。
eos ansen$ ls -lh /usr/local/opt/openssl@1.0
lrwxr-xr-x 1 ansen admin 24B 2 19 00:47 /usr/local/opt/openssl@1.0 -> ../Cellar/openssl/1.0.2n
用brew安装openssl@1.1后,编译还是有问题,说找不到symbol,google搜了一圈,没找到解决办法。
Undefined symbols for architecture x86_64:
"_BN_is_negative", referenced from:
fc::bigint::is_negative() const in libfc.a(bigint.cpp.o)
fc::bigint::to_int64() const in libfc.a(bigint.cpp.o)
"_BN_is_zero", referenced from:
fc::bigint::operator bool() const in libfc.a(bigint.cpp.o)
"_ECDSA_SIG_get0", referenced from:
fc::crypto::r1::ECDSA_SIG_recover_key_GFp(ec_key_st*, ECDSA_SIG_st*, unsigned char const*, int, int, int) in libfc.a(elliptic_r1.cpp.o)
fc::crypto::r1::private_key::sign_compact(fc::sha256 const&) const in libfc.a(elliptic_r1.cpp.o)
"_ECDSA_SIG_set0", referenced from:
fc::crypto::r1::public_key::public_key(fc::array<unsigned char, 65ul> const&, fc::sha256 const&, bool) in libfc.a(elliptic_r1.cpp.o)
"_OPENSSL_init_crypto", referenced from:
fc::openssl_scope::openssl_scope() in libfc.a(openssl.cpp.o)
ld: symbol(s) not found for architecture x86_64
clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
解决: 修改安装脚本,使用1.0版本,编译就成功了。
if [ $ARCH == "Darwin" ]; then
OPENSSL_ROOT_DIR=/usr/local/opt/openssl@1.0
OPENSSL_LIBRARIES=/usr/local/opt/openssl@1.0/lib
安装成功,显示如下:
[100%] Linking CXX executable eosiod
cd /Users/ansen/eos/eos/build/programs/eosiod && /usr/local/Cellar/cmake/3.7.2/bin/cmake -E cmake_link_script CMakeFiles/eosiod.dir/link.txt --verbose=0
[100%] Built target eosiod
/usr/local/Cellar/cmake/3.7.2/bin/cmake -E cmake_progress_start /Users/ansen/eos/eos/build/CMakeFiles 0
EOSIO has been successfully installed.
修改config.ini
在自动生成的config.ini的基础上修改下面这些配置项。 genesis就是eos根目录的genesis.json。
# Load the testnet genesis state, which creates some initial block producers with the default key
genesis-json = /path/to/eos/source/genesis.json
# Enable production on a stale chain, since a single-node test chain is pretty much always stale
enable-stale-production = true
# Enable block production with the testnet producers
producer-name = inita
producer-name = initb
producer-name = initc
producer-name = initd
producer-name = inite
producer-name = initf
producer-name = initg
producer-name = inith
producer-name = initi
producer-name = initj
producer-name = initk
producer-name = initl
producer-name = initm
producer-name = initn
producer-name = inito
producer-name = initp
producer-name = initq
producer-name = initr
producer-name = inits
producer-name = initt
producer-name = initu
# Load the block producer plugin, so you can produce blocks
plugin = eosio::producer_plugin
# Wallet plugin
plugin = eosio::wallet_api_plugin
# As well as API and HTTP plugins
plugin = eosio::chain_api_plugin
plugin = eosio::http_plugin
代码分支版本问题
最早是从master开始编译的,解决了上面的问题后,最后运行起来确发现没有产生区块。
1046000ms thread-0 producer_plugin.cpp:227 block_production_loo ] Not producing block because it isn't my turn, its eosio 1046500ms thread-0 producer_plugin.cpp:227 block_production_loo ] Not producing block because it isn't my turn, its eosio 1047000ms thread-0 producer_plugin.cpp:227 block_production_loo ] Not producing block because it isn't my turn, its eosio 1047500ms thread-0 producer_plugin.cpp:227 block_production_loo ] Not producing block because it isn't my turn, its eosio
看到有篇文章里写到,master版本不稳定,建议切换会dawn-2.x版本。
dawn-2.x版本执行build/eosd/eosd。然后会有区块产生。
2390002ms chain_controller.cpp:208 _push_block ] initl #2614 @2018-02-19T05:39:50 | 0 trx, 0 pending, exectime_ms=1
2390003ms producer_plugin.cpp:246 block_production_loo ] initl generated block #2614 @ 2018-02-19T05:39:50 with 0 trxs 0 pending
2391002ms chain_controller.cpp:208 _push_block ] inits #2615 @2018-02-19T05:39:51 | 0 trx, 0 pending, exectime_ms=0
2391002ms producer_plugin.cpp:246 block_production_loo ] inits generated block #2615 @ 2018-02-19T05:39:51 with 0 trxs 0 pending
eosc执行
查询当前区块链概况:
eos ansen$ ./build/programs/eosc/eosc get info
{
"server_version": "d051c1b6",
"head_block_num": 2920,
"last_irreversible_block_num": 2905,
"head_block_id": "00000b68623d835911d8d8d67e8fae041ddc522e4412e2f742c7fd52c462fa53",
"head_block_time": "2018-02-19T05:44:56",
"head_block_producer": "initu",
"recent_slots": "1111111111111111111111111111111111111111111111111111111111111111",
"participation_rate": "1.00000000000000000"
}
网友评论