Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Up to golang 1.5.3 #19985

Merged
merged 1 commit into from
Jan 22, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions build/build-image/cross/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@
# This file creates a standard build environment for building cross
# platform go binary for the architecture kubernetes cares about.

FROM golang:1.4.2
MAINTAINER Joe Beda <jbeda@google.com>
FROM golang:1.5.3
# Original MAINTAINER Joe Beda <jbeda@google.com>
MAINTAINER Brendan Burns <bburns@google.com>

ENV KUBE_CROSSPLATFORMS \
linux/386 linux/arm \
darwin/amd64 darwin/386 \
windows/amd64 windows/386

RUN cd /usr/src/go/src && for platform in ${KUBE_CROSSPLATFORMS}; do GOOS=${platform%/*} GOARCH=${platform##*/} ./make.bash --no-clean; done
# Pre-compile the standard go library when cross-compiling. This is much easier now when we have go1.5
RUN for platform in ${KUBE_CROSSPLATFORMS}; do GOOS=${platform%/*} GOARCH=${platform##*/} go install std; done
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be go build instead of go install? http://dave.cheney.net/2015/08/22/cross-compilation-with-go-1-5

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The complaint on this site looks to be an issue only for homedir setups (vs a container):

This logic also holds true for the standard library, which lives in /usr/local/go/src, so will be compiled to /usr/local/go/pkg/$GOOS_$GOARCH. This is a problem, because when cross compiling the go tool needs to rebuild the standard library for your target, but the binary distribution expects that /usr/local/go is not writeable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gmarek That only applies if /usr/local/go/ isn't writeable, so it only applies to non-container setups (as @zmerlynn said)
See the follow-up piece why one should use go install to prebuild multi-arches here: https://medium.com/@rakyll/go-1-5-cross-compilation-488092ba44ec#.ad6kssueb


# Install g++, then download and install protoc for generating protobuf output
RUN apt-get install -y g++ && apt-get clean && rm -rf /var/lib/apt/lists/* &&\
Expand Down