-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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/cgo: better error message when a different gcc is needed on Windows #21024
Comments
Which version of Go? In current versions of Go the comment that is executed is not precisely the command that is printed. cgo actually writes the input to a file, and passes the file to the compiler. That should have happened in this case. That was fixed in the Go 1.7 release. |
I was building from master, and pointed go bootstrap path to the newest ( go 1.8.3) binary that I just downloaded. |
Can you attach the complete output from cgo with the Note that the command that cgo displays is not the exact command that it executes. So while clearly something is wrong, I don't yet see how the problem could be passing standard input to the compiler. See the |
IIUC, I don't get to the point of running cgo; the error happens when building cgo:
Should I add any options to this to provide more details? ( |
That is running cgo, not building cgo. It is running the program A simple thing that may help is to temporarily replace realgcc.exe with a program that just dumps its arguments, such as the echo program if you have that. That will shows us exactly how the compiler is being invoked. |
This is what I'm getting after replacing gcc (which came with Haskell distro, and seems to be mingw gcc) with echo:
|
Thanks. Unfortunately, it looks like cgo breaks (unable to read |
Sorry, Windows + cgo build system outsmarted me. However much I tried to trick them with a Windows batch files to echo the arguments (to a file or to screen) and compile, it still managed to hide everything up until the "no input files" error. I will try again some time. I guess that it's better to just use the recommended gcc anyway, and I just noticed the warning about incompatibility with some other flavors of gcc. |
Not a regression so I'll mark this for investigation during the Go1.10 cycle. |
I always struggle with batch files. I would use Go to write such tool instead. You will need to invoke programs with redirected stdin/stdout/stderr, pass program parameters and print to the screen or file - Go should be fine for that. Alex |
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.) |
When building go from source on Windows, the gcc needs to support input from stdin; the exact command run is:
Apparently, not all gcc for Windows handle reading from stdin correctly; mine (realgcc) didn't, and I got this very brief error message when running tests with all.bat:
It would be nice to have an error message suggesting to use a different gcc (and ideally, recommending a particular one).
The text was updated successfully, but these errors were encountered: