go-sqlite3: go build error

i use shell script to go build, but i failed GOOS=linux GOARCH=386 go build && mv proxyWebApplication proxyWeb/proxyWebApplication && tar zcfv "zip/proxy-linux-386.tar.gz" proxyWeb why? this is error information ../github.com/mattn/go-sqlite3/sqlite3_go18.go:26: undefined: SQLiteConn ../github.com/mattn/go-sqlite3/sqlite3_go18.go:27: undefined: namedValue

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 25 (6 by maintainers)

Commits related to this issue

Most upvoted comments

For those having this issue on linux (especially if you’re using Ubuntu), please do the following:

$ sudo apt-get install gcc-mingw-w64

The above command will install cross compiler for C. Then you can build with the following code:

To build for windows amd64:

GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc CGO_ENABLED=1 go build -o binary_name_amd64.exe .

Similarly for windows 386:

GOOS=windows GOARCH=386 CC=i686-w64-mingw32-gcc CGO_ENABLED=1 go build -o binary_name_386.exe .

Hope this helps.

@GJRTimmer Sorry, I gave up on using SQLite3 in my project because this was too complicated to cross-compile for each OS. I switched to https://github.com/coreos/bbolt in my project which is 100% Go and allows me to compile for each os/arch on my mac.