Navigation Menu

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

build: bootstrap build of go fails on windows amd64 #36691

Closed
lovettchris opened this issue Jan 22, 2020 · 8 comments
Closed

build: bootstrap build of go fails on windows amd64 #36691

lovettchris opened this issue Jan 22, 2020 · 8 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@lovettchris
Copy link

What version of Go are you using (go version)?

$ go version
go version go1.4 windows/amd64

Does this issue reproduce with the latest release?

trying to use the go bootstrap version 1.4 (as per https://golang.org/doc/install/source) to build the latest go sources. But it fails.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
set GOARCH=amd64
set GOBIN=
set GOCHAR=6
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=
set GORACE=
set GOROOT=c:\go
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0
set CXX=g++
set CGO_ENABLED=1

What did you do?

Downloaded and unpacked go1.4.windows-amd64.zip to c:\go
set GOROOT_BOOTSTRAP=c:\go
set GOROOT_FINAL=d:\go
cloned the latest github.com/golang/go
cd src
all.bat

What did you expect to see?

Successful build of the new version of go.

What did you see instead?

d:\git\golang\go\src>all.bat
Building Go cmd/dist using c:\go
Building Go toolchain1 using c:\go.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for windows/amd64.
// runtime/cgo
gcc_libinit_windows.c: In function 'x_cgo_sys_thread_create':
gcc_libinit_windows.c:57:12: error: implicit declaration of function '_beginthread'; did you mean 'OpenThread'? [-Werror=implicit-function-declaration]
thandle = _beginthread(func, 0, arg);
^~~~~~~~~~~~
OpenThread
cc1: all warnings being treated as errors
go: failed to remove work dir: GetFileInformationByHandle C:\Users\Chris\AppData\Local\Temp\go-build549624342\NUL: Incorrect function.
go tool dist: FAILED: d:\git\golang\go\pkg\tool\windows_amd64\go_bootstrap install -gcflags=all= -ldflags=all= std cmd: exit status 2
The system cannot find the batch label specified - fail
go: failed to remove work dir: GetFileInformationByHandle C:\Users\Chris\AppData\Local\Temp\go-build900619142\NUL: Incorrect function.

@ALTree
Copy link
Member

ALTree commented Jan 22, 2020

This is caused by the the gcc toolchain you are using.

What is it?

@ALTree ALTree added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jan 22, 2020
@ianlancetaylor ianlancetaylor changed the title bootstrap build of go fails on windows amd64 build: bootstrap build of go fails on windows amd64 Jan 22, 2020
@ianlancetaylor ianlancetaylor added OS-Windows NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Jan 22, 2020
@ianlancetaylor ianlancetaylor added this to the Go1.15 milestone Jan 22, 2020
@ianlancetaylor
Copy link
Contributor

Anyone know if _beginthread is declared in any standard Windows header file?

@ALTree
Copy link
Member

ALTree commented Jan 22, 2020

Win docs say <process.h>

@ianlancetaylor
Copy link
Contributor

Hmmm, we already #include <process.h> in runtime/cgo/gcc_libinit_windows.c.

@ALTree
Copy link
Member

ALTree commented Jan 22, 2020

I don't know if this is useful, but I've seen that error in the past when trying to build from source on windows with a cygwin gcc (which anyway is not officially supported for bootstrapping Go on windows)

@bradfitz
Copy link
Contributor

See also all the related conversation in #35006.

This might even be a dup.

@alexbrainman
Copy link
Member

See also all the related conversation in #35006.

I agree #35006 (comment) might help.

@lovettchris download http://musl.cc/x86_64-w64-mingw32-native.zip, unzip it anywhere, add bin subdirectory to your PATH, and try again.

You can also

set CGO_ENABLED=0

and that will build Go without any gcc installed. You won't be able to do Cgo, if you do that.

Thank you.

Alex

@gopherbot
Copy link

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@golang golang locked and limited conversation to collaborators Feb 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

6 participants