为什么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

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

问题描述

我以前使用android NDK r16b附带的 android.toolchain.cmake 来构建API级别19的arm64-v8a库。

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 使用独立工具链。用-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)

有什么办法可以解决

推荐答案

因为没有诸如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天全站免登陆