Go: cmd/link: fails on Ubuntu Xenial due to unsupported relocations on 386, amd64

Created on 31 Oct 2015  Â·  31Comments  Â·  Source: golang/go

I am on the devel (xenial) channel now, but the error started popping up before the 15.10 release. Standard Linux AMD64 build. Building from master with the most recent binary release (1.5.1) as GOROOT_BOOTSTRAP.

git reset --hard origin/master
git clean -fxd
GOROOT_BOOTSTRAP=$HOME/tmp/go ./all.bash
...
many lines of successful build steps
...
# cmd/trace
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
# cmd/pprof
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
# cmd/go
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
FrozenDueToAge

Most helpful comment

@bsiegert and anybody else reading this issue: what @minux is saying is: arrange to build lang/go14 with CGO_ENABLED=0 set in the environment. Then you won't run into this bug.

Yes, if we do have to make a 1.4.4 release, we should include this fix. But this by itself does not seem to me like a sufficient reason to make 1.4.4 release.

All 31 comments

/cc @ianlancetaylor

I'll take this one, Ubuntu is partly my fault.

@jaccarmac can you please include _complete_ instructions to reproduce your setup so I can build a replica environment. Can you also include the complete output you receive along the way.

My sources.list:

deb http://us.archive.ubuntu.com/ubuntu/ devel main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu devel-security main restricted universe multiverse
deb http://us.archive.ubuntu.com/ubuntu/ devel-updates main restricted universe multiverse
deb http://us.archive.ubuntu.com/ubuntu/ devel-backports main restricted universe multiverse
deb http://archive.canonical.com/ubuntu devel partner

Unix piping isn't working for the build output, so I'll add it when I figure that out.

Thanks. Can you also check that golang-go is not installed and that
GOROOT is not set.

On Sat, Oct 31, 2015 at 4:02 PM, Jacob MacDonald [email protected]
wrote:

My sources.list:

deb http://us.archive.ubuntu.com/ubuntu/ devel main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu devel-security main restricted universe multiverse
deb http://us.archive.ubuntu.com/ubuntu/ devel-updates main restricted universe multiverse
deb http://us.archive.ubuntu.com/ubuntu/ devel-backports main restricted universe multiverse
deb http://archive.canonical.com/ubuntu devel partner

Unix piping isn't working for the build output, so I'll add it when I
figure that out.

—
Reply to this email directly or view it on GitHub
https://github.com/golang/go/issues/13114#issuecomment-152696145.

golang-go is definitely not installed. GOROOT may be the problem. Let me check.

Same failure with unset GOROOT before the build.

If you're using linux, or actually anything that isn't windows, you should never set GOROOT.

It's my understanding that if you install the tools in a non-standard place you have to set it. Is that not the case any more?

That is correct, but my recommendation is to not do that.

If you use the tarball from the website, installed to the recommended location, you don't need to set GOROOT.

If you build from source, then the correct value will be burnt in at compile time.

If you build from source, but want to have the files in a different final location, then set GOROOT_FINAL and move the contents afterwards.

Don't set GOROOT, it leads to problems 99 times out of 100.

On 31 Oct 2015, at 17:39, Jacob MacDonald [email protected] wrote:

It's my understanding that if you install the tools in a non-standard place you have to set it. Is that not the case any more?

—
Reply to this email directly or view it on GitHub.

Thanks! Last time I was building from source the value didn't get baked in and needed to be set if the path was outside /usr/local. In any case, even with the variable permanently unset the issue continues.

##### Building Go bootstrap tool.
cmd/dist

##### Building Go toolchain using /home/jaccarmac/tmp/go.
bootstrap/compile/internal/big
bootstrap/internal/gcprog
bootstrap/internal/obj
bootstrap/asm/internal/flags
bootstrap/internal/obj/arm
bootstrap/internal/obj/arm64
bootstrap/internal/obj/ppc64
bootstrap/internal/obj/x86
bootstrap/link/internal/ld
bootstrap/asm/internal/lex
bootstrap/compile/internal/gc
bootstrap/asm/internal/arch
bootstrap/asm/internal/asm
bootstrap/asm
bootstrap/link/internal/amd64
bootstrap/link/internal/arm
bootstrap/link/internal/arm64
bootstrap/link/internal/ppc64
bootstrap/link/internal/x86
bootstrap/link
bootstrap/compile/internal/amd64
bootstrap/compile/internal/arm
bootstrap/compile/internal/arm64
bootstrap/compile/internal/ppc64
bootstrap/compile/internal/x86
bootstrap/compile

##### Building go_bootstrap for host, linux/amd64.
runtime
unicode/utf16
encoding
errors
sort
sync/atomic
unicode/utf8
unicode
math
sync
container/heap
syscall
internal/singleflight
io
hash
strings
bytes
strconv
bufio
path
internal/syscall/windows
internal/syscall/windows/registry
time
regexp/syntax
reflect
encoding/base64
crypto
crypto/sha1
os
regexp
path/filepath
os/signal
fmt
encoding/binary
os/exec
io/ioutil
debug/dwarf
go/token
net/url
text/template/parse
log
encoding/json
flag
go/scanner
go/ast
debug/elf
text/template
go/parser
go/doc
go/build
cmd/go

##### Building packages and commands for linux/amd64.
runtime
errors
unicode
sync/atomic
unicode/utf8
math
sort
container/list
container/ring
crypto/subtle
encoding
unicode/utf16
image/color
runtime/race
cmd/vet/whitelist
container/heap
sync
image/color/palette
io
syscall
internal/singleflight
hash
runtime/trace
crypto/cipher
hash/crc32
hash/adler32
crypto/hmac
bytes
strings
hash/crc64
hash/fnv
bufio
text/tabwriter
strconv
math/rand
math/cmplx
path
html
time
internal/syscall/unix
compress/bzip2
reflect
regexp/syntax
crypto/aes
crypto/rc4
crypto
encoding/base64
encoding/ascii85
crypto/sha512
crypto/md5
crypto/sha1
crypto/sha256
encoding/pem
encoding/base32
image
os
regexp
image/internal/imageutil
image/draw
image/jpeg
path/filepath
os/signal
runtime/debug
encoding/binary
fmt
cmd/pprof/internal/svg
io/ioutil
os/exec
crypto/des
index/suffixarray
flag
log
debug/dwarf
debug/gosym
debug/plan9obj
cmd/vendor/golang.org/x/arch/arm/armasm
cmd/vendor/golang.org/x/arch/x86/x86asm
archive/tar
compress/flate
compress/lzw
cmd/internal/obj
math/big
encoding/hex
go/token
archive/zip
compress/gzip
compress/zlib
go/scanner
database/sql/driver
encoding/csv
debug/elf
debug/macho
debug/pe
go/ast
database/sql
encoding/gob
cmd/internal/goobj
encoding/json
encoding/xml
vendor/golang.org/x/net/http2/hpack
crypto/dsa
crypto/elliptic
encoding/asn1
crypto/rand
cmd/internal/objfile
go/parser
crypto/rsa
go/printer
crypto/ecdsa
crypto/x509/pkix
mime
cmd/addr2line
mime/quotedprintable
net/http/internal
net/url
text/template/parse
go/constant
text/scanner
image/gif
image/png
runtime/pprof
internal/trace
go/types
net/internal/socktest
cmd/cgo
go/format
testing
testing/iotest
testing/quick
cmd/internal/obj/arm
cmd/internal/obj/arm64
text/template
cmd/internal/obj/ppc64
internal/testenv
cmd/internal/obj/x86
cmd/asm/internal/flags
cmd/compile/internal/big
cmd/asm/internal/lex
go/doc
html/template
cmd/internal/gcprog
cmd/dist
cmd/fix
go/build
cmd/asm/internal/arch
cmd/compile/internal/gc
cmd/asm/internal/asm
cmd/gofmt
cmd/cover
go/internal/gccgoimporter
go/internal/gcimporter
cmd/api
runtime/cgo
go/importer
cmd/asm
cmd/doc
cmd/internal/obj/mips
cmd/link/internal/ld
net
os/user
cmd/newlink
cmd/nm
cmd/objdump
cmd/pack
cmd/pprof/internal/profile
cmd/pprof/internal/tempfile
cmd/vet
cmd/pprof/internal/plugin
cmd/pprof/internal/symbolz
cmd/pprof/internal/report
cmd/link/internal/amd64
cmd/link/internal/arm
cmd/link/internal/arm64
cmd/link/internal/ppc64
cmd/link/internal/x86
cmd/pprof/internal/symbolizer
cmd/yacc
cmd/link
crypto/x509
net/textproto
log/syslog
cmd/pprof/internal/commands
cmd/pprof/internal/driver
mime/multipart
net/mail
crypto/tls
net/http
net/smtp
cmd/compile/internal/amd64
cmd/compile/internal/arm
cmd/compile/internal/ppc64
cmd/compile/internal/arm64
cmd/compile/internal/x86
cmd/compile/internal/mips64
cmd/compile
expvar
net/http/cgi
net/http/cookiejar
net/http/httptest
net/http/httputil
net/http/pprof
net/rpc
cmd/go
cmd/pprof/internal/fetch
cmd/trace
net/http/fcgi
cmd/pprof
net/rpc/jsonrpc
# cmd/trace
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
# cmd/pprof
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
# cmd/go
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298

There's the full build log.

Thank you for confirming. Can you please attach the full output of your build attempt.

On 31 Oct 2015, at 18:04, Jacob MacDonald [email protected] wrote:

Thanks! Last time I was building from source the value didn't get baked in and needed to be set if the path was outside /usr/local. In any case, even with the variable permanently unset the issue continues.

—
Reply to this email directly or view it on GitHub.

Could you please include the command you invoked

On 31 Oct 2015, at 18:06, Jacob MacDonald [email protected] wrote:

Building Go bootstrap tool.

cmd/dist

Building Go toolchain using /home/jaccarmac/tmp/go.

bootstrap/compile/internal/big
bootstrap/internal/gcprog
bootstrap/internal/obj
bootstrap/asm/internal/flags
bootstrap/internal/obj/arm
bootstrap/internal/obj/arm64
bootstrap/internal/obj/ppc64
bootstrap/internal/obj/x86
bootstrap/link/internal/ld
bootstrap/asm/internal/lex
bootstrap/compile/internal/gc
bootstrap/asm/internal/arch
bootstrap/asm/internal/asm
bootstrap/asm
bootstrap/link/internal/amd64
bootstrap/link/internal/arm
bootstrap/link/internal/arm64
bootstrap/link/internal/ppc64
bootstrap/link/internal/x86
bootstrap/link
bootstrap/compile/internal/amd64
bootstrap/compile/internal/arm
bootstrap/compile/internal/arm64
bootstrap/compile/internal/ppc64
bootstrap/compile/internal/x86
bootstrap/compile

Building go_bootstrap for host, linux/amd64.

runtime
unicode/utf16
encoding
errors
sort
sync/atomic
unicode/utf8
unicode
math
sync
container/heap
syscall
internal/singleflight
io
hash
strings
bytes
strconv
bufio
path
internal/syscall/windows
internal/syscall/windows/registry
time
regexp/syntax
reflect
encoding/base64
crypto
crypto/sha1
os
regexp
path/filepath
os/signal
fmt
encoding/binary
os/exec
io/ioutil
debug/dwarf
go/token
net/url
text/template/parse
log
encoding/json
flag
go/scanner
go/ast
debug/elf
text/template
go/parser
go/doc
go/build
cmd/go

Building packages and commands for linux/amd64.

runtime
errors
unicode
sync/atomic
unicode/utf8
math
sort
container/list
container/ring
crypto/subtle
encoding
unicode/utf16
image/color
runtime/race
cmd/vet/whitelist
container/heap
sync
image/color/palette
io
syscall
internal/singleflight
hash
runtime/trace
crypto/cipher
hash/crc32
hash/adler32
crypto/hmac
bytes
strings
hash/crc64
hash/fnv
bufio
text/tabwriter
strconv
math/rand
math/cmplx
path
html
time
internal/syscall/unix
compress/bzip2
reflect
regexp/syntax
crypto/aes
crypto/rc4
crypto
encoding/base64
encoding/ascii85
crypto/sha512
crypto/md5
crypto/sha1
crypto/sha256
encoding/pem
encoding/base32
image
os
regexp
image/internal/imageutil
image/draw
image/jpeg
path/filepath
os/signal
runtime/debug
encoding/binary
fmt
cmd/pprof/internal/svg
io/ioutil
os/exec
crypto/des
index/suffixarray
flag
log
debug/dwarf
debug/gosym
debug/plan9obj
cmd/vendor/golang.org/x/arch/arm/armasm
cmd/vendor/golang.org/x/arch/x86/x86asm
archive/tar
compress/flate
compress/lzw
cmd/internal/obj
math/big
encoding/hex
go/token
archive/zip
compress/gzip
compress/zlib
go/scanner
database/sql/driver
encoding/csv
debug/elf
debug/macho
debug/pe
go/ast
database/sql
encoding/gob
cmd/internal/goobj
encoding/json
encoding/xml
vendor/golang.org/x/net/http2/hpack
crypto/dsa
crypto/elliptic
encoding/asn1
crypto/rand
cmd/internal/objfile
go/parser
crypto/rsa
go/printer
crypto/ecdsa
crypto/x509/pkix
mime
cmd/addr2line
mime/quotedprintable
net/http/internal
net/url
text/template/parse
go/constant
text/scanner
image/gif
image/png
runtime/pprof
internal/trace
go/types
net/internal/socktest
cmd/cgo
go/format
testing
testing/iotest
testing/quick
cmd/internal/obj/arm
cmd/internal/obj/arm64
text/template
cmd/internal/obj/ppc64
internal/testenv
cmd/internal/obj/x86
cmd/asm/internal/flags
cmd/compile/internal/big
cmd/asm/internal/lex
go/doc
html/template
cmd/internal/gcprog
cmd/dist
cmd/fix
go/build
cmd/asm/internal/arch
cmd/compile/internal/gc
cmd/asm/internal/asm
cmd/gofmt
cmd/cover
go/internal/gccgoimporter
go/internal/gcimporter
cmd/api
runtime/cgo
go/importer
cmd/asm
cmd/doc
cmd/internal/obj/mips
cmd/link/internal/ld
net
os/user
cmd/newlink
cmd/nm
cmd/objdump
cmd/pack
cmd/pprof/internal/profile
cmd/pprof/internal/tempfile
cmd/vet
cmd/pprof/internal/plugin
cmd/pprof/internal/symbolz
cmd/pprof/internal/report
cmd/link/internal/amd64
cmd/link/internal/arm
cmd/link/internal/arm64
cmd/link/internal/ppc64
cmd/link/internal/x86
cmd/pprof/internal/symbolizer
cmd/yacc
cmd/link
crypto/x509
net/textproto
log/syslog
cmd/pprof/internal/commands
cmd/pprof/internal/driver
mime/multipart
net/mail
crypto/tls
net/http
net/smtp
cmd/compile/internal/amd64
cmd/compile/internal/arm
cmd/compile/internal/ppc64
cmd/compile/internal/arm64
cmd/compile/internal/x86
cmd/compile/internal/mips64
cmd/compile
expvar
net/http/cgi
net/http/cookiejar
net/http/httptest
net/http/httputil
net/http/pprof
net/rpc
cmd/go
cmd/pprof/internal/fetch
cmd/trace
net/http/fcgi
cmd/pprof
net/rpc/jsonrpc

cmd/trace

/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298

cmd/pprof

/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298

cmd/go

/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
There's the full build log.

—
Reply to this email directly or view it on GitHub.

GOROOT_BOOTSTRAP=$HOME/tmp/go ./all.bash

What version of ld or binutils do you have ? While go does not require a c compiler, cgo does, and will be expected by default on Intel platforms. What c compiler do you have installed?

On 31 Oct 2015, at 18:06, Jacob MacDonald [email protected] wrote:

Building Go bootstrap tool.

cmd/dist

Building Go toolchain using /home/jaccarmac/tmp/go.

bootstrap/compile/internal/big
bootstrap/internal/gcprog
bootstrap/internal/obj
bootstrap/asm/internal/flags
bootstrap/internal/obj/arm
bootstrap/internal/obj/arm64
bootstrap/internal/obj/ppc64
bootstrap/internal/obj/x86
bootstrap/link/internal/ld
bootstrap/asm/internal/lex
bootstrap/compile/internal/gc
bootstrap/asm/internal/arch
bootstrap/asm/internal/asm
bootstrap/asm
bootstrap/link/internal/amd64
bootstrap/link/internal/arm
bootstrap/link/internal/arm64
bootstrap/link/internal/ppc64
bootstrap/link/internal/x86
bootstrap/link
bootstrap/compile/internal/amd64
bootstrap/compile/internal/arm
bootstrap/compile/internal/arm64
bootstrap/compile/internal/ppc64
bootstrap/compile/internal/x86
bootstrap/compile

