首先从github上拉eos的源码
git clone https://github.com/eosio/eos --recursive
如果没加--recursive,则拉完源码后需要在源码目录执行以下命令(如果没有执行,执行编译命令时会提示)
git submodule update --init --recursive
执行编译命令
sh eosio_build.sh
编译完成后
[100%] Built target nodeos
_______ _______ _______ _________ _______
( ____ \( ___ )( ____ \\__ __/( ___ )
| ( \/| ( ) || ( \/ ) ( | ( ) |
| (__ | | | || (_____ | | | | | |
| __) | | | |(_____ ) | | | | | |
| ( | | | | ) | | | | | | |
| (____/\| (___) |/\____) |___) (___| (___) |
(_______/(_______)\_______)\_______/(_______)
EOSIO has been successfully built. 02:17:15
To verify your installation run the following commands:
/root/opt/mongodb/bin/mongod -f /root/opt/mongodb/mongod.conf &
source /opt/rh/python33/enable
export PATH=${HOME}/opt/mongodb/bin:$PATH
cd /opt/eos/build; make test
For more information:
EOSIO website: https://eos.io
EOSIO Telegram channel @ https://t.me/EOSProject
EOSIO resources: https://eos.io/resources/
EOSIO wiki: https://github.com/EOSIO/eos/wiki
如果顺利,则编译完成。在我的实践中,估计是因为网络的原因(墙),需要做一些操作。
1) 下载mongodb的时候,需要将下载地址替换掉,在文件script/eosio_build_centos.sh
#STATUS=$(curl -LO -w '%{http_code}' --connect-timeout 30 https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.6.3.tgz)
STATUS=$(curl -LO -w '%{http_code}' --connect-timeout 30 http://downloads.mongodb.org/linux/mongodb-linux-x86_64-3.6.3.tgz)
2)手动下载mongo-c-driver-1.9.3.tar.gz,放到指定目录,然后在脚本中注释掉下载命令,改为拷贝命令
百度云链接:https://pan.baidu.com/s/1fr928wJvp_A5JvDq9jbEwQ 密码: 3f4r
# STATUS=$(curl -LO -w '%{http_code}' --connect-timeout 30 \
# "https://github.com/mongodb/mongo-c-driver/releases/download/1.9.3/mongo-c-driver-1.9.3.tar.gz" )
# if [ "${STATUS}" -ne 200 ]; then
# rm -f "${TEMP_DIR}/mongo-c-driver-1.9.3.tar.gz"
# printf "\\tUnable to download MongoDB C driver at this time.\\n"
# printf "\\tExiting now.\\n\\n"
# exit 1;
# fi
cp /opt/eos/scripts/mongo-c-driver-1.9.3.tar.gz ${TEMP_DIR}/
3)之前安装了tcmaloc,但是没有配置链接
[root@localhost eos]# build/programs/nodeos/nodeos
build/programs/nodeos/nodeos: error while loading shared libraries: libtcmalloc.so.4: cannot open shared object file: No such file or directory
解决方案:
[root@localhost gperftools-master]# echo /usr/local/lib > /etc/ld.so.conf.d/libtcmalloc.conf
[root@localhost gperftools-master]# ldconfig