Skip to content
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: locating GOROOT fails when the go command is run from the cross-compiled bin subdirectory [1.21 backport] #62144

Closed
gopherbot opened this issue Aug 18, 2023 · 3 comments
Labels
CherryPickApproved Used during the release process for point releases GoCommand cmd/go release-blocker
Milestone

Comments

@gopherbot
Copy link

@bcmills requested issue #62119 to be considered for backport to the next 1.21 minor release.

@gopherbot, please backport to Go 1.21. This interacts badly with the change to build cmd/go with -trimpath by default, causing cross-compiled go commands to fail to locate GOROOT if built at a release version.

@gopherbot gopherbot added CherryPickCandidate Used during the release process for point releases GoCommand cmd/go labels Aug 18, 2023
@bcmills bcmills added the CherryPickApproved Used during the release process for point releases label Aug 18, 2023
@bcmills bcmills added this to the Go1.21.1 milestone Aug 18, 2023
@gopherbot gopherbot removed the CherryPickCandidate Used during the release process for point releases label Aug 18, 2023
@bcmills
Copy link
Contributor

bcmills commented Aug 21, 2023

In theory this could also be backported to Go 1.20.

However, in Go 1.20 make.bash uses GOROOT_FINAL instead of setting -trimpath for installed toolchain commands, so it is much less likely that users will run into this problem in the first place.

@gopherbot
Copy link
Author

Change https://go.dev/cl/521695 mentions this issue: [release-branch.go1.21] cmd/go: find GOROOT using os.Executable when installed to GOROOT/bin/GOOS_GOARCH

gopherbot pushed a commit that referenced this issue Aug 30, 2023
…installed to GOROOT/bin/GOOS_GOARCH

When running make.bash in a cross-compiled configuration
(for example, GOARCH different from GOHOSTARCH), cmd/go
is installed to GOROOT/bin/GOOS_GOARCH instead of GOROOT/bin.

That means that we need to look for GOROOT in both ../.. and ../../..,
not just the former.

Fixes #62144.
Updates #62119.
Updates #18678.

Change-Id: I283c6a10c46df573ff44da826f870417359226a7
Reviewed-on: https://go-review.googlesource.com/c/go/+/521015
Reviewed-by: Michael Matloob <matloob@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
(cherry picked from commit 9e9556d)
Reviewed-on: https://go-review.googlesource.com/c/go/+/521695
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
@gopherbot
Copy link
Author

Closed by merging 6385a6f to release-branch.go1.21.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CherryPickApproved Used during the release process for point releases GoCommand cmd/go release-blocker
Projects
None yet
Development

No branches or pull requests

2 participants