无效的 NDK – 使用 Conan 管理器交叉编译 Android

huangapple go评论54阅读模式
英文:

Invalid NDK - cross compile for Android using Conan manager

问题

我正在尝试在Windows主机上为Android安装Conan项目。

我为此创建了一个新的配置文件。

其内容如下:

[settings]
os=Android
os.api_level=23
os_build=Windows
arch_build=x86_64
arch=armv8
compiler=clang
compiler.libcxx=libc++
compiler.version=9

build_type=Release

[options]
[build_requires]
*: android-ndk/r23, cmake/3.19.0, ninja/1.10.1
[env]

不幸的是,调用以下命令的结果
conan install .. --build=missing --profile android-arm64-v8a
是一个错误:

跨平台从'Windows:x86_64'到'Android:armv8'
正在安装(下载、构建)二进制文件...
错误:存在无效的软件包(此配置下无法存在的软件包):
android-ndk/r23:无效的ID:os=Android不受android-ndk支持(没有可用的二进制文件)
android-ndk/r23:无效的ID:os=Android不受android-ndk支持(没有可用的二进制文件)
android-ndk/r23:无效的ID:os=Android不受android-ndk支持(没有可用的二进制文件)
android-ndk/r23:无效的ID:os=Android不受android-ndk支持(没有可用的二进制文件)
android-ndk/r23:无效的ID:os=Android不受android-ndk支持(没有可用的二进制文件)
android-ndk/r23:无效的ID:os=Android不受android-ndk支持(没有可用的二进制文件)
android-ndk/r23:无效的ID:os=Android不受android-ndk支持(没有可用的二进制文件)
android-ndk/r23:无效的ID:os=Android不受android-ndk支持(没有可用的二进制文件)

我做错了什么?如何修复它?

英文:

I'm trying to install a Conan project for Android on a Windows host.

I created a new profile for this purpose.

Its contents:

[settings]
os=Android
os.api_level=23
os_build=Windows
arch_build=x86_64
arch=armv8
compiler=clang
compiler.libcxx=libc++
compiler.version=9

build_type=Release

[options]
[build_requires]
*: android-ndk/r23, cmake/3.19.0, ninja/1.10.1
[env]

Unfortunately, the result of invoking the command
conan install .. --build=missing --profile android-arm64-v8a
is an error:

Cross-build from 'Windows:x86_64' to 'Android:armv8'
Installing (downloading, building) binaries...
ERROR: There are invalid packages (packages that cannot exist for this configuration):
android-ndk/r23: Invalid ID: os=Android is not supported by android-ndk (no binaries are available)
android-ndk/r23: Invalid ID: os=Android is not supported by android-ndk (no binaries are available)
android-ndk/r23: Invalid ID: os=Android is not supported by android-ndk (no binaries are available)
android-ndk/r23: Invalid ID: os=Android is not supported by android-ndk (no binaries are available)
android-ndk/r23: Invalid ID: os=Android is not supported by android-ndk (no binaries are available)
android-ndk/r23: Invalid ID: os=Android is not supported by android-ndk (no binaries are available)
android-ndk/r23: Invalid ID: os=Android is not supported by android-ndk (no binaries are available)
android-ndk/r23: Invalid ID: os=Android is not supported by android-ndk (no binaries are available)

What am I doing wrong? How to fix it?

答案1

得分: 1

看起来你仍在使用传统的交叉构建方法。但很可能ConanCenter中的大多数配方是为新的交叉构建方法准备的,该方法包括使用两个配置文件:

  • "build"配置文件,包含用于当前构建机器的设置和选项,即正在编译的机器
  • "host"配置文件,包含用于运行正在编译代码的机器的设置和选项

如果你从Windows机器构建Android,那么"build"配置文件将是Windows配置文件,而"host"配置文件将是Android配置文件。

尝试从你的配置文件中移除os_buildarch_build,使用两个配置文件,并在命令行中同时传递--profile:build default(或Windows配置文件)和--profile:host=android

英文:

It seems you are still using the legacy cross-build method.
But it is probable that most of the recipes in ConanCenter are prepared for the new cross-build method that consist of having 2 profiles:

  • The "build" profile, with settings and options for the current build machine, the machine that is compiling
  • The "host" profile, with settings and options for the machine that will run the code being compiled.

If you are building for Android from a Windows machine, the "build" profile will be the Windows one, and the "host" one will be the Android one

Try removing os_build, arch_build from your profile, and use 2 profiles, passing in command line both the --profile:build default (or Windows profile) and --profile:host=android

huangapple
  • 本文由 发表于 2023年2月6日 03:16:00
  • 转载请务必保留本文链接:https://go.coder-hub.com/75354859.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定