Compile cgo lib on Cygwin64: “ld: cannot find -lmingw32”

随声附和 提交于 2019-12-03 03:52:25

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.

You can also install package mingw64-i686-gcc-core from Cygwin.

The binary will be /usr/bin/i686-w64-mingw32-gcc.exe so you probably need to copy it as /usr/bin/gcc.exe.

I have encountered the same issue as well. It seems to me that cygwin is not fully compatible with cgo. Instead, I have used https://mingw-w64.org.

From the cgo documentation https://github.com/golang/go/wiki/cgo:

In order to use cgo on Windows, you'll also need to first install a gcc compiler (for instance, mingw-w64) and have gcc.exe (etc.) in your PATH environment variable before compiling with cgo will work.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!