Closed rawsh closed 6 years ago
Try also adding CGO_ENABLED=1
.
@andlabs huh, that fixed it. Before cgo gave a different error
Right, you need to explicitly enable cgo when cross-compiling. Good luck!
didn't worked out for me I'm compiling on osx - here I can build it without problems: ➜ chamgo-ui git:(master) ✗ gox -osarch darwin/amd64 Number of parallel builds: 7
--> darwin/amd64: github.com/user/chamgo-ui ➜ chamgo-ui git:(master) ✗
but rather linux nor windows gets crosscompiled: ➜ chamgo-ui git:(master) ✗ export CGO_ENABLED=1 ➜ chamgo-ui git:(master) ✗ gox -osarch windows/386 Number of parallel builds: 7
--> windows/386: github.com/user/chamgo-ui
1 errors occurred: --> windows/386 error: exit status 2 Stderr: # github.com/user/chamgo-ui ./chamgo-ui.go:18:9: undefined: ui.Main ./chamgo-ui.go:25:18: undefined: ui.NewLabel ./chamgo-ui.go:26:24: undefined: ui.NewLabel ./chamgo-ui.go:27:19: undefined: ui.NewCombobox ./chamgo-ui.go:32:19: undefined: ui.NewButton ./chamgo-ui.go:33:25: undefined: ui.NewLabel ./chamgo-ui.go:35:22: undefined: ui.NewHorizontalBox ./chamgo-ui.go:39:16: undefined: ui.NewVerticalBox ./chamgo-ui.go:45:21: undefined: ui.NewLabel ./chamgo-ui.go:46:16: undefined: ui.NewCombobox ./chamgo-ui.go:46:16: too many errors
same program without ui get's (cross)compiled without problems: ➜ chamgo git:(xmodem) ✗ gox -osarch windows/amd64 Number of parallel builds: 7
--> windows/amd64: github.com/user/chamgo
➜ chamgo git:(xmodem) ✗ gox -osarch windows/386
Number of parallel builds: 7
--> windows/386: github.com/user/chamgo ➜ chamgo git:(xmodem) ✗
You also need to set $CC
and $CXX
to point to the appropriate C and C++ compilers. Other than that, I wouldn't know unless you enabled verbose or debug output on gox, because I don't know what gox is doing.
Using the documentation example, a (fedora) compile for windows fails:
A normal build works fine.