fatal error: 'asm/types.h' file not found
用cmake+ndk的时候遇到一个错误:
fatal error: 'asm/types.h' file not found
用的是ndk自带的 build/cmake/android.toolchain.cmake
。
看现象是include路径没包含进来。
解决方案,修改 build/cmake/android.toolchain.cmake
,增加:
if (${ANDROID_ABI} STREQUAL "x86_64")
include_directories(${ANDROID_SYSROOT}/usr/include/x86_64-linux-android)
elseif (${ANDROID_ABI} STREQUAL "x86")
include_directories(${ANDROID_SYSROOT}/usr/include/i686-linux-android)
elseif (${ANDROID_ABI} STREQUAL "arm64-v8a")
include_directories(${ANDROID_SYSROOT}/usr/include/aarch64-linux-android)
elseif (${ANDROID_ABI} STREQUAL "armeabi-v7a")
include_directories(${ANDROID_SYSROOT}/usr/include/arm-linux-androideabi)
endif()
搞定。