build - gox - 为 sqlite3 抛出错误并且所有构建都失败

标签 build sqlite go

我有 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/

相关文章:

java - 使用带有 Apache Ivy 的自定义存储库,未找到解析器

c++ - 使用 MSVC 2015 构建 boost 1.55 时指定工具集版本

android - 如何确保数据只在 SQLite 中插入一次?

android - 对sqlite的insert语句返回的row_id的说明

pointers - 何时使用指针

.net - 为什么Paket需要三个文件来支持依赖管理?

ubuntu - 构建 apache thrift 时出错

c# - 用 C# 打开 .sqlite 文件

c++ - Golang 将数组传递给函数并修改它

go - 比较 2 个 slice 以查看哪个元素已被删除的惯用方法