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

cmd/go: unhelpful error when cross-compiling for windows with cgo #20199

Closed
josharian opened this issue May 1, 2017 · 4 comments
Closed

cmd/go: unhelpful error when cross-compiling for windows with cgo #20199

josharian opened this issue May 1, 2017 · 4 comments
Labels
FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@josharian
Copy link
Contributor

package main

import "fmt"
import "C"

func main() {
	fmt.Printf("main=%p\n", main)
}
$ go build .
$ GOOS=windows go build .
can't load package: package .: no buildable Go source files in /Users/josh/go/tip/w

If you remove the import "C":

$ go build .
$ GOOS=windows go build .

If (like me) you didn't notice the import "C", this is a pretty puzzling error message.

@odeke-em
Copy link
Member

Am using OSX(darwin): same error when building for linux

$ GOOS=linux go build .
can't load package: package .: no buildable Go source files in /Users/emmanuelodeke/Desktop/openSrc/bugs/golang/20199

but when building for the same OS as the host OS, no error

$ GOOS=darwin go build . && echo successful
successful

@odeke-em
Copy link
Member

Update: one can reproduce the problem on the host OS == final OS if I set CGO_ENABLED=0 which might not make much sense since using import "C" but here is the error

$ GOOS=darwin CGO_ENABLED=0 go build . && echo successful
can't load package: package .: no buildable Go source files in /Users/emmanuelodeke/Desktop/openSrc/bugs/golang/20199

on Go version

$ go version
go version devel +643be70 Wed May 10 19:30:42 2017 +0000 darwin/amd64

@andybons andybons added help wanted NeedsFix The path to resolution is known, but the work has not been done. labels Apr 11, 2018
@andybons andybons added this to the Unplanned milestone Apr 11, 2018
@bcmills
Copy link
Contributor

bcmills commented Jan 18, 2019

Dup of #24068?

@bcmills bcmills added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jan 18, 2019
@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 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

5 participants