-
Notifications
You must be signed in to change notification settings - Fork 0
Building Go 1.6 on Z Without Cross Compiling
These instructions describe how to build version 1.6 of Go for IBM Linux on z Systems running SLES 12 or RHEL 7.x. Ubuntu 16.0.4 is already distributed with a Go 1.6 compiler. These instructions do not require you to download an x86 binary or to cross compile from an x86 machine. All the steps are completed on a Linux on Z server.
Building Go for IBM Linux on z Systems is a four stage process:
- Download and unpack a Go compiler from the Ubuntu Launchpad
- Download a Go version 1.6 source tree for Linux on Z
- Use the Launchpad compiler to generate a bootstrap compiler
- Use the resulting bootstrap compiler to build Go
-
Create a directory; we will use $HOME/ubuntu
-
cd to $HOME/ubuntu and execute this command
wget http://launchpadlibrarian.net/253551511/golang-1.6-go_1.6.1-0ubuntu1_s390x.deb ```
-
Execute the following commands in $HOME/ubuntu:
ar -x golang-1.6-go_1.6.1-0ubuntu1_s390x.deb tar -xvf data.tar.xz rm usr/lib/go-1.6/src ```
-
Change to $HOME and execute the following:
git clone git@github.com:linux-on-ibm-z/go.git cd go git checkout release-branch.go1.6 ```
-
Execute:
cp -r $HOME/go/src $HOME/ubuntu/usr/lib/go-1.6/ ```
-
Create this file:
$HOME/ubuntu/usr/lib/go-1.6/src/runtime/internal/sys/zversion.go
with the following text as its content:
// auto generated by go tool dist
package sys
const DefaultGoroot = /sandbox/billo/go1.6/go
const TheVersion = go1.6
const Goexperiment = ``
const StackGuardMultiplier = 1
3. Execute:
export GOROOT=$HOME/go export GOROOT_BOOTSTRAP=$HOME/ubuntu/usr/lib/go-1.6 cd $HOME/go/src GOOS=linux GOARCH=s390x ./bootstrap.bash
#### Step 4: Use the resulting bootstrap compiler to build Go
1. In $HOME/go/src execute:
export GOROOT_BOOTSTRAP=$HOME/go-linux-s390x-bootstrap ./all.bash
The go compiler will build and run its built-in tests.