go build with 1.7.0 tries to use gcc (regression after 1.6.3)
No related issues
I looked at http://bugs.alpinelinux.org/issues/6029
but that issue is unrelated.
I have found no current issues here that seem to relate
to the issue I have with alpine go=1.7.0-r0 from edge/community.
My issue
I try to statically build a go project (see reproducer described below).
- Works: go=1.6.3-r0 from alpine/community
- Not works: go=1.7.0-r0 from alpine/edge
- Works: go=1.7 when built on alpine from source
aka official golang:1.7-alpine docker image at
https://github.com/docker-library/golang/blob/ba5f6a10dcc46edeb66377261f873e3b61af36f5/1.7/alpine/Dockerfile
What I expect
A statically-compiled binary
$ file ssllabs-scan
ssllabs-scan: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, not stripped
What actually happens with go=1.7.0-r0 from edge/community
warning: unable to find runtime/cgo.a
/usr/lib/go/pkg/tool/linux_amd64/link: running gcc failed: exec: "gcc": executable file not found in $PATH
Reproducer
I have a reproducer at
https://github.com/jumanjihouse/docker-ssllabs-scan/pull/30
It includes three commits, each with a build on CircleCI
to show detailed output of the build (both success and failure).
The three commits follow the steps shown above, specifically:
- works with go=1.6.3 alpine package (gcc not needed)
- fails with go=1.7.0 alpine package (missing gcc)
- works with go=1.7.x from source (gcc not needed)
(from redmine: issue id 6072, created on 2016-08-21, closed on 2017-04-07)
- Changesets:
- Revision 875ec0f2 by Timo Teräs on 2016-09-13T13:09:32Z:
community/go: depend on binutils and gcc
fixes #6072