Skip to content

build: bootstrapping Go 1.4 from source fails with gcc 6.3 under Debian 9 #20276

Closed
@zephyr

Description

@zephyr

Bugreport

I want to build Go Tip completely from Source on Debian 9 Stretch (currently testing, soon new stable).

So i tried first to build go1.4 from source, using the git branch:

79d85a4 [release-branch.go1.4] VERSION: go1.4-bootstrap-20161024

And using the gcc of the distribution:

gcc --version
gcc (Debian 6.3.0-16) 6.3.0 20170425

I expected it to successfully build a go 1.4 binary, instead i got:

$ ./make.bash 
# Building C bootstrap tool.
cmd/dist

# Building compilers and Go bootstrap tool for host, linux/amd64.
lib9
libbio
liblink
cmd/cc
cmd/gc
cmd/6l
cmd/6a
cmd/6c
/opt/golang1.4/src/cmd/6c/txt.c: In function 'gmove':
/opt/golang1.4/src/cmd/6c/txt.c:995:28: warning: left shift of negative value [-Wshift-negative-value]
     f->vconst |= (vlong)~0 << 32;
                            ^~
/opt/golang1.4/src/cmd/6c/txt.c:1045:28: warning: left shift of negative value [-Wshift-negative-value]
     f->vconst |= (vlong)~0 << 32;
                            ^~
cmd/6g
runtime
errors
sync/atomic
sync
io
unicode
unicode/utf8
unicode/utf16
bytes
math
strings
strconv
bufio
sort
container/heap
encoding/base64
syscall
time
os
reflect
fmt
encoding
encoding/json
flag
path/filepath
path
io/ioutil
log
regexp/syntax
regexp
go/token
go/scanner
go/ast
go/parser
os/exec
os/signal
net/url
text/template/parse
text/template
go/doc
go/build
cmd/go

# Building packages and commands for linux/amd64.
runtime
errors
sync/atomic
unicode
unicode/utf8
math
sort
encoding
unicode/utf16
container/list
sync
crypto/subtle
container/ring
image/color
runtime/race
container/heap
io
syscall
image/color/palette
hash
crypto/cipher
hash/crc32
crypto/hmac
hash/adler32
hash/crc64
hash/fnv
bytes
strings
bufio
text/tabwriter
time
internal/syscall
path
html
compress/bzip2
strconv
math/rand
math/cmplx
os
reflect
regexp/syntax
crypto
encoding/base64
net/url
crypto/aes
crypto/rc4
crypto/md5
crypto/sha1
crypto/sha256
crypto/sha512
encoding/pem
encoding/ascii85
encoding/base32
image
path/filepath
os/signal
io/ioutil
os/exec
image/draw
image/jpeg
regexp
fmt
encoding/binary
crypto/des
cmd/pprof/internal/svg
index/suffixarray
cmd/internal/goobj
cmd/internal/rsc.io/arm/armasm
cmd/internal/rsc.io/x86/x86asm
debug/dwarf
debug/gosym
debug/plan9obj
flag
log
go/token
encoding/json
encoding/xml
text/template/parse
go/scanner
compress/flate
go/ast
debug/elf
debug/macho
debug/pe
text/template
compress/gzip
math/big
encoding/hex
mime
net/http/internal
runtime/pprof
cmd/pack
cmd/pprof/internal/profile
cmd/pprof/internal/tempfile
archive/tar
go/parser
go/printer
cmd/internal/objfile
go/doc
crypto/elliptic
encoding/asn1
crypto/rand
crypto/dsa
cmd/addr2line
cmd/nm
cmd/objdump
crypto/rsa
cmd/pprof/internal/plugin
cmd/cgo
go/format
crypto/ecdsa
go/build
cmd/fix
crypto/x509/pkix
cmd/gofmt
html/template
cmd/pprof/internal/symbolizer
cmd/pprof/internal/symbolz
cmd/yacc
cmd/pprof/internal/report
archive/zip
compress/lzw
compress/zlib
database/sql/driver
encoding/csv
encoding/gob
database/sql
image/gif
image/png
runtime/debug
testing
cmd/pprof/internal/commands
testing/iotest
testing/quick
text/scanner
cmd/pprof/internal/driver
runtime/cgo
# runtime/cgo
/usr/bin/ld: -r and -pie may not be used together
collect2: error: ld returned 1 exit status

This may be related to Debian 9 building position independent executables (PIE) by default.

Steps to reproduce

Fetch and launch a Live Image for Debian 9:

$ wget http://get.debian.org/cdimage/weekly-live-builds/amd64/iso-hybrid/debian-live-testing-amd64-xfce.iso
$ qemu-system-x86_64 -enable-kvm -m 4G -smp 2 -cdrom debian-live-testing-amd64-xfce.iso

Inside the VM:

$ sudo apt update
$ sudo apt install git
$ git clone https://go.googlesource.com/go
$ cd go/src
$ git checkout origin/release-branch.go1.4
$ ./make.bash

Does this issue reproduce with the latest release (go1.8.1)?

No and Yes, because go1.8.1 doesn't need a C compiler, but annother Go compiler for bootstrapping.

System details

(after using a binary bootstrap blob for go1.4)

go version devel +45d42fdcea 2017-05-07 19:12:26 +0000 linux/amd64
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/user/go/"
GORACE=""
GOROOT="/opt/golang"
GOTOOLDIR="/opt/golang/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build337000857=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOROOT/bin/go version: go version devel +45d42fdcea 2017-05-07 19:12:26 +0000 linux/amd64
GOROOT/bin/go tool compile -V: compile version devel +45d42fdcea 2017-05-07 19:12:26 +0000 X:framepointer
uname -sr: Linux 4.9.0-2-amd64
Distributor ID:	Debian
Description:	Debian GNU/Linux 9.0 (stretch)
Release:	9.0
Codename:	stretch
/lib/x86_64-linux-gnu/libc.so.6: GNU C Library (Debian GLIBC 2.24-10) stable release version 2.24, by Roland McGrath et al.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions