Wiki
#664
Replies: 1 comment 2 replies
-
Since there's a windows cross-compilation section for MacOS and it took me a hot second to cross-compile Anaxim for windows from Linux instead - it could be worth to include a section for linux too, even thought it's essentially just a simpler version of the macos procedure. Here's my proposal: ### Build Windows executable from Linux
1. Install mingw64 gcc and g++
- Fedora/Red Hat: `sudo dnf install mingw64-gcc-c++`
- Debian/Ubuntu: `sudo apt install gcc-mingw-w64 g++-mingw-w64`
2. Run `go build` with proper environment variables:
```bash
GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC="x86_64-w64-mingw32-gcc" CXX="x86_64-w64-mingw32-g++" go build -o YourExeName.exe
```
You can also use zig instead of mingw:
```bash
GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC="zig cc -target x86_64-windows" CXX="zig c++ -target x86_64-windows" go build -o YourExeName.exe
``` |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
If you find any bug or missing documentation in our wiki let us know here!
Beta Was this translation helpful? Give feedback.
All reactions