go-gtk
go-gtk copied to clipboard
Compiling for Windows on Mac
Hi, probable dumb question incoming, but I'm quite new to Go and totally new to GUI stuff: Is it possible to compile for Windows from macOS? Everything is working fine as long as I try to compile the examples for Mac, but when trying to run
GOOS=windows GOARCH=386 go build
I keep getting this output
../../gtk/gtk.go:19:2: no buildable Go source files in /Users/francescorenzi/development/go/src/github.com/mattn/go-gtk/gdk
demo.go:5:2: no buildable Go source files in /Users/francescorenzi/development/go/src/github.com/mattn/go-gtk/gdkpixbuf
demo.go:6:2: no buildable Go source files in /Users/francescorenzi/development/go/src/github.com/mattn/go-gtk/glib
../../gtk/gtk.go:22:2: no buildable Go source files in /Users/francescorenzi/development/go/src/github.com/mattn/go-gtk/pango
../../gtk/gtk.go:23:2: no buildable Go source files in /Users/francescorenzi/development/go/src/github.com/mattn/go-pointer
To me the chances are I can't do this on my Mac machine or am I missing something really dumb? I tend to the second alternative. By the way the example I'm trying to compile is the demo
one.
You need to install cross C-compiler for Windows.
Can you be more specific @mattn? I've successfully built (and distributed) other golang Windows executables from my Mac.
The same issue: $ GOOS=windows GOARCH=386 go build ../../gtk/gtk.go:19:2: build constraints exclude all Go files in /home/alex/go/src/github.com/mattn/go-gtk/gdk listview.go:7:2: build constraints exclude all Go files in /home/alex/go/src/github.com/mattn/go-gtk/gdkpixbuf ../../gtk/gtk.go:21:2: build constraints exclude all Go files in /home/alex/go/src/github.com/mattn/go-gtk/gio listview.go:8:2: build constraints exclude all Go files in /home/alex/go/src/github.com/mattn/go-gtk/glib ../../gtk/gtk.go:23:2: build constraints exclude all Go files in /home/alex/go/src/github.com/mattn/go-gtk/pango ../../gtk/gtk.go:24:2: build constraints exclude all Go files in /home/alex/go/src/github.com/mattn/go-pointer
As I mentioned in above, you MUST use cross C-compiler not host compiler.
Can you give an example? Thanks.
This entry is written not for go-gtk. But might be helpful.
http://www.limitlessfx.com/cross-compile-golang-app-for-windows-from-linux.html