Building go_bootstrap for host, linux/amd64.

runtime
unicode/utf16
encoding
errors
sort
sync/atomic
unicode/utf8
unicode
math
sync
container/heap
syscall
internal/singleflight
io
hash
strings
bytes
strconv
bufio
path
internal/syscall/windows
internal/syscall/windows/registry
time
regexp/syntax
reflect
encoding/base64
crypto
crypto/sha1
os
regexp
path/filepath
os/signal
fmt
encoding/binary
os/exec
io/ioutil
debug/dwarf
go/token
net/url
text/template/parse
log
encoding/json
flag
go/scanner
go/ast
debug/elf
text/template
go/parser
go/doc
go/build
cmd/go

Building packages and commands for linux/amd64.

runtime
errors
unicode
sync/atomic
unicode/utf8
math
sort
container/list
container/ring
crypto/subtle
encoding
unicode/utf16
image/color
runtime/race
cmd/vet/whitelist
container/heap
sync
image/color/palette
io
syscall
internal/singleflight
hash
runtime/trace
crypto/cipher
hash/crc32
hash/adler32
crypto/hmac
bytes
strings
hash/crc64
hash/fnv
bufio
text/tabwriter
strconv
math/rand
math/cmplx
path
html
time
internal/syscall/unix
compress/bzip2
reflect
regexp/syntax
crypto/aes
crypto/rc4
crypto
encoding/base64
encoding/ascii85
crypto/sha512
crypto/md5
crypto/sha1
crypto/sha256
encoding/pem
encoding/base32
image
os
regexp
image/internal/imageutil
image/draw
image/jpeg
path/filepath
os/signal
runtime/debug
encoding/binary
fmt
cmd/pprof/internal/svg
io/ioutil
os/exec
crypto/des
index/suffixarray
flag
log
debug/dwarf
debug/gosym
debug/plan9obj
cmd/vendor/golang.org/x/arch/arm/armasm
cmd/vendor/golang.org/x/arch/x86/x86asm
archive/tar
compress/flate
compress/lzw
cmd/internal/obj
math/big
encoding/hex
go/token
archive/zip
compress/gzip
compress/zlib
go/scanner
database/sql/driver
encoding/csv
debug/elf
debug/macho
debug/pe
go/ast
database/sql
encoding/gob
cmd/internal/goobj
encoding/json
encoding/xml
vendor/golang.org/x/net/http2/hpack
crypto/dsa
crypto/elliptic
encoding/asn1
crypto/rand
cmd/internal/objfile
go/parser
crypto/rsa
go/printer
crypto/ecdsa
crypto/x509/pkix
mime
cmd/addr2line
mime/quotedprintable
net/http/internal
net/url
text/template/parse
go/constant
text/scanner
image/gif
image/png
runtime/pprof
internal/trace
go/types
net/internal/socktest
cmd/cgo
go/format
testing
testing/iotest
testing/quick
cmd/internal/obj/arm
cmd/internal/obj/arm64
text/template
cmd/internal/obj/ppc64
internal/testenv
cmd/internal/obj/x86
cmd/asm/internal/flags
cmd/compile/internal/big
cmd/asm/internal/lex
go/doc
html/template
cmd/internal/gcprog
cmd/dist
cmd/fix
go/build
cmd/asm/internal/arch
cmd/compile/internal/gc
cmd/asm/internal/asm
cmd/gofmt
cmd/cover
go/internal/gccgoimporter
go/internal/gcimporter
cmd/api
runtime/cgo
go/importer
cmd/asm
cmd/doc
cmd/internal/obj/mips
cmd/link/internal/ld
net
os/user
cmd/newlink
cmd/nm
cmd/objdump
cmd/pack
cmd/pprof/internal/profile
cmd/pprof/internal/tempfile
cmd/vet
cmd/pprof/internal/plugin
cmd/pprof/internal/symbolz
cmd/pprof/internal/report
cmd/link/internal/amd64
cmd/link/internal/arm
cmd/link/internal/arm64
cmd/link/internal/ppc64
cmd/link/internal/x86
cmd/pprof/internal/symbolizer
cmd/yacc
cmd/link
crypto/x509
net/textproto
log/syslog
cmd/pprof/internal/commands
cmd/pprof/internal/driver
mime/multipart
net/mail
crypto/tls
net/http
net/smtp
cmd/compile/internal/amd64
cmd/compile/internal/arm
cmd/compile/internal/ppc64
cmd/compile/internal/arm64
cmd/compile/internal/x86
cmd/compile/internal/mips64
cmd/compile
expvar
net/http/cgi
net/http/cookiejar
net/http/httptest
net/http/httputil
net/http/pprof
net/rpc
cmd/go
cmd/pprof/internal/fetch
cmd/trace
net/http/fcgi
cmd/pprof
net/rpc/jsonrpc

cmd/trace

/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298

cmd/pprof

/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298

cmd/go

/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
There's the full build log.

—
Reply to this email directly or view it on GitHub.

What is in /tmp/go ? Is it go 1.4 ?

On 31 Oct 2015, at 18:12, Jacob MacDonald [email protected] wrote:

GOROOT_BOOTSTRAP=$HOME/tmp/go ./all.bash

—
Reply to this email directly or view it on GitHub.

apt-cache show gcc

Package: gcc
Priority: optional
Section: devel
Installed-Size: 44
Maintainer: Ubuntu Developers <[email protected]>
Original-Maintainer: Debian GCC Maintainers <[email protected]>
Architecture: amd64
Source: gcc-defaults (1.144ubuntu1)
Version: 4:5.2.1-3ubuntu1
Provides: c-compiler
Depends: cpp (>= 4:5.2.1-3ubuntu1), gcc-5 (>= 5.2.1-12~)
Recommends: libc6-dev | libc-dev
Suggests: gcc-multilib, make, manpages-dev, autoconf, automake, libtool, flex, bison, gdb, gcc-doc
Conflicts: gcc-doc (<< 1:2.95.3)
Filename: pool/main/g/gcc-defaults/gcc_5.2.1-3ubuntu1_amd64.deb
Size: 5204
MD5sum: 07616aaeba70d42323488c76f45e15b4
SHA1: ca0737dd94fe0b24e78a26a47fba7ca6208fd890
SHA256: 84dbe4d6d8edb8f8aaa79b2ae8785c47a8cc1943a5eaf51e1313b20b81aed77c
Description-en: GNU C compiler
 This is the GNU C compiler, a fairly portable optimizing compiler for C.
 .
 This is a dependency package providing the default GNU C compiler.
Description-md5: c7efd71c7c651a9ac8b2adf36b137790
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Build-Essential: yes
Origin: Ubuntu
Supported: 9m
Task: ubuntu-desktop, ubuntu-usb, edubuntu-desktop, edubuntu-usb, xubuntu-core, xubuntu-desktop, mythbuntu-frontend, mythbuntu-desktop, mythbuntu-backend-slave, mythbuntu-backend-master, ubuntustudio-desktop, ubuntustudio-desktop-minimal, ubuntu-gnome-desktop, ubuntukylin-desktop

apt-cache show binutils

Package: binutils
Priority: optional
Section: devel
Installed-Size: 13312
Maintainer: Ubuntu Core developers <[email protected]>
Original-Maintainer: Matthias Klose <[email protected]>
Architecture: amd64
Version: 2.25.51.20151028-0ubuntu1
Replaces: binutils-gold (<< 2.20.51.20100415), binutils-mingw-w64-i686 (<< 2.23.52.20130612-1+3), binutils-mingw-w64-x86-64 (<< 2.23.52.20130612-1+3)
Provides: binutils-gold, elf-binutils
Depends: libc6 (>= 2.14), zlib1g (>= 1:1.2.0)
Suggests: binutils-doc (>= 2.25.51.20151028-0ubuntu1)
Conflicts: binutils-gold (<< 2.20.51.20100415), binutils-mingw-w64-i686 (<< 2.23.52.20130612-1+3), binutils-mingw-w64-x86-64 (<< 2.23.52.20130612-1+3), elf-binutils, gas, modutils (<< 2.4.19-1)
Breaks: binutils-mingw-w64-i686 (<< 2.23.52.20130612-1+3), binutils-mingw-w64-x86-64 (<< 2.23.52.20130612-1+3)
Filename: pool/main/b/binutils/binutils_2.25.51.20151028-0ubuntu1_amd64.deb
Size: 2312542
MD5sum: 0cf90ad95fc9a119ed722ef331dedbfe
SHA1: 5827f0d4abdc2fd4f8e863ac9c69cbcdfc7a7a54
SHA256: 09e44eea970015f9a07ae6c6612d55cd7acef1f227feb0e9ed1d1fdda5ff21b5
Description-en: GNU assembler, linker and binary utilities
 The programs in this package are used to assemble, link and manipulate
 binary and object files.  They may be used in conjunction with a compiler
 and various libraries to build programs.
