diff --git a/build/platform-android.mk b/build/platform-android.mk index 6f6ce34751..5cebcb05e7 100644 --- a/build/platform-android.mk +++ b/build/platform-android.mk @@ -49,6 +49,7 @@ CFLAGS += -isystem $(NDKROOT)/sysroot/usr/include -isystem $(NDKROOT)/sysroot/us CXXFLAGS += -fno-rtti -fno-exceptions LDFLAGS += --sysroot=$(SYSROOT) SHLDFLAGS = -Wl,--no-undefined -Wl,-z,relro -Wl,-z,now -Wl,-soname,lib$(PROJECT_NAME).so +UTSHLDFLAGS = -Wl,-soname,libut.so ifeq ($(NDK_TOOLCHAIN_VERSION), clang) HOST_OS = $(shell uname -s | tr [A-Z] [a-z]) @@ -70,9 +71,11 @@ ifeq ($(NDK_TOOLCHAIN_VERSION), clang) CFLAGS += -target $(TARGET_NAME) LDFLAGS += -target $(TARGET_NAME) -gcc-toolchain $(GCC_TOOLCHAIN_PATH) - LDFLAGS += -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libunwind.a endif +# background reading: https://android.googlesource.com/platform/ndk/+/master/docs/BuildSystemMaintainers.md#unwinding +LDFLAGS += -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libunwind.a + ifneq ($(findstring /,$(CXX)),$(findstring \,$(CXX))) ifneq ($(CXX),$(wildcard $(CXX))) ifneq ($(CXX).exe,$(wildcard $(CXX).exe)) @@ -81,10 +84,18 @@ endif endif endif +ifeq ($(NDK_TOOLCHAIN_VERSION), clang) +STL_INCLUDES = \ + -I$(NDKROOT)/sources/cxx-stl/llvm-libc++/include \ + -I$(NDKROOT)/sources/cxx-stl/llvm-libc++abi/include +STL_LIB = \ + $(NDKROOT)/sources/cxx-stl/llvm-libc++/libs/$(APP_ABI)/libc++_static.a +else STL_INCLUDES = \ -I$(NDKROOT)/sources/cxx-stl/stlport/stlport STL_LIB = \ $(NDKROOT)/sources/cxx-stl/stlport/libs/$(APP_ABI)/libstlport_static.a +endif GTEST_INCLUDES = $(STL_INCLUDES) CODEC_UNITTEST_INCLUDES = $(STL_INCLUDES) diff --git a/test/build/android/jni/Application.mk b/test/build/android/jni/Application.mk index 48ca94b650..175295f48a 100644 --- a/test/build/android/jni/Application.mk +++ b/test/build/android/jni/Application.mk @@ -1,2 +1,6 @@ +ifeq ($(NDK_TOOLCHAIN_VERSION), clang) +APP_STL := c++_shared +else APP_STL := stlport_shared +endif APP_PLATFORM := android-12