1.问题说明
在Alpine容器中构建geth项目,报错如下:
# github.com/ethereum/go-ethereum/crypto/secp256k1
In file included from ././libsecp256k1/src/secp256k1.c:9,
from vendor/github.com/ethereum/go-ethereum/crypto/secp256k1/secp256.go:26:
././libsecp256k1/src/util.h:14:10: fatal error: stdlib.h: No such file or directory
14 | #include
| ^~~~~~~~~~
compilation terminated.
2.问题原因
缺少gcc、g++环境
3.安装所需环境Alpine容器中安装gcc、g++环境
- 升级所有包及软件和系统内核
apk update
- 安装gcc
# apk add gcc
# gcc --version
gcc (Alpine 10.2.1_pre1) 10.2.1 20201203
- 安装g++
# apk add g++
# g++ --version
g++ (Alpine 10.2.1_pre1) 10.2.1 20201203