Go-sqlite3: Errors cross compile to windows 64

Created on 9 May 2016  Â·  3Comments  Â·  Source: mattn/go-sqlite3

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?

Most helpful comment

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.

All 3 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jeffreyantony picture jeffreyantony  Â·  7Comments

KrisCarr picture KrisCarr  Â·  11Comments

hackertron picture hackertron  Â·  10Comments

jacentsao picture jacentsao  Â·  6Comments

anacrolix picture anacrolix  Â·  6Comments