簡體   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