pw_build: Disable CGo on MacOS This tells the Go compiler to build without the C standard library on MacOS due to issues with include paths in certain environments. Change-Id: I33cba8abeb32350af58347afc7c768cc18a31a3d Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/45443 Pigweed-Auto-Submit: Alexei Frolov <frolv@google.com> Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com> Reviewed-by: Joe Ethier <jethier@google.com>
diff --git a/pw_build/go.gni b/pw_build/go.gni index 3434883..49230f2 100644 --- a/pw_build/go.gni +++ b/pw_build/go.gni
@@ -126,6 +126,14 @@ "GO111MODULE=off", "GOPATH=$_default_gopath", ] + + if (host_os == "mac") { + # TODO(frolv): Some versions of Go for MacOS have issues finding the C + # stdlib headers. Temporarily disable CGo on Mac. The root cause of this + # issue should be investigated and fixed. + env += [ "CGO_ENABLED=0" ] + } + args_file = _deps_metadata_file # If the args file is empty, don't run the "go get" command. @@ -152,6 +160,14 @@ "GO111MODULE=off", "GOPATH+=$_default_gopath", ] + + if (host_os == "mac") { + # TODO(frolv): Some versions of Go for MacOS have issues finding the C + # stdlib headers. Temporarily disable CGo on Mac. The root cause of this + # issue should be investigated and fixed. + env += [ "CGO_ENABLED=0" ] + } + env_file = _metadata_file _binary_name = get_path_info(invoker.package, "name")