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/pprof: unknown relocation type 42 when compiling Go 1.4.3 #18156

Closed
choleraehyq opened this issue Dec 2, 2016 · 3 comments
Closed

cmd/pprof: unknown relocation type 42 when compiling Go 1.4.3 #18156

choleraehyq opened this issue Dec 2, 2016 · 3 comments

Comments

@choleraehyq
Copy link
Contributor

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

I want to build go 1.4.3 to bootstrap higher version go.

What operating system and processor architecture are you using (go env)?

I've tried on two computers.
The first one:

[cholerae@localhost src]$ lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                2
On-line CPU(s) list:   0,1
Thread(s) per core:    1
Core(s) per socket:    2
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 23
Model name:            Intel(R) Core(TM)2 Duo CPU     L9600  @ 2.13GHz
Stepping:              10
CPU MHz:               2134.000
CPU max MHz:           2134.0000
CPU min MHz:           800.0000
BogoMIPS:              4256.08
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              6144K
NUMA node0 CPU(s):     0,1
Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts nopl aperfmperf eagerfpu pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 xsave lahf_lm tpr_shadow vnmi flexpriority dtherm ida
[cholerae@localhost src]$ lsb_release -a
LSB Version:	:core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID:	Fedora
Description:	Fedora release 25 (Twenty Five)
Release:	25
Codename:	TwentyFive
[cholerae@localhost src]$ gcc --version
gcc (GCC) 6.2.1 20160916 (Red Hat 6.2.1-2)
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

The second one (Bash on Windows):

cholerae@Lenovo-PC:~/go/src$ sudo lshw -c cpu
  *-cpu
       product: Intel(R) Core(TM) i5-4200U CPU @ 1.60GHz
       vendor: Intel Corp.
       physical id: 1
       bus info: cpu@0
       capacity: 2301MHz
       width: 64 bits
       capabilities: fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp x86-64 pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave osxsave avx f16c rdrand cpufreq
cholerae@Lenovo-PC:~/go/src$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.1 LTS
Release:        16.04
Codename:       xenial
cholerae@Lenovo-PC:~/go/src$ gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

What did you do?

If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.

./all.bash

What did you expect to see?

Successfully compiled and all tests passed.

What did you see instead?

On the first computer (fedora 25):

# 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
/home/cholerae/Downloads/go/src/cmd/6c/txt.c: In function 'gmove':
/home/cholerae/Downloads/go/src/cmd/6c/txt.c:995:28: warning: left shift of negative value [-Wshift-negative-value]
     f->vconst |= (vlong)~0 << 32;
                            ^~
/home/cholerae/Downloads/go/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
sync
io
unicode/utf8
math
bytes
bufio
syscall
strconv
time
reflect
os
strings
fmt
encoding/binary
sort
regexp/syntax
cmd/internal/goobj
cmd/internal/rsc.io/arm/armasm
cmd/internal/rsc.io/x86/x86asm
debug/dwarf
debug/elf
debug/gosym
debug/macho
debug/pe
debug/plan9obj
regexp
text/tabwriter
flag
log
cmd/internal/objfile
hash
crypto
crypto/md5
go/token
path/filepath
go/scanner
cmd/addr2line
go/ast
io/ioutil
go/parser
go/printer
os/exec
path
container/heap
encoding
encoding/base64
unicode/utf16
encoding/json
cmd/cgo
go/format
cmd/fix
encoding/xml
net/url
text/template/parse
compress/flate
hash/crc32
compress/gzip
text/template
container/list
crypto/subtle
crypto/cipher
crypto/aes
crypto/des
math/rand
go/doc
math/big
go/build
crypto/elliptic
encoding/asn1
crypto/hmac
internal/syscall
crypto/rand
crypto/ecdsa
crypto/rc4
crypto/rsa
crypto/sha1
crypto/sha256
crypto/dsa
crypto/sha512
crypto/x509/pkix
encoding/hex
encoding/pem
runtime/cgo
mime
net/http/internal
os/signal
runtime/pprof
cmd/gofmt
net
cmd/nm
cmd/objdump
crypto/x509
net/textproto
mime/multipart
crypto/tls
cmd/pack
cmd/pprof/internal/profile
net/http
cmd/pprof/internal/plugin
html
html/template
cmd/pprof/internal/report
cmd/go
cmd/pprof/internal/svg
cmd/pprof/internal/tempfile
cmd/pprof/internal/commands
cmd/pprof/internal/driver
cmd/pprof/internal/fetch
cmd/pprof/internal/symbolizer
cmd/pprof/internal/symbolz
cmd/pprof
# cmd/pprof
/home/cholerae/Downloads/go/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/cholerae/Downloads/go/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
cmd/yacc
# cmd/go
/home/cholerae/Downloads/go/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/cholerae/Downloads/go/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
archive/tar
archive/zip
compress/bzip2
compress/lzw
hash/adler32
container/ring
database/sql/driver
compress/zlib
database/sql
encoding/ascii85
encoding/base32
encoding/csv
encoding/gob
expvar
hash/crc64
hash/fnv
image/color
image
image/color/palette
image/draw
image/jpeg
image/gif
image/png
index/suffixarray
log/syslog
math/cmplx
net/http/cgi
net/http/cookiejar
net/http/httptest
net/http/fcgi
net/http/httputil
net/http/pprof
net/mail
net/rpc
net/smtp
net/rpc/jsonrpc
os/user
runtime/debug
runtime/race
testing
testing/iotest
testing/quick
text/scanner

On the second computer (Bash on Windows):

# 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
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
sync
container/heap
encoding
io
syscall
unicode/utf16
bytes
strings
bufio
text/tabwriter
hash
path
time
hash/crc32
container/list
crypto/subtle
internal/syscall
crypto/cipher
crypto/hmac
html
compress/bzip2
os
strconv
math/rand
hash/adler32
container/ring
hash/crc64
path/filepath
os/signal
reflect
regexp/syntax
crypto
io/ioutil
crypto/md5
os/exec
encoding/base64
net/url
regexp
crypto/aes
fmt
encoding/binary
crypto/rc4
crypto/des
crypto/sha1
crypto/sha256
crypto/sha512
encoding/pem
cmd/internal/goobj
cmd/internal/rsc.io/arm/armasm
cmd/internal/rsc.io/x86/x86asm
debug/dwarf
debug/gosym
debug/plan9obj
debug/elf
debug/macho
debug/pe
flag
log
go/token
cmd/internal/objfile
encoding/json
encoding/xml
go/scanner
go/ast
cmd/addr2line
text/template/parse
compress/flate
go/parser
go/printer
text/template
compress/gzip
math/big
cmd/cgo
go/format
cmd/fix
go/doc
crypto/elliptic
go/build
encoding/asn1
crypto/rand
crypto/ecdsa
crypto/rsa
crypto/dsa
crypto/x509/pkix
encoding/hex
mime
net/http/internal
runtime/pprof
cmd/nm
cmd/objdump
cmd/gofmt
runtime/cgo
cmd/pack
cmd/pprof/internal/profile
html/template
cmd/pprof/internal/svg
cmd/pprof/internal/plugin
cmd/pprof/internal/tempfile
cmd/pprof/internal/symbolz
cmd/pprof/internal/report
cmd/pprof/internal/symbolizer
cmd/yacc
archive/tar
cmd/pprof/internal/commands
archive/zip
cmd/pprof/internal/driver
compress/lzw
compress/zlib
database/sql/driver
encoding/ascii85
encoding/base32
database/sql
encoding/csv
encoding/gob
hash/fnv
image/color
index/suffixarray
image
image/color/palette
net
math/cmplx
image/draw
image/jpeg
image/png
image/gif
os/user
runtime/debug
runtime/race
testing
testing/iotest
testing/quick
text/scanner
crypto/x509
net/textproto
log/syslog
mime/multipart
net/mail
crypto/tls
net/http
net/smtp
cmd/go
cmd/pprof/internal/fetch
expvar
net/http/cgi
net/http/cookiejar
cmd/pprof
net/http/fcgi
net/http/httptest
net/http/httputil
net/http/pprof
net/rpc
net/rpc/jsonrpc
# cmd/pprof
/home/cholerae/go/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/cholerae/go/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
# cmd/go
/home/cholerae/go/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/cholerae/go/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
@ianlancetaylor
Copy link
Contributor

Set CGO_ENABLED=0 in the environment when building Go 1.4. That will work around this problem.

@minux
Copy link
Member

minux commented Dec 2, 2016 via email

@bradfitz
Copy link
Contributor

bradfitz commented Dec 2, 2016

@golang golang locked and limited conversation to collaborators Dec 2, 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

5 participants