From 5659b31e94cb50c0ec6a5c117faf60395afdcba0 Mon Sep 17 00:00:00 2001 From: Alex Zolotarev Date: Fri, 1 Apr 2016 18:58:58 +0300 Subject: [PATCH 1/2] [android] Upgrade to NDK r11b. --- android/jni/Application.mk | 2 +- tools/mkspecs/android-clang/qmake.conf | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/android/jni/Application.mk b/android/jni/Application.mk index 3cfe2d9e97..6b77f7f8e9 100644 --- a/android/jni/Application.mk +++ b/android/jni/Application.mk @@ -1,4 +1,4 @@ -NDK_TOOLCHAIN_VERSION := clang3.6 +NDK_TOOLCHAIN_VERSION := clang APP_PLATFORM := android-15 APP_STL := c++_static diff --git a/tools/mkspecs/android-clang/qmake.conf b/tools/mkspecs/android-clang/qmake.conf index fc1772b978..6c498513b6 100644 --- a/tools/mkspecs/android-clang/qmake.conf +++ b/tools/mkspecs/android-clang/qmake.conf @@ -1,23 +1,22 @@ -# NDK_ROOT should be defined for qmake -# NDK_HOST should be defined for qmake -# NDK_ABI optionally can be defined to armeabi, armeabi-v7a, mips or x86, by default armeabi will be used +# NDK_ROOT should be defined for qmake. +# NDK_HOST should be defined for qmake. +# NDK_ABI optionally can be defined to any abi supported by NDK. ######################################################################### ANDROID_TARGET_ABI = $$(NDK_ABI) -# by default use armv7 architecture -isEmpty( ANDROID_TARGET_ABI ): ANDROID_TARGET_ABI = armeabi-v7a +# By default use armv7 architecture with hardware math co-processor. +isEmpty( ANDROID_TARGET_ABI ): ANDROID_TARGET_ABI = armeabi-v7a-hard -# Minimum supported platform is Android 4.0.3 +# Minimum supported platform is Android 4.0.3. ANDROID_PLATFORM = android-15 -GCC_VERSION = 4.8 -CLANG_VERSION = 3.6 +GCC_VERSION = 4.9 MAKEFILE_GENERATOR = UNIX -QMAKE_COMPILER = $$(NDK_ROOT)/toolchains/llvm-$$CLANG_VERSION/prebuilt/$$(NDK_HOST)/bin/clang +QMAKE_COMPILER = $$(NDK_ROOT)/toolchains/llvm/prebuilt/$$(NDK_HOST)/bin/clang QMAKE_CC = $$QMAKE_COMPILER -QMAKE_CXX = $$(NDK_ROOT)/toolchains/llvm-$$CLANG_VERSION/prebuilt/$$(NDK_HOST)/bin/clang++ +QMAKE_CXX = $$(NDK_ROOT)/toolchains/llvm/prebuilt/$$(NDK_HOST)/bin/clang++ QMAKE_LINK_C = $$QMAKE_CC QMAKE_LINK_C_SHLIB = $$QMAKE_CC QMAKE_LINK = $$QMAKE_CXX From c3fed03c06574e98355506fb8faef2062d1c6866 Mon Sep 17 00:00:00 2001 From: Alex Zolotarev Date: Fri, 1 Apr 2016 18:59:28 +0300 Subject: [PATCH 2/2] [android] Removed workaround for x86 crashes which was fixed in NDK r11b. --- android/build.gradle | 5 ----- android/jni/Application.mk | 7 ------- tools/android/cxxabi.cc_patch | 15 --------------- 3 files changed, 27 deletions(-) delete mode 100644 tools/android/cxxabi.cc_patch diff --git a/android/build.gradle b/android/build.gradle index 1c9a1deb03..8c64809fdf 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -419,8 +419,3 @@ task obbPush(dependsOn: ['obbGenerate', 'obbPushMain', 'obbPushPatch']) { commandLine android.getAdbExe(), 'push', propObbWorldsOutput, "${obbPath}worlds.obb" } } - -task patchNdkR10E(type: Exec, description: 'Patches NDK r10e for bug described here https://code.google.com/p/android/issues/detail?id=179410') { - def cxxabiPath = "${android.getNdkDirectory().getAbsolutePath()}/sources/cxx-stl/gabi++/src/cxxabi.cc" - commandLine 'bash', '-c', "patch -p1 ${cxxabiPath} < ../tools/android/cxxabi.cc_patch" -} diff --git a/android/jni/Application.mk b/android/jni/Application.mk index 6b77f7f8e9..b4b8057648 100644 --- a/android/jni/Application.mk +++ b/android/jni/Application.mk @@ -28,12 +28,5 @@ else APP_CFLAGS += -DRELEASE -D_RELEASE ifeq ($(PRODUCTION),1) APP_CFLAGS += -DOMIM_PRODUCTION - # Temporary workaround for crashes on x86 arch when throwing C++ exceptions, built with NDK r10e version. - # Requires patched NDK file "android-ndk-r10e/sources/cxx-stl/gabi++/src/cxxabi.cc" file, - # Patch can be found at "../tools/android/cxxabi.cc_patch". - # Gradle task patchNdkR10E will patch it for you. - # More details here: https://code.google.com/p/android/issues/detail?id=179410. - # TODO: Check if this workaround is needed in newer NDK versions. - LIBCXX_FORCE_REBUILD := true endif endif diff --git a/tools/android/cxxabi.cc_patch b/tools/android/cxxabi.cc_patch deleted file mode 100644 index 79412c529e..0000000000 --- a/tools/android/cxxabi.cc_patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/Users/yunik/devtools/android-sdk/ndk-bundle/sources/cxx-stl/gabi++/src/cxxabi.cc b/android/../tools/android/cxxabi.cc -index 3f428d9..9c0e8bc 100644 ---- a/Users/yunik/devtools/android-sdk/ndk-bundle/sources/cxx-stl/gabi++/src/cxxabi.cc -+++ b/android/../tools/android/cxxabi.cc -@@ -296,7 +296,9 @@ namespace __cxxabiv1 { - - extern "C" void *__cxa_allocate_exception(size_t thrown_size) _GABIXX_NOEXCEPT { - size_t size = thrown_size + sizeof(__cxa_exception); -- __cxa_exception *buffer = static_cast<__cxa_exception*>(malloc(size)); -+ // Bugfix for crashes appearing on stack unwinding, taken from https://android-review.googlesource.com/#/c/182443/ -+ //__cxa_exception *buffer = static_cast<__cxa_exception*>(malloc(size)); -+ __cxa_exception *buffer = static_cast<__cxa_exception*>(memalign(__alignof__(__cxa_exception), size)); - if (!buffer) { - // Since Android uses memory-overcommit, we enter here only when - // the exception object is VERY large. This will propably never happen.