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

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

Closed
jaccarmac opened this issue Oct 31, 2015 · 31 comments
Closed

Comments

@jaccarmac
Copy link

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
@bradfitz
Copy link
Contributor

/cc @ianlancetaylor

@davecheney
Copy link
Contributor

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.

@davecheney davecheney self-assigned this Oct 31, 2015
@jaccarmac
Copy link
Author

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.

@davecheney
Copy link
Contributor

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 notifications@github.com
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
#13114 (comment).

@jaccarmac
Copy link
Author

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

@jaccarmac
Copy link
Author

Same failure with unset GOROOT before the build.

@davecheney
Copy link
Contributor

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

@jaccarmac
Copy link
Author

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?

@davecheney
Copy link
Contributor

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 notifications@github.com 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.

@jaccarmac
Copy link
Author

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.

@jaccarmac
Copy link
Author

##### 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.

@davecheney
Copy link
Contributor

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

On 31 Oct 2015, at 18:04, Jacob MacDonald notifications@github.com 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.

@davecheney
Copy link
Contributor

Could you please include the command you invoked

On 31 Oct 2015, at 18:06, Jacob MacDonald notifications@github.com 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.

@jaccarmac
Copy link
Author

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

@davecheney
Copy link
Contributor

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 notifications@github.com 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.

@davecheney
Copy link
Contributor

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

On 31 Oct 2015, at 18:12, Jacob MacDonald notifications@github.com wrote:

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


Reply to this email directly or view it on GitHub.

@jaccarmac
Copy link
Author

apt-cache show gcc

Package: gcc
Priority: optional
Section: devel
Installed-Size: 44
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian GCC Maintainers <debian-gcc@lists.debian.org>
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 <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Matthias Klose <doko@debian.org>
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

@ianlancetaylor
Copy link
Contributor

What version of the Go toolchain are you building?

@ianlancetaylor
Copy link
Contributor

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.

@jaccarmac
Copy link
Author

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

@ianlancetaylor
Copy link
Contributor

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.

@gopherbot
Copy link

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

@jaccarmac
Copy link
Author

LGTM

@mwhudson
Copy link
Contributor

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?

@ianlancetaylor ianlancetaylor added this to the Go1.5.2 milestone Nov 16, 2015
@ianlancetaylor
Copy link
Contributor

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

@rsc rsc changed the title Building (all.bash) does not work on recent Ubuntu. cmd/link: fails on Ubuntu Xenial due to unsupported relocations on 386, amd64 Nov 16, 2015
@gopherbot
Copy link

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

ianlancetaylor added a commit that referenced this issue Nov 17, 2015
The GNU binutils recently picked up support for new 386/amd64
relocations.  Add support for them in the Go linker when doing an
internal link.

The 386 relocation R_386_GOT32X was proposed in
https://groups.google.com/forum/#!topic/ia32-abi/GbJJskkid4I .  It can
be treated as identical to the R_386_GOT32 relocation.

The amd64 relocations R_X86_64_GOTPCRELX and R_X86_64_REX_GOTPCRELX were
proposed in
https://groups.google.com/forum/#!topic/x86-64-abi/n9AWHogmVY0 .  They
can both be treated as identical to the R_X86_64_GOTPCREL relocation.

The purpose of the new relocations is to permit additional linker
relaxations in some cases.  We do not attempt to support those cases.

While we're at it, remove the unused and in some cases out of date
_COUNT names from ld/elf.go.

Fixes #13114.

Change-Id: I34ef07f6fcd00cdd2996038ecf46bb77a49e968b
Reviewed-on: https://go-review.googlesource.com/16529
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/16982
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
rminnich pushed a commit to riscvarchive/riscv-go that referenced this issue Jan 6, 2016
Merge the latest upstream Go master. The main reason for this merge is
to get https://go-review.googlesource.com/#/c/16529/, which is required
to build Go with a newer system toolchain. See
golang/go#13114.

The only RISC-V change is moving the register space after the new MIPS
space.

Change-Id: I1168bfea63366f99cc1241b19d15cdacdfb886bf
@ianlancetaylor
Copy link
Contributor

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.

@ianlancetaylor ianlancetaylor modified the milestones: Go1.4.4, Go1.5.2 Feb 18, 2016
@bsiegert
Copy link
Contributor

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?

@minux
Copy link
Member

minux commented Feb 21, 2016 via email

@ianlancetaylor
Copy link
Contributor

@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.

jsonn pushed a commit to jsonn/pkgsrc that referenced this issue Feb 21, 2016
Patch from Ryo Onodera in PR pkg/50777.

The upstream bug report is golang/go#13114.

Bump PKGREVISION.
@krytarowski
Copy link
Contributor

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

edolstra added a commit to NixOS/nixpkgs that referenced this issue Mar 7, 2016
The go linker barfed on the new relocation types emitted by binutils
2.26.

golang/go#13114
http://hydra.nixos.org/build/32554876
edolstra added a commit to NixOS/nixpkgs that referenced this issue Mar 11, 2016
The go linker barfed on the new relocation types emitted by binutils
2.26.

golang/go#13114
http://hydra.nixos.org/build/32554876
(cherry picked from commit ff69fc6)
madisongh added a commit to madisongh/meta-golang that referenced this issue Apr 13, 2016
ncopa added a commit to alpinelinux/aports that referenced this issue May 13, 2016
jwkohnen pushed a commit to jwkohnen/dkr-gopherbase that referenced this issue May 14, 2016
 * libcap-dev is needed for acmetool.
 * for cgo see golang/go#13114
arlolra pushed a commit to arlolra/tor-browser-bundle that referenced this issue Aug 13, 2016
It now requires an installation of go 1.4.x to bootstrap the build.

We set CGO_ENABLED=0 when building the bootstrap go compiler because go
1.4.3 won't build with a newer GNU toolchain:
golang/go#13114. It didn't cause a problem for
me on Ubuntu 14.04, but this will prevent it from breaking in the
future. We don't need cgo in the bootstrap compiler.

The other change is that the go build system no longer allows us to pass
a command with arguments for CC_FOR_TARGET. I opened a ticket for it:
golang/go#15457. We need -I and -L arguments
in the mac build so that gcc gan find its headers and libraries. So we
wrap up the arguments in a shell script and use the shell script as
CC_FOR_TARGET.
arlolra pushed a commit to arlolra/tor-browser-bundle that referenced this issue Aug 13, 2016
It now requires an installation of go 1.4.x to bootstrap the build.

We set CGO_ENABLED=0 when building the bootstrap go compiler because go
1.4.3 won't build with a newer GNU toolchain:
golang/go#13114. It didn't cause a problem for
me on Ubuntu 14.04, but this will prevent it from breaking in the
future. We don't need cgo in the bootstrap compiler.

The other change is that the go build system no longer allows us to pass
a command with arguments for CC_FOR_TARGET. I opened a ticket for it:
golang/go#15457. We need -I and -L arguments
in the mac build so that gcc gan find its headers and libraries. So we
wrap up the arguments in a shell script and use the shell script as
CC_FOR_TARGET.
@golang golang locked and limited conversation to collaborators Feb 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants