Skip to content

Instantly share code, notes, and snippets.

@utky
Created January 23, 2017 04:09
Show Gist options
  • Save utky/6db2238a123b13cabe4ed5af304cfd5b to your computer and use it in GitHub Desktop.
Save utky/6db2238a123b13cabe4ed5af304cfd5b to your computer and use it in GitHub Desktop.
procedure to enable go cross compile

Install system wide go

nix-env -iA ....

Download source code and compile it

Download

mkdir -p ${GOPATH}/bootstrap
tar xzf .... -C ${GOPATH}/bootstrap
cd ${GOPATH}/bootstrap/src
./make.bash

Build a binary to cross compile

export GO_BOOTSTRAP=${GOPATH}/bootstrap
cd $(go env GOROOT)
cd src
sudo GOROOT_BOOTSTRAP=${GOROOT_BOOTSTRAP} GOOS=linux GOARCH=amd64 ./make.bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment