-
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/link: panic: runtime error: slice bounds out of range #23740
Comments
We're likely to need reproduction instructions. Thanks. |
I’m on my phone but I’m pretty sure there are several duplicates of this already, all without reproducers. |
Hey @kaoet, I believe this is a duplicate of bazel-contrib/rules_go#1116, so I'll close this issue in favor of that one. TL;DR: we believe this is due to multiple versions of the same package being included in the build. Only one will actually get linked, which means that a dependent library may be compiled against one version and linked against another. The main way to work around this is to ensure there are no duplicate libraries unless they use |
It’d be nice if cmd/link could detect this scenario somehow and issue an appropriate warning, rather than panicking, which will continue to lead to new issues being filed here. I’m not sure how or if that is possible, but reopening this issue for that. Since you understand the issue, do you by chance have a minimal reproduction? |
It may be difficult for cmd/link to detect this without a change in the package format. Each .a file produced by the compiler would need to be stamped with a unique id, and it would need to include the ids of the other .a files it was compiled against. The linker would need to verify these ids. It's the responsibility of the build system (go build or Bazel rules_go in this case) to prevent this situation from happening, so while adding verification to cmd/link would be valuable, I'm not sure it justifies the additional complexity. go build prevents this from happening by passing rules_go should prevent this from happening by verifying that no two libraries passed to the linker have the same import path. At the moment, rules_go requires you to set |
What version of Go are you using (
go version
)?1.9.4
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?Ubuntu 17.10 linux_amd64
What did you do?
I'm compiling my project with bazel by just running
bazel build node/agent/unsullied
.The code is too complicated. I'm working to make a minimum example.
What did you expect to see?
bazel build succeed.
What did you see instead?
At the last step, GoLink crashed.
The text was updated successfully, but these errors were encountered: