mac下编译go-ethereum
macos: 10.14.4
下载go-ethereum源码,按照文档执行命令编译:
$ make all
报错:
fatal error: 'stdlib.h' file not found
/usr/include
查看xcode是否安装:
$ xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
$ xcode-select -p
/Applications/Xcode.app/Contents/Developer
$ brew config
Clang: 10.0 build 1001
Git: 2.20.1 => /usr/local/bin/git
macOS: 10.14.4-x86_64
CLT: 10.2.0.0.1.1552586384
Xcode: 10.2
CLT headers: 10.2.0.0.1.1552586384
发现xcode已经安装。
使用命令查看 clang++的 include 搜索路径(#include <...> search starts here: 后面)。
$ clang++ -E -x c++ - -v < /dev/null
ignoring nonexistent directory "/usr/include/c++/v1"
ignoring nonexistent directory "/usr/include"
发现忽略了不存在的/usr/include。 说明macOS SDK 的头文件不存在。
安装llvm:
$ brew install llvm
问题仍然存在。
安装头文件:
$ cd /Library/Developer/CommandLineTools/Packages/
$ open macOS_SDK_headers_for_macOS_10.14.pkg
再次编译go-ethereum, 通过。 问题解决。
参考资料:
1、https://stackoverflow.com/que...
2、https://www.cnblogs.com/flipp...
3、https://apple.stackexchange.c...
辛巴
一文搞懂秒杀系统,欢迎参与开源,提交PR,提高竞争力。早日上岸,升职加薪。
王中阳Go赞 35阅读 2.7k评论 1
Golang 中 []byte 与 string 转换
机器铃砍菜刀赞 24阅读 58.5k评论 2
万字详解,吃透 MongoDB!
JavaGuide赞 8阅读 1.8k
数据结构与算法:二分查找
白鲸鱼赞 9阅读 5.4k
PHP转Go实践:xjson解析神器「开源工具集」
王中阳Go赞 11阅读 2.8k评论 4
Git操作不规范,战友提刀来相见!
王中阳Go赞 6阅读 2.9k评论 4
两分钟小技巧!如何阻止 macOS 的触底弹性滚动和双指手势导航
XboxYan赞 5阅读 1.9k
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。