繁体   English   中英

在主机 linux aarch64 上使用 gradle 构建一个 c++ 应用程序

[英]Building a c++ application with gradle on host linux aarch64

我的主机是 Android Galaxy Tab S4 上的一台 linux aarch64 机器,安装了 Termux 作为我的开发环境。 Termux 中安装的是 NDK v22、Clang 12.0.2、Gradle 7.1.1、android-sdk (30.0.3) 和 kotlin 1.5.21。

我用 gradle 初始化了一个新的 c++ 应用程序项目,并初始化了默认模板项目文件和目录。

当我现在尝试构建项目时,出现以下错误:


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugCpp'.
> Error while evaluating property 'compilerVersion' of task ':app:compileDebugCpp'
   > No tool chain is available to build C++ for host operating system 'Linux' architecture 'aarch64':
       - Tool chain 'visualCpp' (Visual Studio):
           - Visual Studio is not available on this operating system.
       - Tool chain 'gcc' (GNU GCC):
           - Don't know how to build for host operating system 'Linux' architecture 'aarch64'.
       - Tool chain 'clang' (Clang):
           - Don't know how to build for host operating system 'Linux' architecture 'aarch64'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 3s
1 actionable task: 1 executed

我的用例是,构建 c++ 库,稍后使用 kotlin/native 并作为最后一个任务在 gradle/kotlin/ndk 等的帮助下将所有内容集成到 apk 中。

这个错误是什么意思? 真的不支持 linux aarch64 主机还是我需要更改 build.gradle 文件中的一些配置设置?

我搜索了 gradle 文档、inte.net 和 kotlin/native 手册,但找不到解决方案。

在此先感谢您的帮助。

没有gradle,直接调用是否能找到Clang? 请确保您可以从命令行使用 Clang 编译任何内容。

然后,您可能需要微调 Gradle 的本机工具链,如https://docs.gradle.org/current/userguide/native_software.html#native_binaries:tool_chain中所述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM