-
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: go test
complains about missing gcc (even if no tests exist, and only for certain imports)
#27303
Comments
go test
complains about missing gcc (even if no tests exist, and only for certain imports)go test
complains about missing gcc (even if no tests exist, and only for certain imports)
Shouldn't this be part of Go1.11.1? Or are there any workarounds? Running a CI pipeline is problematic when package foo
import _ "net/http" |
This problem has been reported several times in several different bugs. We should probably try to concentrate on one issue. CC @bcmills |
I'm starting with #27285 because it's easy to reproduce and leads to similar symptoms. I plan to recheck this issue once that one is resolved, in case the underlying cause is the same for both. |
Pretty sure this one in particular is a dup of #26988. |
Setting the environment variable CGO_ENABLED to 0 fixed it for me. If you use docker, insert the following before your ENV CGO_ENABLED 0 |
It's not :( With go version go1.12.7 linux/amd64, "go build" does not need gcc, but "go test" does. Having a directory with just one file, "foo.go", with just the lines: package foo
import _ "net" results in:
|
|
This also worked for me, but I did: RUN CGO_ENABLED=0 go test -run="" /tmp/build/pkg/* To avoid setting an environment variable. Thanks jkomyno |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.11 linux/amd64
Does this issue reproduce with the latest release?
Yes, 1.11 is the latest release.
What operating system and processor architecture are you using (
go env
)?What did you do?
Create an empty directory, and copy a single main.go file.
Working: https://play.golang.org/p/sctz4PAGjf1
Breaking: https://play.golang.org/p/aZu1NZdtXel
Run
go test
What did you expect to see?
The working
main.go
file shows the expected message[no test files]
.What did you see instead?
The breaking
main.go
shows the error message# runtime/cgo exec: "gcc": executable file not found in $PATH
Go 1.10.4 shows the correct message. Setting CGO_ENABLED="0" also leads to the correct message.
Using debian 9 (stretch) in a Windows Linux Subsystem.
The text was updated successfully, but these errors were encountered: