From 94221a06124fe0d0f7ed45a355c72e46ed0e891b Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Mon, 16 Jul 2018 11:02:01 -0700 Subject: [PATCH] [release-branch.go1.4] make.bash: set CGO_ENABLED=0 cgo is not supported with 1.4. In addition to (perhaps instead of) documenting it, just enforce it in make.*. Updates Homebrew/homebrew-core#18465 Change-Id: Iefb1860890d9ec525597b6d730e2189110818598 Reviewed-on: https://go-review.googlesource.com/124076 Reviewed-by: Brad Fitzpatrick Reviewed-by: Ian Lance Taylor Run-TryBot: Brad Fitzpatrick --- src/make.bash | 7 +++++++ src/make.bat | 6 ++++++ src/make.rc | 5 +++++ 3 files changed, 18 insertions(+) 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}