[CentOS-devel] [altarch] multiarch docker images

Fri Jan 15 00:07:42 UTC 2016
Jim Perrin <jperrin at centos.org>


On 01/14/2016 04:38 PM, Jim Perrin wrote:

> gccgo requires gcc 4.9.x at minimum and for more recent docker versions
> you'd need gcc 5.1.1 or 5.2.x. Since the distro gcc is 4.8.3, that's not
> really workable.
> 
> In theory, golang 1.5 has experimental support for ppc64 and ppc64le. We
> can certainly try to bootstrap golang from x86_64 to ppc64le the same
> way we did for aarch64.


So, using a variation of what I did for arm64, the Dockerfile below will
create a bootstrap build of golang for ppc64le. You can then run the
container and copy out the tarball. This gets you past the first step.
============================
FROM centos:7

RUN yum install -y glibc-static git gcc
RUN git clone https://go.googlesource.com/go /go
# build bootstrap version
RUN cd /go && \
        git checkout go1.4.2 && \
        cd src && \
        GOROOT=/go GOROOT_FINAL=/opt/go1.4.2 \
        ./make.bash && \
        mkdir -p /opt/go1.4.2 && \
        cd /go && \
        cp -pav * /opt/go1.4.2/

RUN cd /go && \
        rm -rf * && git reset --hard HEAD && \
        git checkout go1.5.3 && \
        cd src && \
        GOROOT=/go \
        GOHOSTARCH=amd64 \
        GOARCH=ppc64le \
        GOROOT_BOOTSTRAP=/opt/go1.4.2 \
        GOROOT_FINAL=/opt/go1.5-ppc64le \
        ./make.bash && \
        mkdir -p /opt/go1.5-ppc64le && \
        cd /go && \
        cp -pav * /opt/go1.5-ppc64le/

RUN tar czf /go1.5-ppc64le.tar.gz /opt/go1.5-ppc64le
==============================

Extract the tarball on your ppc64le system someplace out of the way, and
run the go binary to be sure it works.

>From here you can pull down the fedora src.rpm for golang, and build it
manually with rpmbuild. This is a scratch copy, and you'll need to alter
the spec file to reference your instance of go in /opt or wherever, and
strip buildrequires for golang as needed.


Once this is successful, you *should* be able to use the resulting rpm
via lookaside repo in mock to build the unmodified src.rpm.



If you've made it this far and you're still sober, reward yourself with
a nice glass of scotch for a job well done. Isn't bootstrapping fun!?!?





-- 
Jim Perrin
The CentOS Project | http://www.centos.org
twitter: @BitIntegrity | GPG Key: FA09AD77