golang:使用sqlite3.c的CGO/clang [英] golang: CGO / clang with sqlite3.c
问题描述
我想编译以使用osx.使用以下命令:GOOS = linux GOARCH = arm CGO_ENABLED = 1 go build -o foo main.go
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
但是我得到:运行时/CGO铛:错误:编译期间未使用的参数:'-mno-thumb'
But I get: runtime/cgo clang: error: argument unused during compilation: '-mno-thumb'
我使用此软件包: https://github.com/mattn/go-sqlite3 我尝试了提示: https://github.com/mattn/go-sqlite3/issues/106
I use this package: https://github.com/mattn/go-sqlite3 I tried the hints: https://github.com/mattn/go-sqlite3/issues/106
感谢您的帮助:-)
推荐答案
正如链接到的错误报告所述,您将需要一个针对ARM Linux的C编译器.而Go工具链附带了您需要进行交叉编译的所有内容纯Go代码,它不包括交叉编译使用cgo的C组件所需的工具."–詹姆斯·亨斯特里奇(James Henstridge)
"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
结果,我在arm设备(raspberrypi)上编译了它.
The result, I compiled it on the arm device (raspberrypi).
这篇关于golang:使用sqlite3.c的CGO/clang的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!