简体   繁体   English

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

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

My host is a linux aarch64 machine on Android Galaxy Tab S4 with Termux installed as my development environment.我的主机是 Android Galaxy Tab S4 上的一台 linux aarch64 机器,安装了 Termux 作为我的开发环境。 Installed in Termux is NDK v22, Clang 12.0.2, Gradle 7.1.1, android-sdk (30.0.3) and kotlin 1.5.21. Termux 中安装的是 NDK v22、Clang 12.0.2、Gradle 7.1.1、android-sdk (30.0.3) 和 kotlin 1.5.21。

I init'ed a new c++ application project with gradle and the default template project-files and directories were initialized.我用 gradle 初始化了一个新的 c++ 应用程序项目,并初始化了默认模板项目文件和目录。

When I try to build now the project, I got following errors:当我现在尝试构建项目时,出现以下错误:


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

My use-cases will be, to build c++ libraries, later using kotlin/native and integrating as last task everything into an apk with the help of gradle/kotlin/ndk etc.我的用例是,构建 c++ 库,稍后使用 kotlin/native 并作为最后一个任务在 gradle/kotlin/ndk 等的帮助下将所有内容集成到 apk 中。

What does this error mean?这个错误是什么意思? Is there really no support for linux aarch64 hosts or do I need to change some configuration settings in the build.gradle file?真的不支持 linux aarch64 主机还是我需要更改 build.gradle 文件中的一些配置设置?

I searched the gradle documents, inte.net and kotlin/native manual but cannot found a solution.我搜索了 gradle 文档、inte.net 和 kotlin/native 手册,但找不到解决方案。

Thanks in advance for your help.在此先感谢您的帮助。

Is Clang found if you try to call it directly without gradle?没有gradle,直接调用是否能找到Clang? Please make sure that you can compile anything with Clang from command line.请确保您可以从命令行使用 Clang 编译任何内容。

Then you may need to fine tune your native tool chain for Gradle as described in https://docs.gradle.org/current/userguide/native_software.html#native_binaries:tool_chain然后,您可能需要微调 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