gpt4 book ai didi

android - 在 linux 中的 android studio 中构建 cpp 项目时出错

转载 作者:搜寻专家 更新时间:2023-11-01 09:39:29 24 4
gpt4 key购买 nike

我在我的 ArchLinux 中安装了 android sdk、平台和构建工具以及 NDK,以使用 android-studio 和 c++ 进行开发。我创建了一个简单的“hello world 程序”只是为了开始,但它没有编译。 android studio 返回的构建错误消息是“配置项目‘:app’时出现问题。为 cmake/home/fabio/AndroidStudioProjects/HelloWorld/app/CMakeLists.txt 执行外部本地构建”

关于CMakeError.log:

Determining if the C compiler works failed with the following output: Change Dir: /home/fabio/AndroidStudioProjects/HelloWorld/app/.externalNativeBuild/cmake/debug/armeabi/CMakeFiles/CMakeTmp

Run Build Command:"/opt/android-sdk/cmake/3.6.3155560/bin/ninja" "cmTC_be251"

[1/2] Building C object CMakeFiles/cmTC_be251.dir/testCCompiler.c.o FAILED: /opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -target armv5te-none-linux-androideabi -gcc-toolchain /opt/android-ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 --sysroot=/opt/android-ndk/platforms/android-15/arch-arm -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -march=armv5te -mtune=xscale -msoft-float -fno-integrated-as -mthumb -Wa,--noexecstack -Wformat -Werror=format-security -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -march=armv5te -mtune=xscale -msoft-float -fno-integrated-as -mthumb -Wa,--noexecstack -Wformat -Werror=format-security -o CMakeFiles/cmTC_be251.dir/testCCompiler.c.o -c /home/fabio/AndroidStudioProjects/HelloWorld/app/.externalNativeBuild/cmake/debug/armeabi/CMakeFiles/CMakeTmp/testCCompiler.c

/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
ninja: build stopped: subcommand failed.

为了创建项目,我只是选中了选项“Include c++ support”并从一个空白 Activity 开始,然后没有更改任何代码。

编辑
按照this中的建议尝试安装libtinfo线程但没有工作。

最佳答案

我遇到了同样的问题。相当多的其他发行版通常都有过时的软件包。他们仍然使用 ncurses 5 而不是 ncurses 6(libtinfo 似乎属于 ncurses)。假设,android ndk 的 clang 版本是在这样的系统上构建的,那么值得尝试使用 ncurses 5。来自 Arch User R epositories 我能够安装最新版本的 ncurses5-compat-libs (我还安装了 32 位版本:lib32-ncurses5-compat-libs)。这为我解决了问题。如果您已经安装了它,如果它已过时,请尝试重新安装或更新它。

关于android - 在 linux 中的 android studio 中构建 cpp 项目时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40696961/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com