Skip to content
A dead simple, no frills Go cross compile tool
Branch: master
Clone or download
mitchellh Merge pull request #128 from mkeeler/go-mod-vendor
Allow -mod passthrough to the go compiler.
Latest commit d8caaff Apr 10, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
vendor Use structured version checking. Feb 21, 2018
.gitattributes Also output stdout when toolchain build fails Jan 16, 2014
.gitignore support specifying output template Nov 17, 2013
Gopkg.toml dep Jan 2, 2018
LICENSE Add license Nov 17, 2013 update README Aug 19, 2015
appveyor.yml Adding appveyor config for windows testing Dec 6, 2017
go.go Allow -mod passthrough to the go compiler. Apr 10, 2019
go_test.go Update Platforms to Go 1.9 Feb 23, 2018
main_osarch.go typo Jun 18, 2015
platform.go Add Support for Go 1.10 Feb 23, 2018
platform_flag.go fix some platform flag bugs, tested Jun 18, 2015
platform_flag_test.go fix some platform flag bugs, tested Jun 18, 2015

Gox - Simple Go Cross Compilation

Gox is a simple, no-frills tool for Go cross compilation that behaves a lot like standard go build. Gox will parallelize builds for multiple platforms. Gox will also build the cross-compilation toolchain for you.


To install Gox, please use go get. We tag versions so feel free to checkout that tag and compile.

$ go get
$ gox -h


If you know how to use go build, then you know how to use Gox. For example, to build the current package, specify no parameters and just call gox. Gox will parallelize based on the number of CPUs you have by default and build for every platform by default:

$ gox
Number of parallel builds: 4

-->      darwin/386:
-->    darwin/amd64:
-->       linux/386:
-->     linux/amd64:
-->       linux/arm:
-->     freebsd/386:
-->   freebsd/amd64:
-->     openbsd/386:
-->   openbsd/amd64:
-->     windows/386:
-->   windows/amd64:
-->     freebsd/arm:
-->      netbsd/386:
-->    netbsd/amd64:
-->      netbsd/arm:
-->       plan9/386:

Or, if you want to build a package and sub-packages:

$ gox ./...

Or, if you want to build multiple distinct packages:

$ gox

Or if you want to just build for linux:

$ gox -os="linux"

Or maybe you just want to build for 64-bit linux:

$ gox -osarch="linux/amd64"

And more! Just run gox -h for help and additional information.

Versus Other Cross-Compile Tools

A big thanks to these other options for existing. They each paved the way in many aspects to make Go cross-compilation approachable.

  • Dave Cheney's golang-crosscompile - Gox compiles for multiple platforms and can therefore easily run on any platform Go supports, whereas Dave's scripts require a shell. Gox will also parallelize builds. Dave's scripts build sequentially. Gox has much easier to use OS/Arch filtering built in.

  • goxc - A very richly featured tool that can even do things such as build system packages, upload binaries, generate download webpages, etc. Gox is a super slim alternative that only cross-compiles binaries. Gox builds packages in parallel, whereas goxc doesn't. Gox doesn't enforce a specific output structure for built binaries.

You can’t perform that action at this time.