为什么android ndk独立工具链不支持带有api 19的arm64但android ndk cmake支持 [英] why android ndk standalone toolchain do not support arm64 with api 19 but android ndk cmake does

查看:29
本文介绍了为什么android ndk独立工具链不支持带有api 19的arm64但android ndk cmake支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我曾经构建过 api 级别 19 的 arm64-v8a 库,使用 android.toolchain.cmake 与 Android NDK r16b 一样.

I used to build arm64-v8a lib of api level 19 use android.toolchain.cmake comes with Android NDK r16b like this.

${CMAKE} \
        -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE}                    \
        -DANDROID_NDK=$ANDROID_NDK_HOME                             \
        -DANDROID_ABI="arm64-v8a"                                   \
        -DANDROID_NATIVE_API_LEVEL="android-19"                     \
        -DANDROID_STL="c++_shared"                                  \
        -DANDROID_CPP_FEATURES="rtti exceptions"                    \
        ..

现在我想打包我的 lib 使用 conan 交叉编译 android lib 使用独立工具链.使用 --arch arm64--api 19 制作独立工具链似乎是不可能的,因为以下命令

Now i want to pack my lib use conan which cross compile android lib use standalone toolchain. Its seems to be impossible to make standalone toolchain with --arch arm64 and --api 19, since the following command

./make_standalone_toolchain.py --arch=arm64 --api=19 --stl=libc++ --install-dir=./test

将失败并显示错误消息:

will fail with error message:

19 小于 arm64 (21) 的最小平台

19 is less than minimum platform for arm64 (21)

有什么办法可以解决这个问题吗?

is there any way to fix this?

推荐答案

因为没有 API 19 ARM64 这样的东西.在 android-21 中添加了 64 位支持.

Because there's no such thing as API 19 ARM64. 64-bit support was added in android-21.

CMake 支持这一点,因为我们的工具链文件是根据当时常用的流行选项建模的,这就是它所做的.ndk-build 这样做是因为您在一次调用中构建了多个 ABI.在这两种情况下,构建都会自动将 64 位目标的 API 级别提升至 21.

CMake supports this because our toolchain file was modeled off of a popular option that was commonly used at the time and that's what it did. ndk-build does it because you build multiple ABIs in a single invocation. In both cases, the build automatically pulls the API level up to 21 for 64-bit targets.

独立工具链仅适用于一种架构,因此如果您指定该架构不支持的 API 级别,它们就会出错,因为这可能是一个错误.

Standalone toolchains are for exactly one architecture, so they give an error if you specify an API level that is not supported by that architecture since it was likely a mistake.

这篇关于为什么android ndk独立工具链不支持带有api 19的arm64但android ndk cmake支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