From 84caaef55c42ab65f8c788210170ef395e17e900 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Fri, 19 Jan 2024 19:32:54 +0000 Subject: [PATCH] Don't set CC and CXX when running go build on mac Setting CC and CXX to point to our clang prebuilts on mac fails to build with: _cgo_export.c:3:10: fatal error: 'stdlib.h' file not found Skip setting CC and CXX on mac to go back to using the host linker. Change-Id: I9bab4cda961874c381eacc34397cc67f62fd4730 Test: treehugger --- scripts/run-soong-tests-with-go-tools.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/scripts/run-soong-tests-with-go-tools.sh b/scripts/run-soong-tests-with-go-tools.sh index 9b7d8aaa9..93c622ea4 100755 --- a/scripts/run-soong-tests-with-go-tools.sh +++ b/scripts/run-soong-tests-with-go-tools.sh @@ -32,11 +32,13 @@ export TMPDIR=${abs_out_dir}/gotemp mkdir -p ${TMPDIR} ${GOROOT}/bin/go env -# Building with the race detector enabled uses the host linker, set the -# path to use the hermetic one. -CLANG_VERSION=$(build/soong/scripts/get_clang_version.py) -export CC="${TOP}/prebuilts/clang/host/${OS}-x86/${CLANG_VERSION}/bin/clang" -export CXX="${TOP}/prebuilts/clang/host/${OS}-x86/${CLANG_VERSION}/bin/clang++" +if [[ ${OS} = linux ]]; then + # Building with the race detector enabled uses the host linker, set the + # path to use the hermetic one. + CLANG_VERSION=$(build/soong/scripts/get_clang_version.py) + export CC="${TOP}/prebuilts/clang/host/${OS}-x86/${CLANG_VERSION}/bin/clang" + export CXX="${TOP}/prebuilts/clang/host/${OS}-x86/${CLANG_VERSION}/bin/clang++" +fi # androidmk_test.go gets confused if ANDROID_BUILD_TOP is set. unset ANDROID_BUILD_TOP