You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First off, I am compiling for windows on linux. I do have the windows compiler installed though.
This is the command I am running: env GOOS=windows GOARCH=amd64 CGO_ENABLED=1 go build main.go
And this is the output: # runtime/cgo gcc: error: unrecognized command-line option ‘-mthreads’; did you mean ‘-pthread’?
How do I fix this?
The text was updated successfully, but these errors were encountered:
You cannot use your host GCC compiler to compile for Windows, of course, that will not work. You need to install the appropriate toolchain with a compiler for the platform you want to compile for. In your case you need https://www.mingw-w64.org/ and something like CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc GOOS=windows GOARCH=amd64 go build. You can search the issues here, or search globally how to cross-compile CGO, i.e. you can for example use zig etc.
First off, I am compiling for windows on linux. I do have the windows compiler installed though.
This is the command I am running:
env GOOS=windows GOARCH=amd64 CGO_ENABLED=1 go build main.go
And this is the output:
# runtime/cgo
gcc: error: unrecognized command-line option ‘-mthreads’; did you mean ‘-pthread’?
How do I fix this?
The text was updated successfully, but these errors were encountered: