golang: 使用CGO / clang与sqlite3.c

huangapple go评论82阅读模式
英文:

golang: CGO / clang with sqlite3.c

问题

我想在OSX上编译为ARM架构。使用以下命令:
GOOS=linux GOARCH=arm CGO_ENABLED=1 go build -o foo main.go

但是我得到了以下错误:
runtime/cgo
clang: error: argument unused during compilation: '-mno-thumb'

我使用了这个包:https://github.com/mattn/go-sqlite3
我尝试了这些提示:https://github.com/mattn/go-sqlite3/issues/106

谢谢你的帮助 golang: 使用CGO / clang与sqlite3.c

英文:

I would like to compile to arm on osx.
With the following command:
GOOS=linux GOARCH=arm CGO_ENABLED=1 go build -o foo main.go

But I get:
runtime/cgo
clang: error: argument unused during compilation: '-mno-thumb'

I use this package: https://github.com/mattn/go-sqlite3
I tried the hints: https://github.com/mattn/go-sqlite3/issues/106

Thanks for every help golang: 使用CGO / clang与sqlite3.c

答案1

得分: 1

根据你提供的内容,我给出以下翻译:

"正如你提供的错误报告所说,你需要一个能够针对ARM Linux进行编译的C编译器。虽然Go工具链已经包含了用于交叉编译纯Go代码所需的一切,但它并不包括用于交叉编译使用cgo的包的C组件所需的工具。" - James Henstridge

结果是,我在ARM设备(树莓派)上编译了它。

英文:

"As the bug report you linked to says, you will need a C compiler that targets ARM Linux. While the Go toolchain comes with everything you need to cross compile pure Go code, it doesn't include the tools needed to cross compile the C components of packages that use cgo." – James Henstridge

The result, I compiled it on the arm device (raspberrypi).

huangapple
  • 本文由 发表于 2015年2月1日 19:53:53
  • 转载请务必保留本文链接:https://go.coder-hub.com/28262389.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定