shithub: openh264

Download patch

ref: a1e01544b34df4283f01b42b010a20925925aea2
parent: 1896ed23ad12b652cbd1baa4879428a4630f74f7
parent: 5a9ee4e4cfc58225a56e7a21ee31f05a78dabb76
author: huili2 <[email protected]>
date: Wed Feb 26 09:51:23 EST 2020

Merge pull request #3241 from GuangweiWang/fix-android-ub-build-issue

fix ut build issue for android

--- a/build/platform-android.mk
+++ b/build/platform-android.mk
@@ -49,6 +49,7 @@
 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 @@
 
   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
 
+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)
--- 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