Fun.. managed to cross-compile a standalone #golang application entirely from within #Ubuntu into a Windows executable by using the mingw32 package, so I could send the executable to some friends for them to play with. The application includes goyaml, which is a cgo-dependent Go package (integrates C and Go code together). The application was unchanged, and the executable actually works.
+Johan Dahlin Quite interesting indeed. Do you use that with Stoq, out of curiosity?Dec 5, 2011
Can you please elaborate a bit on how have you done it? :)Dec 5, 2011
Oh, sorry, I'm more interested in Go cross-compilation. Sorry for being so unspecific. :\Dec 5, 2011
+Johan Dahlin thanks for the explanation, I appreciated it.
+Alexander Solovyov It was relatively painless, but did require a minor change in the build setup of Go. I'll polish a bit the build setup when I have a moment so that you can simply install mingw32 and build it all.
Once, that's done, though, it's very nice to work with it. Since the kernel nowadays is able to handle non-ELF binary formats (see the binfmt-support package), we can execute the cross-compiler as if it were a native compiler, which means building Go applications works exactly the same way as any other Go application, except you get a .exe at the end.Dec 5, 2011
Add a comment...