Gox: Simple and real go Platform cross-compilation tool

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

Gox is a simple, non-fancy go Platform cross-compiling tool that uses the go build same standards. Gox will compile for multiple platforms in parallel. Gox also provides a set of cross-compiler toolchain.

Gox Project Address: Https://github.com/mitchellh/gox

Installation

In order to install Gox, please use the go get . We have tagged the version so we can switch the tag randomly to compile it:

$ go Get Github.com/mitchellh/gox
...
$ gox-h
...

Usage

Before you can use Gox, you must have a cross-compilation toolchain. Gox can help you do this automatically. All you need to do is run (each time you update go to do this):

$ gox-build-toolchain
...

When you're done with this, you can be ready to cross-compile.
If you know how to use it go build , then you know how to use Gox. For example, to compile the current project without supplying parameters, just call gox . Gox will be compiled for each platform in parallel based on the number of CPUs:

$ Gox
Number of parallel builds:4

-Darwin/386:github.com/mitchellh/gox
-Darwin/amd64:github.com/mitchellh/gox
-Linux/386:github.com/mitchellh/gox
-Linux/amd64:github.com/mitchellh/gox
-Linux/arm:github.com/mitchellh/gox
-Freebsd/386:github.com/mitchellh/gox
-Freebsd/amd64:github.com/mitchellh/gox
-Openbsd/386:github.com/mitchellh/gox
-Openbsd/amd64:github.com/mitchellh/gox
-Windows/386:github.com/mitchellh/gox
-Windows/amd64:github.com/mitchellh/gox
-Freebsd/arm:github.com/mitchellh/gox
-Netbsd/386:github.com/mitchellh/gox
-Netbsd/amd64:github.com/mitchellh/gox
-Netbsd/arm:github.com/mitchellh/gox
-Plan9/386:github.com/mitchellh/gox

Or, you just want to compile a project and sub-project:

$ Gox./...
...

Or, you want to just compile for Linux:

$ gox-os= "Linux"
...

Or, you just want to compile for 64-bit Linux:

$ gox-osarch= "Linux/amd64"
...

There are more options that can be gox -h viewed with help.

Comparison with other cross-compilation tools

Thank you very much for the tools that have given us more choices, and they have contributed a lot to the cross-compiling tools of the Go platform.

    • Dave Cheney's Cross compiler: Gox can be compiled for multiple platforms, so it's easy to run on a variety of Go-supported platforms. But Dave's one needs a shell to run. Gox supports compiling in parallel, but Dave simply compiles it sequentially. The Gox also makes it very easy to use the built-in filtering tools for the built-in arch system.
    • GOXC: It is a feature-rich tool that can compile system projects, upload binaries, generate download pages, and so on, compared to a slightly weaker Gox in cross-compiling two-yuan files. But Gox can compile the project in parallel, and GOXC cannot. Gox also does not enforce a format that specifies the output when compiling a two-metafile file.

Translation finishing: Segmentfault

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.