-
-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot cross-compile from Mac to Windows #178
Comments
It's a little tricky to be able to cross-compile it from Mac to Windows because it requires the native SDL2 library for Windows to link against. But I'm keeping this issue here just in case it is indeed possible. |
Go requires a C/C++ cross compiler for Windows for it to cross compile cgo stuff. I used mingw-w64 on ArchLinux to compile a basic snake game. An old build of mingw-w64 is available for Mac. Most popular Linux distros have mingw-w64 available. Then you need to download mingw devel versions of sdl available at: https://www.libsdl.org/download-2.0.php cgo is normally disabled during cross compile as said by Dave Cheney at: Hence the CGO_ENABLED="1" flag. This command works: Edit: |
Thanks @demonshreder. I'll try it out and put in the README if I can do it successfully. 👍 |
Hi @veeableful, were you able to look into cross compiling? |
Hi @demonshreder, sorry I totally slipped this one! I just tested cross-compiling on Linux to produce a Windows binary and it works with your guide. I have written a guide for Linux-to-Windows version inside README.md. I'll try on OSX next! |
@demonshreder You're right. I've added them to the README.md! |
Thank you. I had deleted my previous comment later thinking the additional links from windows setup help should be fine but in retrospect a linux user wouldn't stumble upon it easily. Hope you are able to get it working on Mac OS. |
Hi @caioariede, I've added a guide to cross-compile from Mac to Windows on the README.md. If you're still here, I would love to have your input! Otherwise, I'll wait for people to confirm that the guide is working for them. |
You might be interested in issue 382. If we can remove CGo on Windows, you only need a Go compiler and the |
I'm trying to cross-compile something but I'm getting an error.
Any ideas?
Go version:
Command:
Error message:
Full log:
The text was updated successfully, but these errors were encountered: