在Cygwin64上编译cgo lib:“ld:can not find -lmingw32” [英] Compile cgo lib on Cygwin64: "ld: cannot find -lmingw32"

查看:497
本文介绍了在Cygwin64上编译cgo lib:“ld:can not find -lmingw32”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Windows上使用cgo库,即 github.com/mattn/go-sqlite3

I'm trying to use a cgo library on Windows, namely github.com/mattn/go-sqlite3

但运行 go go github.com/mattn

I use Cygwin64 and installed with all "Development" packages, so gcc is availabe.

我使用Cygwin64并安装了所有Development包,所以gcc可用。 / go-sqlite3 导致:

But running go get github.com/mattn/go-sqlite3 results in:

/usr/lib/gcc/x86_64-pc-cygwin/5.3.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lmingwex
/usr/lib/gcc/x86_64-pc-cygwin/5.3.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lmingw32

如果我在Cygwin安装程序中搜索mingwex和mingw32,则无法获得结果。我在寻找错误的名字,或者它们在64位系统上不可用?

If I search for "mingwex" and "mingw32" in the Cygwin installer, I get no results. Am I looking for the wrong names or are they not available on 64 bit systems?

或者有没有更好的方式在Windows上使用库?

Or is there a better way to use the library on Windows?

请注意,自述文件指出


然而, ,如果安装go-sqlite3并安装
github.com/mattn/go-sqlite3,则不需要gcc来构建应用程序

However, if you install go-sqlite3 with go install github.com/mattn/go-sqlite3, you don't need gcc to build your app anymore

但如果我使用 go install ,则会得到相同的错误信息。

but I get the same error message if I use go install.

$ go version
go version go1.6.2 windows/amd64


推荐答案

终于为我工作了(而不是Cygwin)是从 http://tdm-gcc.tdragon.net/download 并设置PATH,使gcc从 C:\ TDM-GCC-64 \\ \\ bin 被使用。

What finally worked for me (instead of Cygwin) is to download TDM MinGW-w64 from http://tdm-gcc.tdragon.net/download and set the PATH such that gcc from C:\TDM-GCC-64\bin is used.

这篇关于在Cygwin64上编译cgo lib:“ld:can not find -lmingw32”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