-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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/go: spurious error message when external linking a pure Go program #31544
Comments
This also happens in module mode:
But it does not happen if the file name (hello.go) is given explicitly.
|
/cc @jayconrod @bcmills |
I can reproduce the failure. I'm bisecting it now to try to get some idea of how it broke. |
|
This is a result of the The decision in the go/src/cmd/go/internal/load/flag.go Line 43 in 19966e9
That field is set after the call to go/src/cmd/go/internal/load/pkg.go Lines 1962 to 1964 in 19966e9
However, by that point go/src/cmd/go/internal/load/pkg.go Line 511 in 19966e9
...and go/src/cmd/go/internal/load/pkg.go Line 1534 in 19966e9
|
@cherrymui, unless this is important for you for some reason, we'd like to postpone the fix to Go 1.14. It's subtle code. /cc @bcmills |
Change https://golang.org/cl/176217 mentions this issue: |
Sure, it is fine to postpone. |
We would like to propose to reconsider the priority fixing this issue. The implication of it is, that such Go binaries have no Preloaded (LD_PRELOAD) shared objects may rely on the fact that Go creates POSIX threads. |
I certainly think this should be fixed, but I'm not following the concern with LD_PRELOAD shared objects. I don't see how it would be possible to use an LD_PRELOAD with a pure Go program. |
@ianlancetaylor: The scenario is very specific, but has a serious impact on existing applications. A shared object of our (application performance monitoring) product is pre-loaded into Go processes to hook certain Go functions. Customers use As the issue causes |
OK, that seems not only specific but completely unsupported. Again, I think this bug should be fixed, but the Go team can't take any responsibility for keeping that kind of pre-loaded library working. |
Change https://go.dev/cl/472515 mentions this issue: |
…tform internal/platform.MustLinkExternal is used in various places to determine whether external linking is required. It should always match what the linker actually requires, but today does not match because the linker imposes additional constraints. Updates #31544. Change-Id: I0cc6ad587e95c607329dea5d60d29a5fb2a9e722 Reviewed-on: https://go-review.googlesource.com/c/go/+/472515 Run-TryBot: Bryan Mills <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
Change https://go.dev/cl/477195 mentions this issue: |
Change https://go.dev/cl/477397 mentions this issue: |
Change https://go.dev/cl/477839 mentions this issue: |
Change https://go.dev/cl/522239 mentions this issue: |
…enabled Fixes #46330. Fixes #62123. Updates #31544. Change-Id: I023aa2bdb5a24e126a0de5192a077e8cf1a0a67c Reviewed-on: https://go-review.googlesource.com/c/go/+/522239 Run-TryBot: Bryan Mills <[email protected]> Auto-Submit: Bryan Mills <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
…enabled Fixes golang#46330. Fixes golang#62123. Updates golang#31544. Change-Id: I023aa2bdb5a24e126a0de5192a077e8cf1a0a67c Reviewed-on: https://go-review.googlesource.com/c/go/+/522239 Run-TryBot: Bryan Mills <[email protected]> Auto-Submit: Bryan Mills <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
Change https://go.dev/cl/569296 mentions this issue: |
…e notes for Go 1.21 and 1.22 Fixes golang/go#65887. Updates golang/go#31544. Updates golang/go#46330. Updates golang/go#64875. Change-Id: Ibb035e2287ad0efdbe875c5dd16ffd938ec7a956 Reviewed-on: https://go-review.googlesource.com/c/website/+/569296 Reviewed-by: Cherry Mui <[email protected]> Auto-Submit: Bryan Mills <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
Looks like they made some cleanup in the logic allowing buildmode pie on various platforms. Related to golang/go#31544 See the code at: https://cs.opensource.google/go/go/+/master:src/internal/platform/supported.go;l=222-231;drc=d7fcb5cf80953f1d63246f1ae9defa60c5ce2d76;bpv=1;bpt=0 Signed-off-by: Andrei Aaron <[email protected]>
Looks like they made some cleanup in the logic allowing buildmode pie on various platforms. Related to golang/go#31544 See the code at: https://cs.opensource.google/go/go/+/master:src/internal/platform/supported.go;l=222-231;drc=d7fcb5cf80953f1d63246f1ae9defa60c5ce2d76;bpv=1;bpt=0 Signed-off-by: Andrei Aaron <[email protected]>
Looks like they made some cleanup in the logic allowing buildmode pie on various platforms. Related to golang/go#31544 See the code at: https://cs.opensource.google/go/go/+/master:src/internal/platform/supported.go;l=222-231;drc=d7fcb5cf80953f1d63246f1ae9defa60c5ce2d76;bpv=1;bpt=0 Signed-off-by: Andrei Aaron <[email protected]>
* chore: update to go 1.22 Only go toolchain version is updated. We compile with go 1.22, but we allow others to compile using language version 1.21 if they wish to. If we also updated the go version in go.mod everyone would be forced to update, as that is enforced as a minimum allowed version. This comment explains the difference well enough https://news.ycombinator.com/item?id=36455759 Signed-off-by: Andrei Aaron <[email protected]> * chore: fix freeBSD AMD64 build Looks like they made some cleanup in the logic allowing buildmode pie on various platforms. Related to golang/go#31544 See the code at: https://cs.opensource.google/go/go/+/master:src/internal/platform/supported.go;l=222-231;drc=d7fcb5cf80953f1d63246f1ae9defa60c5ce2d76;bpv=1;bpt=0 Signed-off-by: Andrei Aaron <[email protected]> --------- Signed-off-by: Andrei Aaron <[email protected]>
What version of Go are you using (
go version
)?tip (3235f7c)
Does this issue reproduce with the latest release?
Yes, happens with Go 1.11, 1.12, and tip, but not with Go 1.10.
What operating system and processor architecture are you using (
go env
)?linux/amd64
What did you do?
When using external linking for a pure Go program, the linker prints
loadinternal: cannot find runtime/cgo
message. The linking actually succeeded, and the generated binary works fine.What did you expect to see?
No error message, like with Go 1.10.
What did you see instead?
Spurious
loadinternal: cannot find runtime/cgo
error message.The text was updated successfully, but these errors were encountered: