Fix host gtests compiled with gcc
(cherry picked from commit d016e1fab648093706f85cc78b63da0f3f487733)
Change-Id: I5d2b8061278fd5a477ec87395fca435a3da801a3
diff --git a/build/Android.gtest.mk b/build/Android.gtest.mk
index 21c9e6e..62916e3 100644
--- a/build/Android.gtest.mk
+++ b/build/Android.gtest.mk
@@ -171,7 +171,11 @@
LOCAL_CLANG := $(ART_HOST_CLANG)
LOCAL_CFLAGS += $(ART_HOST_CFLAGS) $(ART_HOST_DEBUG_CFLAGS)
LOCAL_SHARED_LIBRARIES += libicuuc-host libicui18n-host libnativehelper libz-host
- LOCAL_STATIC_LIBRARIES += libcutils libgtest_host
+ LOCAL_STATIC_LIBRARIES += libcutils
+ ifneq ($(WITHOUT_HOST_CLANG),true)
+ # GCC host compiled tests fail with this linked, presumably due to destructors that run.
+ LOCAL_STATIC_LIBRARIES += libgtest_host
+ endif
include $(BUILD_HOST_EXECUTABLE)
art_gtest_exe := $(HOST_OUT_EXECUTABLES)/$$(LOCAL_MODULE)
ART_HOST_GTEST_EXECUTABLES += $$(art_gtest_exe)