Go编译报错“cgo: C compiler “x86_64-linux-musl-gcc“ not found:”
报错信息:cgo: C compiler “x86_64-linux-musl-gcc” not found: exec: “x86_64-linux-musl-gcc”: executable file not found in $PATH带CGO的交叉编译,CGO_ENABLED必须开启。这也就需要辅助编译器来帮我们实现交叉编译了。如果你是mac平台,可以用这个工具 FiloSottile/m
·
报错信息:cgo: C compiler “x86_64-linux-musl-gcc” not found: exec: “x86_64-linux-musl-gcc”: executable file not found in $PATH
带CGO的交叉编译,CGO_ENABLED必须开启。这也就需要辅助编译器来帮我们实现交叉编译了。
如果你是mac平台,可以用这个工具 FiloSottile/musl-cross/musl-cross 直接通过brew安装就可以使用
1. brew install FiloSottile/musl-cross/musl-cross
如果报错:
Error: Cannot install under Rosetta 2 in ARM default prefix (/opt/homebrew)!
To rerun under ARM use:
arch -arm64 brew install ...
To install under x86_64, install Homebrew into /usr/local.
2.执行:
arch -arm64 brew install FiloSottile/musl-cross/musl-cross
如果还报错:
Error: Cannot install in Homebrew on ARM processor in Intel default prefix (/usr/local)!
Please create a new installation in /opt/homebrew using one of the
"Alternative Installs" from:
https://docs.brew.sh/Installation
You can migrate your previously installed formula list with:
brew bundle dump
3.执行
arch -x86_64 brew install FiloSottile/musl-cross/musl-cross
更多推荐
已为社区贡献1条内容
所有评论(0)