Reputation: 65
Im trying to compile some go code containing some C and make use of openssl library. Im one windows and Im using cygwin64 for the gcc compiler and openssl devel library. However when I run the command I get the following error:
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: could not find -lmingwex
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: could not find -lmingw32
However when I look in cygwin I cannot find lmingw32 or lmingwex. Any ideas on what to do?
Upvotes: 1
Views: 936
Reputation: 1323005
As illustrated in ziglang/zig
issue 7874, I would test first if the same Go/C code could be compiled, from a git bash (which use msys2, no Cygwin) using ziglang
CGO_ENABLED=1 GOOS=windows GOARCH=amd64 CC="zcc" CXX="zc++" go build main.go
With, in the %PATH%
zcc
#!/bin/sh
zig cc -target x86_64-windows-gnu $@
zc++
#!/bin/sh
zig c++ -target x86_64-windows-gnu $@
You can also follow "Using Zig on Windows with msys2 toolchain"
The OP Thomas reports in the comments:
I used the following command:
CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build main.go
, and it worked ;)
Upvotes: 1