Commit 949ae8cc authored by Dave Cheney's avatar Dave Cheney

go/build: disable cgo when cross compiling

Fixes #5141.

R=golang-dev, minux.ma, ality, bradfitz
CC=golang-dev
https://golang.org/cl/8134043
parent 4b6ca212
...@@ -301,7 +301,13 @@ func defaultContext() Context { ...@@ -301,7 +301,13 @@ func defaultContext() Context {
case "0": case "0":
c.CgoEnabled = false c.CgoEnabled = false
default: default:
c.CgoEnabled = cgoEnabled[c.GOOS+"/"+c.GOARCH] // golang.org/issue/5141
// cgo should be disabled for cross compilation builds
if runtime.GOARCH == c.GOARCH && runtime.GOOS == c.GOOS {
c.CgoEnabled = cgoEnabled[c.GOOS+"/"+c.GOARCH]
break
}
c.CgoEnabled = false
} }
return c return c
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment