当我尝试使用go 1.13.4在macOS Catalina上构建golang插件时,构建过程因以下错误而中断:
$ make buildPlugin
env GOOS=linux go build -buildmode=plugin -o bin/common common/*.go
# command-line-arguments
/usr/local/Cellar/go/1.13.4/libexec/pkg/tool/darwin_amd64/link: running clang failed: exit status 1
ld: unknown option: -z
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [buildPlugin] Error 2
✘ $ go tool cgo -V
cgo version go1.13.4
删除env GOOS=linux
会有所帮助,但这不是解决方案。关于这个问题的原因有什么想法吗?