在 10.9 中,在 Go 中编译 C 包似乎出错了。当尝试构建一个在 10.8 上运行的包时,clan 输出
clang: error: argument unused during compilation: '-fno-eliminate-unused-debug-types'
当我尝试解决这个问题时添加以下内容
#cgo CFLAGS: -Qunused-arguments
Go 响应
could not determine kind of name for C.<ctype>
对于导入的类型。任何提示如何解决这个问题?
最佳答案
这是一个已知的 cgo 错误(可能是 http://code.google.com/p/go/issues/detail?id=6515)
您可以从 https://code.google.com/p/go/downloads/list 下载 1.2 候选版本- 自 1.2rc2 起,此错误声称已修复。
根据上述错误报告中的评论 7(如果您不想使用候选发布版):
You can eliminate the option by editing the file src/cmd/cgo/gcc.go and removing the option from the list of options--just search for it.
关于macos - 在 OSX 10.9 上编译 C 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17319635/