cmd/go: import "C" breaks cross-compiling to Linux in OSX #19470
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.8 darwin/amd64
What operating system and processor architecture are you using (
go env
)?OSX 10.12.3
What did you do?
I created a file in a package
proj
withimport "C"
where C is never referenced in the code.Then I made a
main.go
file with the following contentsgo build -o testproject .
works as expectedbut cross compiling fails
If I explicitly set
CGO_ENABLED=1
, I get an error at link timeWhat did you expect to see?
I was expecting the following:
GOOS=linux
enabled too.CGO_ENABLED=1
should work if the issue is with cgo being turned off at cross-compile time.What did you see instead?
I got the following instead of an error message regarding the spurious
import "C"
or a cross-compiled binary.The text was updated successfully, but these errors were encountered: