- Install Go for Linux the usual way on your main Linux box:
cd
wget https://storage.googleapis.com/golang/go1.6.2.linux-amd64.tar.gz
tar -zxvf go1.6.2.linux-amd64.tar.gz
sudo mv go /usr/local/
export GOROOT=/usr/local/go
mkdir -p ~/gitwork/go/src
mkdir ~/gitwork/go/bin
mkdir ~/gitwork/go/pkg
export GOPATH=~/gitwork/go
go version
- Cross-compile Go for ARM64
mkdir gobuild
cd gobuild/
git clone https://go.googlesource.com/go
cd go
git checkout go1.6.2
cd src
export GOARCH=arm64
export GOROOT_BOOTSTRAP=/usr/local/go
export GOOS=linux
./make.bash
cd ../..
tar -cvf go1.6.2.linux-arm64.tar ./go
gzip go1.6.2.linux-arm64.tar
- Use sftp or scp on the ARM64 device to get the tar.gz file
- Then install and set it up on ARM64:
tar -zxvf go1.6.2.linux-arm64.tar.gz
sudo mv go /usr/local/
cd /usr/local/go/bin/linux_arm64
sudo cp * ..
cd
export GOROOT=/usr/local/go
mkdir -p ~/gitwork/go/src
mkdir ~/gitwork/go/bin
mkdir ~/gitwork/go/pkg
export GOPATH=~/gitwork/go
go version
Thx, small mods for 1.8 done here: https://gist.github.com/truedat101/5898604b1f7a1ec42d65a75fa6a0b802 , will cover bootstrap build.