本文所有实践都是基于EOS dawn-v4.1.0,请切到该分支然后实践
切换命令:git checkout dawn-v4.1.0
目前网络上都是针对老版EOS2.0源码编译的文章,我在mac上参考这些文章编译,最后发现根本就不对,最新版本只需一条命令(./eosio_build.sh,依赖库会自动安装的)即可。我根据这些文章手动安装的库还导致如下问题,最后大部分时间都花在解决这个问题上。【官网安装文档传送门】
ItleaksDeMacbook-Pro:eos itleaks$ ./eosio_build.sh
fatal: destination path 'mongo-cxx-driver' already exists and is not an empty directory.
Unable to clone MongoDB C++ driver at this time.
Exiting now.
这个问题解决方案如下
sudo rm -rf /tmp/mongo*
cd /path/to/eos
rm -rf build/
git pull
git submodule update --init --recursive
./eosio_build.sh
如果还是不行,可以尝试重装brew,具体参考我的这篇博文【mac重装Homebrew】
如果出现下面的问题
Failed to find Gettext libintl (missing: Intl_INCLUDE_DIR)
执行下面的命令即可
brew unlink gettext && brew link --force gettext
现在开始跟着下面的步骤编译EOS搭建开发环境吧
下载源码
EOS 代码使用了三个子模块
- 插件管理模块 AppBase
- 区块链结构模块 ChainBase
- WASM 模块
git clone https://github.com/eosio/eos --recursive
所以上面需要用recursive,如果没有带有recursive下载了eos,可以通过如下方式下载submodules
cd eos
git submodule update --init --recursive
国内目前从github下载源码速度很慢,可以参考我这篇博文【github访问慢和clone慢解决方案】提速
编译
编译其实很简单,就是执行./eosio_build.sh脚本
mac平台编译依赖homebrew工具,所以必须先安装好homebrew工具
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
如果你的电脑内存<8G会报如下错误
itleaks@itleaks-VirtualBox:~/projects/eos$ ./eosio_build.sh
Beginning build version: 1.2
2018年 05月 18日 星期五 07:13:36 UTC
User: itleaks
git head id: 29c30f10650102ffb000bb1a287dc285d582275f
Current branch: master
&nbs

本文介绍了如何在mac上基于EOS dawn-v4.1.0分支编译源码,包括解决编译过程中的问题,如依赖库冲突、内存不足限制等,提供了解决方案和编译步骤。
最低0.47元/天 解锁文章
545

被折叠的 条评论
为什么被折叠?



