背景:
64位平台需要使用armv8版本编译so。
调试:
从armv7版本配置上修改CMAKE_ANDROID_ARCH_ABI
armeabi-v7a为arm64-v8a
报如下错误:
Make Error at /opt/cmake-3.8.1-Linux-x86_64/share/cmake-3.8/Modules/Platform/Android-Determine.cmake:287 (message):
Android: CMAKE_ANDROID_ARM_NEON is set but is valid only for 'armeabi-v7a'
architecture.
Call Stack (most recent call first):
/opt/cmake-3.8.1-Linux-x86_64/share/cmake-3.8/Modules/CMakeDetermineSystem.cmake:124 (include)
CMakeLists.txt:3 (project)
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
make: *** No targets specified and no makefile found. Stop.
CMAKE_ANDROID_ARM_NEON是配合armv7做的设置,见官网说明:
移除CMAKE_ANDROID_ARM_NEON设置,编译成功。
最终配置:
android.toolchain.camke如下:
set(CMAKE_SYSTEM_NAME Android)
set(CMAKE_SYSTEM_VERSION 23)
set(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION clang)
set(CMAKE_ANDROID_ARCH_ABI arm64-v8a)
#set(CMAKE_ANDROID_ARM_NEON ON)
set(CMAKE_ANDROID_NDK /opt/android-ndk-r14b)
set(CMAKE_ANDROID_STL_TYPE gnustl_static)
原作者:KrisFei
|