I'm trying cross compile from linux to windows 64 and the following error has occurred
runtime/cgo
gcc: error: unrecognized command line option ‘-mthreads’
Any ideias?
Are you using mingw64 C compiler on linux?
I wasn't.
But after some research I found a page in stackoverflow so i try.
First install this two packages
apt-get install gcc-multilib
apt-get install gcc-mingw-w64
After that I use this command to compile
GOOS=windows GOARCH=386 CGO_ENABLED=1 CXX_FOR_TARGET=i686-w64-mingw32-g++ CC_FOR_TARGET=i686-w64-mingw32-gcc go build
This works for me.
@tiaguinho you can build your app in go-mingw Docker container which contains all necessary MinGW deps in future.
Most helpful comment
I wasn't.
But after some research I found a page in stackoverflow so i try.
First install this two packages
After that I use this command to compile
This works for me.