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/dist: trying to build Go from source at tip on Windows / WSL incorrectly tries to download a go1.24.0 toolchain #70533

Open
bitlux opened this issue Nov 23, 2024 · 3 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows

Comments

@bitlux
Copy link
Contributor

bitlux commented Nov 23, 2024

Go version

go version go1.23.2 windows/amd64

Output of go env in your module/workspace:

$ pwd
/mnt/c/Users/Adam/projects/go.googlesource.com
$ go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\Adam\AppData\Local\go-build
set GOENV=C:\Users\Adam\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\Adam\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\Adam\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.23.2
set GODEBUG=
set GOTELEMETRY=on
set GOTELEMETRYDIR=C:\Users\Adam\AppData\Roaming\go\telemetry
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=0
set GOMOD=NUL
set GOWORK=
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\Adam\AppData\Local\Temp\go-build3725220361=/tmp/go-build -gno-record-gcc-switches
/mnt/c/Users/Adam/projects/go.googlesource.com $

What did you do?

I am using a combination of Windows and WSL. My go installation is in Windows; I have go as a symlink to /mnt/c/Program Files/Go/bin/go.exe. My shell is a WSL bash shell.

I cloned the Go source repo as per https://go.dev/doc/contribute#gerrit_overview:

 $ git clone https://go.googlesource.com/go
Cloning into 'go'...
remote: Sending approximately 575.75 MiB ...
remote: Counting objects: 22, done
remote: Total 636425 (delta 456293), reused 636425 (delta 456293)
Receiving objects: 100% (636425/636425), 574.48 MiB | 3.94 MiB/s, done.
Resolving deltas: 100% (456293/456293), done.
Updating files: 100% (14190/14190), done.

When I tried to run ./all.bash, I get this error:

$ ./all.bash
go: downloading go1.24.0 (windows/amd64)
go: download go1.24.0 for windows/amd64: toolchain not available

Indeed, all go commands return this error when I am in this directory:

/mnt/c/Users/Adam/projects $ go version
go version go1.23.2 windows/amd64
/mnt/c/Users/Adam/projects $ cd go.googlesource.com/
/mnt/c/Users/Adam/projects/go.googlesource.com $ go version
go version go1.23.2 windows/amd64
/mnt/c/Users/Adam/projects/go.googlesource.com $ cd go
/mnt/c/Users/Adam/projects/go.googlesource.com/go $ go version
go version go1.23.2 windows/amd64
/mnt/c/Users/Adam/projects/go.googlesource.com/go $ cd src
/mnt/c/Users/Adam/projects/go.googlesource.com/go/src $ go version
go: downloading go1.24.0 (windows/amd64)
go: download go1.24.0 for windows/amd64: toolchain not available

Here is the cloned go.mod file:

$ cat go.mod
module std

go 1.24

require (
        golang.org/x/crypto v0.29.0
        golang.org/x/net v0.31.1-0.20241122011411-9a518991035b
)

require (
        golang.org/x/sys v0.27.1-0.20241118193836-0a57dbcf35b2 // indirect
        golang.org/x/text v0.20.0 // indirect
)

What did you see happen?

$ go version
go: downloading go1.24.0 (windows/amd64)
go: download go1.24.0 for windows/amd64: toolchain not available

What did you expect to see?

$ go version
go version go1.23.2 windows/amd64
@dmitshur dmitshur added OS-Windows NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Nov 23, 2024
@dmitshur dmitshur changed the title cmd/go: "toolchain not avilable" message cmd/dist: trying to build Go from source at tip on Windows / WSL incorrectly tries to download a go1.24.0 toolchain Nov 23, 2024
@dmitshur
Copy link
Contributor

From your description, it sounds like there's something going wrong when you're building Go from source.

I'm not sure if you're running into some problem that only affects the combination of Windows and WSL, or if something else is causing trouble.

Here are some ideas for what you could try, and report back on what the outcome is:

  1. What happens if you run all.bat instead of all.bash?

    Normally, on Windows, all.bat is expected to be used, though maybe all.bash is right for WSL.

  2. If you have access to another machine with a different OS, are you able to build Go from source there?

    That is, it'd help to understand if this only happening on Windows/WSL, or are you seeing the same behavior elsewhere too.

CC @golang/windows.

@bitlux
Copy link
Contributor Author

bitlux commented Nov 23, 2024

What happens if you run all.bat instead of all.bash?

If I run it in bash, I get a bunch of errors. If I run it in Command Prompt, it appears to build the toolchain. Preliminary results:

C:\Users\Adam\projects\go.googlesource.com\go\src>all.bat
Building Go cmd/dist using C:\Program Files\Go. (go1.23.2 windows/amd64)
Building Go toolchain1 using C:\Program Files\Go.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.

If you have access to another machine with a different OS, are you able to build Go from source there?

Sadly I don't have access to another machine. Using this Windows machine is sort of a last resort. :-\

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows
Projects
None yet
Development

No branches or pull requests

3 participants