Build Go from source

I’m adding a new step at our CI to build and exec our application tests against the Go tip every day. The problem is, I’m having trouble building Go from source. My dockerfile isn’t finished and it looks like this:

FROM debian:stretch

RUN apt update \
  && DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y ca-certificates=20161130+nmu1+deb9u1 build-essential=12.3 golang=2:1.7~5 git=1:2.11.0-3+deb9u4 gcc=4:6.3.0-4 \
  && apt clean \
  && rm -rf /var/lib/apt/lists/*

RUN git clone https://go.googlesource.com/go /usr/local/go \
  && cd /usr/local/go/src/ \
  && bash all.bash

This is the build output:

root@60f6ffea56ba:/usr/local/go/src# bash all.bash
Building Go cmd/dist using /usr/lib/go-1.7.
Building Go toolchain1 using /usr/lib/go-1.7.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for linux/amd64.

##### Testing packages.
ok  	archive/tar	0.124s
ok  	archive/zip	1.809s
ok  	bufio	0.274s
ok  	bytes	0.244s
ok  	compress/bzip2	0.090s
ok  	compress/flate	1.206s
ok  	compress/gzip	0.047s
ok  	compress/lzw	0.029s
ok  	compress/zlib	0.056s
ok  	container/heap	0.015s
ok  	container/list	0.023s
ok  	container/ring	0.043s
ok  	context	0.997s
ok  	crypto	0.057s
ok  	crypto/aes	0.025s
ok  	crypto/cipher	0.224s
ok  	crypto/des	0.024s
ok  	crypto/dsa	0.068s
ok  	crypto/ecdsa	0.323s
ok  	crypto/elliptic	0.581s
ok  	crypto/hmac	0.027s
ok  	crypto/internal/subtle	0.034s
ok  	crypto/md5	0.009s
ok  	crypto/rand	0.093s
ok  	crypto/rc4	0.038s
ok  	crypto/rsa	0.101s
ok  	crypto/sha1	0.041s
ok  	crypto/sha256	0.023s
ok  	crypto/sha512	0.005s
ok  	crypto/subtle	0.018s
ok  	crypto/tls	1.840s
ok  	crypto/x509	1.745s
ok  	database/sql	0.650s
ok  	database/sql/driver	0.028s
ok  	debug/dwarf	0.019s
ok  	debug/elf	0.063s
ok  	debug/gosym	0.500s
ok  	debug/macho	0.022s
ok  	debug/pe	0.014s
ok  	debug/plan9obj	0.027s
ok  	encoding/ascii85	0.038s
ok  	encoding/asn1	0.009s
ok  	encoding/base32	0.057s
ok  	encoding/base64	0.016s
ok  	encoding/binary	0.031s
ok  	encoding/csv	0.031s
ok  	encoding/gob	0.072s
ok  	encoding/hex	0.041s
ok  	encoding/json	0.611s
ok  	encoding/pem	0.014s
ok  	encoding/xml	0.055s
ok  	errors	0.032s
ok  	expvar	0.013s
ok  	flag	0.071s
ok  	fmt	0.278s
ok  	go/ast	0.004s
ok  	go/build	0.477s
ok  	go/constant	0.018s
ok  	go/doc	0.091s
ok  	go/format	0.033s
ok  	go/importer	0.162s
ok  	go/internal/gccgoimporter	0.024s
ok  	go/internal/gcimporter	0.738s
ok  	go/internal/srcimporter	1.219s
ok  	go/parser	0.062s
ok  	go/printer	0.386s
ok  	go/scanner	0.021s
ok  	go/token	0.061s
ok  	go/types	1.066s
ok  	hash	0.023s
ok  	hash/adler32	0.037s
ok  	hash/crc32	0.057s
ok  	hash/crc64	0.013s
ok  	hash/fnv	0.005s
ok  	html	0.028s
ok  	html/template	0.058s
ok  	image	0.175s
ok  	image/color	0.018s
ok  	image/draw	0.092s
ok  	image/gif	0.787s
ok  	image/jpeg	0.295s
ok  	image/png	0.084s
ok  	index/suffixarray	0.034s
ok  	internal/cpu	0.052s
ok  	internal/fmtsort	0.013s
ok  	internal/poll	0.069s
ok  	internal/singleflight	0.047s
ok  	internal/trace	2.715s
ok  	internal/x/crypto/chacha20poly1305	0.146s
ok  	internal/x/crypto/cryptobyte	0.021s
ok  	internal/x/crypto/curve25519	0.048s
ok  	internal/x/crypto/hkdf	0.005s
ok  	internal/x/crypto/internal/chacha20	0.168s
ok  	internal/x/crypto/poly1305	0.043s
ok  	internal/x/net/dns/dnsmessage	0.090s
ok  	internal/x/net/http/httpguts	0.005s
ok  	internal/x/net/http/httpproxy	0.055s
ok  	internal/x/net/http2/hpack	0.033s
ok  	internal/x/net/idna	0.015s
ok  	internal/x/net/nettest	1.413s
ok  	internal/x/text/transform	0.017s
ok  	internal/x/text/unicode/norm	0.035s
ok  	internal/xcoff	0.032s
ok  	io	0.064s
ok  	io/ioutil	0.041s
ok  	log	0.012s
ok  	log/syslog	1.261s
ok  	math	0.018s
ok  	math/big	2.957s
ok  	math/bits	0.039s
ok  	math/cmplx	0.013s
ok  	math/rand	0.316s
ok  	mime	0.023s
ok  	mime/multipart	0.603s
ok  	mime/quotedprintable	0.444s
--- FAIL: TestCgoLookupPort (0.00s)
    cgo_unix_test.go:48: lookup tcp/smtp: Servname not supported for ai_socktype
--- FAIL: TestCgoLookupPortWithCancel (0.00s)
    cgo_unix_test.go:61: lookup tcp/smtp: Servname not supported for ai_socktype
--- FAIL: TestReadLine (0.00s)
    parse_test.go:24: open /etc/services: no such file or directory
FAIL
FAIL	net	6.156s
ok  	net/http	4.338s
ok  	net/http/cgi	1.084s
ok  	net/http/cookiejar	0.070s
ok  	net/http/fcgi	0.052s
ok  	net/http/httptest	0.092s
ok  	net/http/httptrace	0.034s
ok  	net/http/httputil	0.157s
ok  	net/http/internal	0.020s
ok  	net/http/pprof	2.028s
ok  	net/internal/socktest	0.008s
ok  	net/mail	0.007s
ok  	net/rpc	0.046s
ok  	net/rpc/jsonrpc	0.028s
ok  	net/smtp	0.089s
ok  	net/textproto	0.004s
ok  	net/url	0.034s
ok  	os	0.849s
ok  	os/exec	0.753s
ok  	os/signal	5.137s
ok  	os/user	0.024s
ok  	path	0.022s
ok  	path/filepath	0.051s
ok  	plugin	0.036s
ok  	reflect	0.411s
ok  	regexp	0.201s
ok  	regexp/syntax	0.421s
ok  	runtime	65.215s
ok  	runtime/debug	0.095s
ok  	runtime/internal/atomic	0.110s
ok  	runtime/internal/math	0.015s
ok  	runtime/internal/sys	0.003s
ok  	runtime/pprof	10.581s
ok  	runtime/pprof/internal/profile	0.004s
ok  	runtime/trace	3.281s
ok  	sort	0.134s
ok  	strconv	0.886s
ok  	strings	0.238s
ok  	sync	0.364s
ok  	sync/atomic	0.171s
ok  	syscall	0.102s
ok  	testing	1.319s
ok  	testing/quick	0.277s
ok  	text/scanner	0.054s
ok  	text/tabwriter	0.032s
ok  	text/template	0.450s
ok  	text/template/parse	0.036s
ok  	time	2.904s
ok  	unicode	0.026s
ok  	unicode/utf16	0.041s
ok  	unicode/utf8	0.054s
ok  	cmd/addr2line	2.427s
ok  	cmd/api	0.038s
ok  	cmd/asm/internal/asm	0.753s
ok  	cmd/asm/internal/lex	0.004s
ok  	cmd/compile	0.066s
ok  	cmd/compile/internal/gc	20.135s
ok  	cmd/compile/internal/ssa	0.607s
ok  	cmd/compile/internal/syntax	0.030s
ok  	cmd/compile/internal/test	0.048s [no tests to run]
ok  	cmd/compile/internal/types	0.018s
ok  	cmd/cover	3.097s
ok  	cmd/doc	0.051s
ok  	cmd/fix	7.607s
ok  	cmd/go	101.490s
ok  	cmd/go/internal/cache	1.047s
ok  	cmd/go/internal/dirhash	0.013s
ok  	cmd/go/internal/generate	0.082s
ok  	cmd/go/internal/get	0.026s
ok  	cmd/go/internal/imports	0.010s
ok  	cmd/go/internal/load	0.034s
ok  	cmd/go/internal/lockedfile	0.035s
ok  	cmd/go/internal/lockedfile/internal/filelock	0.112s
ok  	cmd/go/internal/modconv	0.043s
ok  	cmd/go/internal/modfetch	0.056s
ok  	cmd/go/internal/modfetch/codehost	0.033s
ok  	cmd/go/internal/modfile	0.030s
ok  	cmd/go/internal/modload	0.027s
ok  	cmd/go/internal/module	0.021s
ok  	cmd/go/internal/mvs	0.021s
ok  	cmd/go/internal/par	0.043s
ok  	cmd/go/internal/search	0.006s
ok  	cmd/go/internal/semver	0.003s
ok  	cmd/go/internal/txtar	0.019s
ok  	cmd/go/internal/web2	0.033s
ok  	cmd/go/internal/work	0.017s
ok  	cmd/gofmt	0.115s
ok  	cmd/internal/buildid	0.261s
ok  	cmd/internal/dwarf	0.007s
ok  	cmd/internal/edit	0.004s
ok  	cmd/internal/goobj	0.986s
ok  	cmd/internal/obj	0.005s
ok  	cmd/internal/obj/arm64	0.062s
ok  	cmd/internal/obj/x86	0.469s
ok  	cmd/internal/objabi	0.010s
ok  	cmd/internal/src	0.005s
ok  	cmd/internal/test2json	0.163s
ok  	cmd/link	3.180s
ok  	cmd/link/internal/ld	3.100s
ok  	cmd/link/internal/sym	0.042s
ok  	cmd/nm	3.390s
ok  	cmd/objdump	2.968s
ok  	cmd/pack	2.444s
ok  	cmd/trace	0.028s
ok  	cmd/vendor/github.com/google/pprof/internal/binutils	0.111s
ok  	cmd/vendor/github.com/google/pprof/internal/driver	0.442s
ok  	cmd/vendor/github.com/google/pprof/internal/elfexec	0.048s
ok  	cmd/vendor/github.com/google/pprof/internal/graph	0.015s
ok  	cmd/vendor/github.com/google/pprof/internal/measurement	0.009s
ok  	cmd/vendor/github.com/google/pprof/internal/report	0.300s
ok  	cmd/vendor/github.com/google/pprof/internal/symbolizer	0.018s
ok  	cmd/vendor/github.com/google/pprof/internal/symbolz	0.022s
ok  	cmd/vendor/github.com/google/pprof/profile	0.120s
ok  	cmd/vendor/github.com/ianlancetaylor/demangle	0.035s
ok  	cmd/vendor/golang.org/x/arch/arm/armasm	0.028s
ok  	cmd/vendor/golang.org/x/arch/arm64/arm64asm	0.077s
ok  	cmd/vendor/golang.org/x/arch/ppc64/ppc64asm	0.018s
ok  	cmd/vendor/golang.org/x/arch/x86/x86asm	0.145s
ok  	cmd/vendor/golang.org/x/crypto/ssh/terminal	0.008s
ok  	cmd/vendor/golang.org/x/sys/unix	0.585s
ok  	cmd/vet	8.483s
2019/02/27 12:10:35 Failed: exit status 1

Already have the gcc installed, am I missing something?
Did the test with a sable branch like release-branch.go1.12, but it gives the same error…

This looks like a successful build for me with some tests failing.

Why run them at all? Just build and install.

1 Like

Nevermind… I need some sleep. Sorry and thanks!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.