-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: error building standard lib using -buildmode=shared Go 1.20rc1 #57334
Comments
cc @alexsaezm (found this issue while building Go 1.20rc1 for Fedora) |
CC @cherrymui @thanm |
This command includes all packages in std, in particular, both In normal build, only the I wonder if
The last error is due to a package that is used only in test, and calls a function defined in test. Again building |
CC @bcmills |
For the |
For the test-only package, does it suffice to move that package inside a |
For the record, there are also "similar" behaviors in other architectures: |
Change https://go.dev/cl/458696 mentions this issue: |
Change https://go.dev/cl/458695 mentions this issue: |
Thanks. This works. For the other issue I worked around it using a function pointer. |
Only one of the runtime/race/internal/amd64vN packages should be included in a build. Generally this is true because the runtime/race package would import only one of them depending on the build configuration. But for "go install -buildmode=shared std" it includes all Go packages in std, which includes both, which then causes link-time failure due to duplicated symbols. To avoid this, we add build tags to the internal packages, so, depending on the build configuation, only one package would contain buildable go files therefore be included in the build. For #57334. Change-Id: I52ddc3a40e16c7d04b4dd861e9689918d27e8509 Reviewed-on: https://go-review.googlesource.com/c/go/+/458695 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Cherry Mui <cherryyz@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
Change https://go.dev/cl/459056 mentions this issue: |
Test that "go install -buildmode=shared std" works. For #57334. Change-Id: I465a07cf2e9035995916ef9940b4c1eeba998099 Reviewed-on: https://go-review.googlesource.com/c/go/+/459056 Reviewed-by: Than McIntosh <thanm@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Tim Scharfenort <timscharfenort89@googlemail.com> Run-TryBot: Cherry Mui <cherryyz@google.com>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
No, it does not reproduce with the latest 1.19.x release.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
pushd src
./make.bash
popd
GOROOT=$(pwd) ./bin/go install -buildmode=shared -v -x std
What did you expect to see?
No error building shared stdlib.
What did you see instead?
https://gist.github.com/derekparker/d391d9bb492f9ee611c8ad136e813ab3
The text was updated successfully, but these errors were encountered: