Skip to content

Instantly share code, notes, and snippets.

@Lait-au-Cafe
Last active August 27, 2020 18:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lait-au-Cafe/27ce710355fbb21f4edfdfdac2396ae2 to your computer and use it in GitHub Desktop.
Save Lait-au-Cafe/27ce710355fbb21f4edfdfdac2396ae2 to your computer and use it in GitHub Desktop.
GolangでWindows用にクロスコンパイルするときのメモ
$ sudo apt install gcc-multilib
$ sudo apt install gcc-mingw-w64

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

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

amd64のほうは未検証

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment