我从 github.com/google/gxui 克隆代码然后
光盘样本/hello_word
GOOS=windows go build
发生错误它说
/d01/gopath/src/github.com/goxjs/gl/gl_opengl.go:10:2: no build go/d01/gopath/src/github.com/go-gl/gl/v2.1/gl 中的源文件/d01/gopath/src/github.com/goxjs/glfw/desktop.go:10:2: no buildable Go/d01/gopath/src/github.com/go-gl/glfw/v3.2/glfw 中的源文件
我尝试
去获取 -u github.com/go-gl/gl/v2.1/gl 去获取 -ugithub.com/go-gl/glfw/v3.2/glfw
未发生错误
我尝试再次跑步
GOOS=windows go build
问题尚未解决
因为您的 mac 没有可以将编译器交叉编译器到目标操作系统的 c 编译器。我在 Linux 操作系统上尝试过,它可以毫无问题地编译。去年 Git 上有一个关于它的问题,直到今天它仍然开放。我建议直接在目标操作系统上编译它。如果您浏览代码
github.com/go-gl/gl/v2.1/gl/conversions.go
您会注意到它导入"c",因为它需要一个与目标操作系统兼容的 C 编译器。