-
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: fails with go: cannot find GOROOT directory
after cross-compiling from WSL to Windows.
#45763
Comments
What happens when you unset |
Same as when
|
go: cannot find GOROOT directory
after cross-compiling from Linux to Windows.go: cannot find GOROOT directory
after cross-compiling from WSL to Windows.
The path |
It returns the exactly same error. Let me try to clarify what I exactly did. First, I cloned Go repo to |
How do you run the Windows program? I think it is supposed to be run from Windows, not from the Linux environment. |
go: cannot find GOROOT directory
after cross-compiling from WSL to Windows.go: cannot find GOROOT directory
after cross-compiling from WSL to Windows.
WSL allows to transparently run Windows programs from the Linux environment. |
And I am asking whether it runs in a normal power shell, this is importatnt to know whether it is a WSL specific problem. |
As I previously wrote, it returns the same error. |
Was |
Could you provide the exact commands that you use to build the toolchain, as well as how you run it? Thanks. |
... Why does it work now?
|
Did you change from WSL1 to WSL2? |
No, it was WSL2 before too. |
WSL is not Windows. If you want to use WSL environment, then you should follow Linux instructions on how to install and use Go. If you want to use Windows environment, then you should follow Windows instructions for Go. Alex |
I encountered this issue when trying to do cross-compiling On my mac, it has
, and I run
. But when I run the above binary, it shows
rather than picking up the go env GOROOT on Linux. It seems somehow the
|
https://golang.org/pkg/runtime/#GOROOT So your issue seems unrelated since the env var would not be set when running |
Let me update my above comment. Here is my environment: mac:
I run Linux:
. But when I run the above binary, it shows |
@rayjcwu Since |
Got it, thanks. This is what I missed. |
Looks like there is no bug here |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
No, building from
go1.16.3
branch doesn't reproduce this bug.What operating system and processor architecture are you using (
go env
)?Using WSL 2 with Alpine Linux on Windows 10 Home, build
21364.co_release.210416-1504
.go env
OutputWhat did you do?
Cross-compiled Go toolchain
master
using Go 1.16.3 forwindows/amd64
, using the standard procedures as described on https://golang.org/doc/install/source. When running/mnt/c/Users/freya/goroot/bin/windows_amd64/go.exe version
I got the following error instead:go: cannot find GOROOT directory: \mnt\c\Users\freya\goroot
. The same happens when settingGOROOT=/mnt/c/Users/admer/goroot/
.What did you expect to see?
go.exe version
running correctly and not failing.What did you see instead?
The text was updated successfully, but these errors were encountered: