我有 Go 应用程序 pravasan在我的部署分支中,我正在尝试执行 gox
构建它的二进制文件,我遇到了几个错误,它们是
18 errors occurred:
--> linux/amd64 error: exit status 2
Stderr: # github.com/mattn/go-sqlite3
../../mattn/go-sqlite3/sqlite3.c:92 unknown #: if
../../mattn/go-sqlite3/sqlite3.c:94 6c: No such file or directory: mingw.h
--> darwin/386 error: exit status 2
Stderr: # github.com/mattn/go-sqlite3
../../mattn/go-sqlite3/sqlite3.c:92 unknown #: if
../../mattn/go-sqlite3/sqlite3.c:94 8c: No such file or directory: mingw.h
--> linux/386 error: exit status 2
Stderr: # github.com/mattn/go-sqlite3
../../mattn/go-sqlite3/sqlite3.c:92 unknown #: if
../../mattn/go-sqlite3/sqlite3.c:94 8c: No such file or directory: mingw.h
有没有人有解决这个问题的建议..
最佳答案
gox issue 23提及:
if you add
CGO_ENABLED=1
to the environment, it successfully compiles, but does not link (it needs a linux linker still), but gets much further along.so maybe we need to add a new
-cgo
flag (or, just do it) to gox to set that.这似乎是必要的,Go 1.4 now being more strict when compiling C source files :
除非
cgo
被用于构建包,go 命令现在拒绝编译 C 源文件,因为相关的 C 编译器(6c 等)打算从安装中删除一些 future 的版本。
(它们今天仅用于构建运行时的一部分。)
在任何情况下都很难正确使用它们,因此任何现存的使用都可能不正确,因此我们已禁用它们。
关于build - gox - 为 sqlite3 抛出错误并且所有构建都失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28164654/