Description-md5: fde49b4cfeaad346a6e094f973da28d7
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Build-Essential: yes
Origin: Ubuntu
Supported: 9m
Task: ubuntu-desktop, ubuntu-usb, kubuntu-desktop, kubuntu-full, edubuntu-desktop, edubuntu-usb, xubuntu-core, xubuntu-desktop, mythbuntu-frontend, mythbuntu-desktop, mythbuntu-backend-slave, mythbuntu-backend-master, mythbuntu-backend-master, lubuntu-live, ubuntustudio-desktop, ubuntustudio-desktop-minimal, ubuntu-gnome-desktop, ubuntukylin-desktop, ubuntu-mate-core

What version of the Go toolchain are you building?

Do you have CGO_ENABLED=0 set in the environment? I think this error can only happen when using internal linking.

Do you have CC set in the environment? The relocation number 42 is not defined for x86_64, and it is implausible that it would be found in an x86_64 GNU/Linux ELF file (the 298 is just 42 + 256 and has to do with the Go linker's internal representation). It would be normal to find it in an ARM or PPC64 ELF file.

The incorrect file is in the archive /home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a. Run ar x /home/jaccarmac/local/golang/pkg/linux_amd64/runtime/cgo.a _all.o. Attach that file to the issue.

CGO_ENABLED is not set.

GOROOT=$HOME/tmp/go $HOME/tmp/go/bin/go version

go version go1.5.1 linux/amd64

CC is not set.

I can't upload _all.o directly. https://drive.google.com/file/d/0B_S86gZvPJWKSjVKR1dMVlJxNTA/view?usp=sharing

Thanks. I see that spoke too quickly. Relocation 42 was added last week: https://sourceware.org/ml/binutils/2015-10/msg00186.html . You must be using a very up to date toolchain.

I think the Go build is using internal linking because the only external objects are from the runtime/cgo package.

It would be helpful if you could see whether this change fixes the problem: https://golang.org/cl/16529 . Thanks.

CL https://golang.org/cl/16529 mentions this issue.

LGTM

This is needed for Go to build from source with a new toolchain (i.e. the current devel version of Ubuntu). Does that make it a candidate for 1.5.2?

I think so, and the patch is small. Added to 1.5.2 milestone.

CL https://golang.org/cl/16982 mentions this issue.

I'm marking this issue as 1.4.4, because it breaks building Go 1.4.3 with CGO_ENABLED=1. If we ever do a 1.4.4 release, we should include the fix for this issue.

In pkgsrc, we keep Go 1.4 around as lang/go14, so that you have a version to bootstrap from.

It turns out that Go 1.4.3 does not compile any more on NetBSD-current, see above. @ryoon has provided a patch in https://gnats.netbsd.org/50777. Should I send this as a CL?

If we just need to keep Go 1.4 available as bootstrap compiler for newer
versions,
we can just support CGO_ENABLED=0 build of Go 1.4.

@bsiegert and anybody else reading this issue: what @minux is saying is: arrange to build lang/go14 with CGO_ENABLED=0 set in the environment. Then you won't run into this bug.

Yes, if we do have to make a 1.4.4 release, we should include this fix. But this by itself does not seem to me like a sufficient reason to make 1.4.4 release.

Thanks for fixing it in pkgsrc, several people were investigating NetBSD-current breakage simultaneously.

Was this page helpful?
0 / 5 - 0 ratings