diff --git a/src/make.bash b/src/make.bash index 104c3ba5fb..c048717c62 100755 --- a/src/make.bash +++ b/src/make.bash @@ -106,6 +106,13 @@ if [ "$(uname -s)" == "GNU/kFreeBSD" ]; then export CGO_ENABLED=0 fi +# cgo is not generally supported on 1.4. +# Disable unless explicitly requested. +# See also https://github.com/Homebrew/homebrew-core/issues/18465. +if [ "$CGO_ENABLED" == "" ]; then + export CGO_ENABLED=0 +fi + # Clean old generated file that will cause problems in the build. rm -f ./runtime/runtime_defs.go diff --git a/src/make.bat b/src/make.bat index fff1eb6011..9ad34784f9 100644 --- a/src/make.bat +++ b/src/make.bat @@ -37,6 +37,12 @@ setlocal set GOBUILDFAIL=0 +:: cgo is not generally supported on 1.4. +:: Disable unless explicitly requested. +if not x%CGO_ENABLED%==x goto cgodone +set CGO_ENABLED=0 +:cgodone + if exist make.bat goto ok echo Must run make.bat from Go src directory. goto fail diff --git a/src/make.rc b/src/make.rc index 7a62d6af00..cf41991907 100755 --- a/src/make.rc +++ b/src/make.rc @@ -45,6 +45,11 @@ rm -f ./runtime/runtime_defs.go # Determine the host compiler toolchain. eval `{grep '^(CC|LD|O)=' /$objtype/mkfile} +# cgo is not generally supported on 1.4. +# Disable unless explicitly requested. +if(~ $CGO_ENABLED '') + CGO_ENABLED = 0 + echo '# Building C bootstrap tool.' echo cmd/dist GOROOT = `{cd .. && pwd}