-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
runtime/cgo: unrecognized relocation with binaries shipped in go1.12.2 #31293
Comments
The relocation appears in runtime/cgo for C code that refers to global variables. The 1.12.2 binary distribution must have been built with a newer version of GCC than the 1.12.1 binary distribution. The only reasonable fix is to build it with an older version of GCC. I'm not sure whether we should do anything about this. As a general rule, if you want the binary distribution to run on release N, you need to build it on release N, not a later release. This is one example of that, but there are many others. I don't remember whether we've ever documented anything about what systems the binary distributions run on. |
We updated our linux-amd64 builder image from Debian Jessie to Stretch. That's surely the cause. We obviously didn't consider that it'd have any effect on release binaries. We also don't version our builder images and our release automation doesn't use different builders as a function of branch either. Maybe it should. We never thought about it. |
Actually we do version our builder images a bit at a broad level. But we do update a number of them "in-place" without changing their names and we definitely don't select release builders as a function of branch. |
just to note this is also the case for the |
Whoah, all our Travis builds blew up: |
For Travis CI errors, if you're willing to upgrade to Ubuntu 16.04, you can do so by changing |
This was reported again on #31336. We may need to plan to fix this. |
Migrate to xenial to workaround golang/go#31293
Change https://golang.org/cl/171121 mentions this issue: |
Drop linux-amd64-stretch (which is redundant with linux-amd64, which is now Stretch since CL 170282) and add linux-amd64-jessie, and use Jessie in cmd/release for Linux releases) Updates golang/go#31293 Change-Id: I21b7a43a24385d5976296d0e5f1c6009cbc18b05 Reviewed-on: https://go-review.googlesource.com/c/build/+/171121 Reviewed-by: Andrew Bonventre <andybons@golang.org>
@gopherbot please backport to 1.11 and 1.12; the fix doesn't need to be cherry-picked, but it will be used to track the issue in the milestone. |
Backport issue(s) opened: #31346 (for 1.11), #31347 (for 1.12). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases. |
1.12.3 and 1.11.8 have been built using Jessie and released. This should resolve the issue. Please let us know if there are any other problems and sorry for the trouble. Thanks. |
FWIW, this particular issue can be mitigated by passing "-Wa,-mrelax-relocations=no" when compiling. But if you do that, unless you set CGO_FLAGS to this every time you build, the new (ish) code in the go tool considers the distributed runtime/cgo.a stale and doesn't use it. In fact, given the build cache I'm not sure there is any real need to distribute runtime/cgo.a at all -- I stopped for my snap and as far as I can tell noone has noticed... |
This fixes golang/go#31293.
This fixes golang/go#31293.
go1.11.9 (released 2019/04/11) fixes an issue where using the prebuilt binary releases on older versions of GNU/Linux led to failures when linking programs that used cgo. Only Linux users who hit this issue need to update. See golang/go#31293 for details Full diff: golang/go@go1.11.8...go1.11.9 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
go1.12.4 (released 2019/04/11) fixes an issue where using the prebuilt binary releases on older versions of GNU/Linux led to failures when linking programs that used cgo. Only Linux users who hit this issue need to update. See golang/go#31293 for details Full diff: golang/go@go1.12.3...go1.12.4 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
go1.12.4 (released 2019/04/11) fixes an issue where using the prebuilt binary releases on older versions of GNU/Linux led to failures when linking programs that used cgo. Only Linux users who hit this issue need to update. See golang/go#31293 for details Full diff: golang/go@go1.12.3...go1.12.4 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
go1.11.9 (released 2019/04/11) fixes an issue where using the prebuilt binary releases on older versions of GNU/Linux led to failures when linking programs that used cgo. Only Linux users who hit this issue need to update. See golang/go#31293 for details Full diff: golang/go@go1.11.8...go1.11.9 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
go1.12.4 (released 2019/04/11) fixes an issue where using the prebuilt binary releases on older versions of GNU/Linux led to failures when linking programs that used cgo. Only Linux users who hit this issue need to update. See golang/go#31293 for details Full diff: golang/go@go1.12.3...go1.12.4 Signed-off-by: Sebastiaan van Stijn <github@gone.nl> Upstream-commit: cf47bb2cc2fecf5b0ccd32a5c10bc738d73bab49 Component: cli
go1.12.4 (released 2019/04/11) fixes an issue where using the prebuilt binary releases on older versions of GNU/Linux led to failures when linking programs that used cgo. Only Linux users who hit this issue need to update. See golang/go#31293 for details Full diff: golang/go@go1.12.3...go1.12.4 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
go1.11.9 (released 2019/04/11) fixes an issue where using the prebuilt binary releases on older versions of GNU/Linux led to failures when linking programs that used cgo. Only Linux users who hit this issue need to update. See golang/go#31293 for details Full diff: golang/go@go1.11.8...go1.11.9 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
go1.11.9 (released 2019/04/11) fixes an issue where using the prebuilt binary releases on older versions of GNU/Linux led to failures when linking programs that used cgo. Only Linux users who hit this issue need to update. See golang/go#31293 for details Full diff: golang/go@go1.11.8...go1.11.9 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Full diff: golang/go@go1.11.5...go1.11.9 go1.11.6 (released 2019/03/14) includes fixes to cgo, the compiler, linker, runtime, go command, and the crypto/x509, encoding/json, net, and net/url packages. See the Go 1.11.6 milestone on our issue tracker for details. https://github.com/golang/go/issues?q=milestone%3AGo1.11.6 go1.11.7 (released 2019/04/05) includes fixes to the runtime and the net packages. See the Go 1.11.7 milestone on our issue tracker for details. https://github.com/golang/go/issues?q=milestone%3AGo1.11.7 go1.11.8 (released 2019/04/08) was accidentally released without its intended fix. It is identical to go1.11.7, except for its version number. The intended fix is in go1.11.9. go1.11.9 (released 2019/04/11) fixes an issue where using the prebuilt binary releases on older versions of GNU/Linux led to failures when linking programs that used cgo. Only Linux users who hit this issue need to update. See golang/go#31293 for details Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Issue was caused by golang/go#31293 (comment)
go1.11.9 (released 2019/04/11) fixes an issue where using the prebuilt binary releases on older versions of GNU/Linux led to failures when linking programs that used cgo. Only Linux users who hit this issue need to update. See golang/go#31293 for details Full diff: golang/go@go1.11.8...go1.11.9 Signed-off-by: Sebastiaan van Stijn <github@gone.nl> Upstream-commit: 1b3ed845356771307f8e6cc79923d94fa1155b17 Component: cli
Full diff: golang/go@go1.11.5...go1.11.9 go1.11.6 (released 2019/03/14) includes fixes to cgo, the compiler, linker, runtime, go command, and the crypto/x509, encoding/json, net, and net/url packages. See the Go 1.11.6 milestone on our issue tracker for details. https://github.com/golang/go/issues?q=milestone%3AGo1.11.6 go1.11.7 (released 2019/04/05) includes fixes to the runtime and the net packages. See the Go 1.11.7 milestone on our issue tracker for details. https://github.com/golang/go/issues?q=milestone%3AGo1.11.7 go1.11.8 (released 2019/04/08) was accidentally released without its intended fix. It is identical to go1.11.7, except for its version number. The intended fix is in go1.11.9. go1.11.9 (released 2019/04/11) fixes an issue where using the prebuilt binary releases on older versions of GNU/Linux led to failures when linking programs that used cgo. Only Linux users who hit this issue need to update. See golang/go#31293 for details Signed-off-by: Sebastiaan van Stijn <github@gone.nl> Upstream-commit: 2cc1df06ee264ab5d1769bd4aae9e417feda9402 Component: engine
go1.12.4 (released 2019/04/11) fixes an issue where using the prebuilt binary releases on older versions of GNU/Linux led to failures when linking programs that used cgo. Only Linux users who hit this issue need to update. See golang/go#31293 for details Full diff: golang/go@go1.12.3...go1.12.4 Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit cf47bb2) Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
What version of Go are you using (
go version
)?go1.12.2
This specifically affects the binary distribution downloaded from golang.org. Bootstrapping 1.12.2 using 1.12.1 did not have this problem.
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputThis error is most easily reproduced with the
gcr.io/bazel-untrusted/ubuntu1404:java8
docker image that Bazel uses for testing. Sorry, it's pretty big.The important part of this is that it's on ubuntu14.04, which has an older linker.
What did you do?
Download go1.12.2
Try to build the program below:
What did you expect to see?
Successful build.
What did you see instead?
I'm seeing similar error when Bazel links binaries with cgo code.
Other thoughts
@ianlancetaylor told me that reloc 42 is R_X86_64_REX_GOTPCRELX. Support for this was added to gold in 2015, so it's presumably not supported by ubuntu14.04. Support was added to the Go linker for #13114. The Go toolchain should not be emitting these relocs. We may be incorporating .o files produced by a C compiler that emits these on the system that produces the binary distribution.
I was able to work around this by bootstrapping the Go 1.12.2 toolchain locally. I think the C compiler installed on this image does not emit these relocs.
The text was updated successfully, but these errors were encountered: