-
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
cmd/dist: tools built with GOROOT_FINAL
cannot locate it when copied to another location
#61921
Comments
GOROOT_FINAL
doesn't work for go1.21.0
GOROOT_FINAL
doesn't work for go1.21.0GOROOT_FINAL
doesn't work for go1.21.0
This is almost certainly a consequence of https://go.dev/cl/463740 (for #24904). When built with @g4s8, is there a reason your script is using |
GOROOT_FINAL
doesn't work for go1.21.0GOROOT_FINAL
cannot locate it when copied to another location
I wonder if we should change (But I would still recommend not setting it, and using symlinks instead. 🤷♂️) |
That's extra tricky because I think the releasebot sets @golang/release, how much work would it be to stop setting |
It wouldn't be much work at all. (The relevant code is in Is #51504 relevant to this issue? |
I don't think it's particularly closely related. The problem there occurs when running tests before moving the binaries to |
If /usr/bin/go is a symlink to /usr/lib/go/bin/go, I believe that will work correctly. Can your packaging do that? It would be ideal if we could remove GOROOT_FINAL entirely. The distribution builds are position-independent and therefore reproducible. That's an important feature, and it seems like a mistake to have a flag to turn that off. However, we also want people to be able to package Go for Linux distributions. :-) |
Change https://go.dev/cl/518837 mentions this issue: |
Linking
|
I think we should remove it from pretty much everything, for which I have filed proposal #62047. |
I have just done something very similar while packaging v1.21.0 for Guix, and it appears to have worked. The only remaining issue I can foresee is if other Guix maintainers have an issue with the new link structure. |
I'm building 1.21 from source on alpine using the Certain packages like golang.org/x/net are included in the base distribution and when there is a CVE identified, I wanted to be able to patch it just before running When I build 1.21.0, I'm seeing this issue. The dockerfile doesn't appear to set Is the right fix for me to just add |
@tspearconquest, as far as I can tell that Dockerfile is not moving the final binaries, and should be resolving That is: the problem you are reporting is not obviously related to this one. Could you please file a new issue with more detail on the failure mode you're seeing? |
Sure; I did simplify the customizations a bit. We use a multi-stage docker build; so we're doing |
- Before this, go and gofmt was installed to /usr/bin, which confuses Go as it can not figure out $GOROOT automatically by os.Executable, see [1] for details. By installing binaries to $GOROOT/bin (GOROOT points to /usr/lib), go can now figure out its GOROOT. - Provide symlinks in /usr/bin/go{,fmt}-google to eusure it is there. - Update alternatives file to point corresponding executables to the one installed in $GOROOT. [1]: golang/go#61921 (comment)
- Before this, go and gofmt was installed to /usr/bin, which confuses Go as it can not figure out $GOROOT automatically by os.Executable, see [1] for details. By installing binaries to $GOROOT/bin (GOROOT points to /usr/lib/go), go can now figure out its GOROOT. - Provide symlinks in /usr/bin/go{,fmt}-google to ensure it is there. - Update alternatives file to point corresponding executables to the one installed in $GOROOT. [1]: golang/go#61921 (comment)
- Before this, go and gofmt was installed to /usr/bin, which confuses Go as it can not figure out $GOROOT automatically by os.Executable, see [1] for details. By installing binaries to $GOROOT/bin (GOROOT points to /usr/lib/go), go can now figure out its GOROOT. - Provide symlinks in /usr/bin/go{,fmt}-google to ensure it is there. - Update alternatives file to point corresponding executables to the one installed in $GOROOT. [1]: golang/go#61921 (comment)
- Before this, go and gofmt was installed to /usr/bin, which confuses Go as it can not figure out $GOROOT automatically by os.Executable, see [1] for details. By installing binaries to $GOROOT/bin (GOROOT points to /usr/lib/go), go can now figure out its GOROOT. - Provide symlinks in /usr/bin/go{,fmt}-google to ensure it is there. - Update alternatives file to point corresponding executables to the one installed in $GOROOT. [1]: golang/go#61921 (comment)
- Before this, go and gofmt was installed to /usr/bin, which confuses Go as it can not figure out $GOROOT automatically by os.Executable, see [1] for details. By installing binaries to $GOROOT/bin (GOROOT points to /usr/lib/go), go can now figure out its GOROOT. - Provide symlinks in /usr/bin/go{,fmt}-google to ensure it is there. - Update alternatives file to point corresponding executables to the one installed in $GOROOT. [1]: golang/go#61921 (comment)
- Before this, go and gofmt was installed to /usr/bin, which confuses Go as it can not figure out $GOROOT automatically by os.Executable, see [1] for details. By installing binaries to $GOROOT/bin (GOROOT points to /usr/lib/go), go can now figure out its GOROOT. - Provide symlinks in /usr/bin/go{,fmt}-google to ensure it is there. - Update alternatives file to point corresponding executables to the one installed in $GOROOT. [1]: golang/go#61921 (comment)
#62047 is approved, so the resolution here is that we will remove support for |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I'm trying to build go 1.21.0 from sources for Void Linux
go
package: https://github.com/void-linux/void-packagesThe steps to build it (inside
go
repo directory):What did you expect to see?
When running
/usr/bin/go version
(or any othergo
command, likego build
, etc) to seeWhat did you see instead?
When running
go
command or/usr/bin/go
:If I run
/usr/lib/go/bin/go
, then all commands works fine:If I run exactly the same build commands for go version 1.20.7, it's working fine:
or
The text was updated successfully, but these errors were encountered: