This is a creation in Article, where the information may have evolved or changed.
"First time Installation"
1. Installing Gox
$ go Get github.com/mitchellh/gox$ CD $GOPATH/src/github.com/mitchellh/gox$ go Build
2. Edit ~/.bash_profile (BSH) or ~/.ZSHRC (zsh) to add a line:
Alias gox= "$GOPATH/src/github.com/mitchellh/gox/gox"
Open the terminal and let the settings take effect.
3. Generate the local toolchain (if you upgrade to go version, such as from 1.3.3 to 1.4, you need to rerun this command first)
$ gox-build-toolchain
"Cross-compiling project"
1. For example, there is a project directory in $gpath/src/hello
$CD $GPATH/src/hello$goxnumber of parallel builds:8--> darwin/386:hello--> darwin/amd64:hello--> linux/386:hello--> linux/amd64:hello--> linux/arm:hello--> freebsd/386:hello--> freebsd/amd64:hello--> openbsd/386:hello--> openbsd/amd64:hello--> windows/386: hello--> windows/amd64:hello--> freebsd/arm:hello--> netbsd/386:hello--> netbsd/amd64:hello--> netbsd/arm:hello--> plan9/386:hello--> dragonfly/386:hello--> Dragonfly/amd64:hello--> Solaris/amd64:hello
The following platform files are generated:
$lltotal 16768drwxr-xr-x Wenke Staff 782-19:42. Drwxr-xr-x 7 Wenke Staff 238 12 28 16:21. -rw-r--r--1 Wenke Staff Wu 16:22 hello.go-rwxr-xr-x 1 Wenke staff 381420 19:42 hello_darwin_386-r Wxr-xr-x 1 Wenke Staff 467040-19:42 hello_darwin_amd64-rwxr-xr-x 1 Wenke staff 381536 19:42 Hello_drag Onfly_386-rwxr-xr-x 1 Wenke Staff 469424-19:42 hello_dragonfly_amd64-rwxr-xr-x 1 Wenke staff 381296 12 30 19 : Hello_freebsd_386-rwxr-xr-x 1 Wenke Staff 469240 (19:42 hello_freebsd_amd64-rwxr-xr-x 1 Wenke Staff 40833 6 19:42 hello_freebsd_arm-rwxr-xr-x 1 Wenke staff 390768, 19:42 hello_linux_386-rwxr-xr-x 1 Wenke Staff 475888 19:42 hello_linux_amd64-rwxr-xr-x 1 Wenke staff 413856 19:42 hello_linux_arm-rwxr-xr-x 1 Wenke Staff 386440-19:42 hello_netbsd_386-rwxr-xr-x 1 Wenke staff 470448 1 19:42 hello_netbsd_amd64-rwxr-xr-x Wenke Staff 409224 12 30 19:42 Hello_netbsd_arm-rwxr-xr-x 1 Wenke Staff 381696 (19:42 hello_openbsd_386-rwxr-xr-x 1 Wenke staff 469648 12 3 0 19:42 hello_openbsd_amd64-rwxr-xr-x 1 Wenke staff 365441, 19:42 hello_plan9_386-rwxr-xr-x 1 Wenke Staff 490 296 19:42 hello_solaris_amd64-rwxr-xr-x 1 Wenke staff 385536 19:42 Hello_windows_386.exe-rwxr-xr-x 1 Wen KE staff 466944 19:42 hello_windows_amd64.exe
2. Generate only files from Mac and Linux platforms
$gox-os "Darwin Linux" number of parallel builds:8--> darwin/386:hello--> darwin/amd64:hello--> linux/386:hello--> linux/amd64:hello--> Linux/arm:hello
3. Generate only files for Linux platform AMD64
$gox-osarch= "LINUX/AMD64" number of parallel builds:8--> Linux/amd64:hello