mirror of
https://github.com/golang/go
synced 2024-11-25 08:07:57 -07:00
go/build: disable cgo when cross compiling
Fixes #5141. R=golang-dev, minux.ma, ality, bradfitz CC=golang-dev https://golang.org/cl/8134043
This commit is contained in:
parent
4b6ca21271
commit
949ae8cced
@ -301,7 +301,13 @@ func defaultContext() Context {
|
||||
case "0":
|
||||
c.CgoEnabled = false
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user