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

Comments

@lovettchris
Copy link

@lovettchris lovettchris commented Jan 22, 2020

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

This comment has been minimized.

Copy link
Member

@ALTree ALTree commented Jan 22, 2020

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

What is it?

@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 this to the Go1.15 milestone Jan 22, 2020
@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Jan 22, 2020

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

@ALTree

This comment has been minimized.

Copy link
Member

@ALTree ALTree commented Jan 22, 2020

Win docs say <process.h>

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Jan 22, 2020

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

@ALTree

This comment has been minimized.

Copy link
Member

@ALTree 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

This comment has been minimized.

Copy link
Contributor

@bradfitz bradfitz commented Jan 22, 2020

See also all the related conversation in #35006.

This might even be a dup.

@alexbrainman

This comment has been minimized.

Copy link
Member

@alexbrainman alexbrainman commented Jan 23, 2020

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

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Feb 22, 2020

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.)

@gopherbot gopherbot closed this Feb 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants
You can’t perform that action at this time.