shihchieh_ma 2017-10-28 05:13 采纳率: 100%
浏览 1328
已采纳

IncludeC++Support项目直接报错

最近在把开发环境往Linux上整,有些操作比较方便,但是我发现我在Androidstudio创建项目时如果把Include C++ Support选项勾上的话,创建出来的项目直接就是错的,百度了半天也没解决,ndk卸载安装好几次了,也试了ndk-r12,ndk-r13,还是不行,求帮助啊,折腾的不要不要的。错误如下:

External Native Build Issues
Build command failed.
Error while executing process /home/majes/Android/Sdk/cmake/3.6.4111459/bin/cmake with arguments {-H/home/majes/AndroidStudioProjects/MyApplication2/app -B/home/majes/AndroidStudioProjects/MyApplication2/app/.externalNativeBuild/cmake/release/armeabi -DANDROID_ABI=armeabi -DANDROID_PLATFORM=android-15 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/home/majes/AndroidStudioProjects/MyApplication2/app/build/intermediates/cmake/release/obj/armeabi -DCMAKE_BUILD_TYPE=Release -DANDROID_NDK=/home/majes/Android/Sdk/ndk-bundle -DCMAKE_CXX_FLAGS= -DCMAKE_TOOLCHAIN_FILE=/home/majes/Android/Sdk/ndk-bundle/build/cmake/android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=/home/majes/Android/Sdk/cmake/3.6.4111459/bin/ninja -GAndroid Gradle - Ninja}
-- Check for working C compiler: /home/majes/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
-- Check for working C compiler: /home/majes/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -- broken
It fails with the following output:
Change Dir: /home/majes/AndroidStudioProjects/MyApplication2/app/.externalNativeBuild/cmake/release/armeabi/CMakeFiles/CMakeTmp
Run Build Command:"/home/majes/Android/Sdk/cmake/3.6.4111459/bin/ninja"
"cmTC_af686"
[1/2] Building C object CMakeFiles/cmTC_af686.dir/testCCompiler.c.o
FAILED:
/home/majes/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
--target=armv5te-none-linux-androideabi
--gcc-toolchain=/home/majes/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64
--sysroot=/home/majes/Android/Sdk/ndk-bundle/sysroot -isystem
/home/majes/Android/Sdk/ndk-bundle/sysroot/usr/include/arm-linux-androideabi
-D__ANDROID_API__=15 -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_af686.dir/testCCompiler.c.o -c
/home/majes/AndroidStudioProjects/MyApplication2/app/.externalNativeBuild/cmake/release/armeabi/CMakeFiles/CMakeTmp/testCCompiler.c
/home/majes/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang:
error while loading shared libraries: libncurses.so.5: cannot open shared
object file: No such file or directory
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt
-- Configuring incomplete, errors occurred!
See also "/home/majes/AndroidStudioProjects/MyApplication2/app/.externalNativeBuild/cmake/release/armeabi/CMakeFiles/CMakeOutput.log".
See also "/home/majes/AndroidStudioProjects/MyApplication2/app/.externalNativeBuild/cmake/release/armeabi/CMakeFiles/CMakeError.log".
Build command failed.
Error while executing process /home/majes/Android/Sdk/cmake/3.6.4111459/bin/cmake with arguments {-H/home/majes/AndroidStudioProjects/MyApplication2/app -B/home/majes/AndroidStudioProjects/MyApplication2/app/.externalNativeBuild/cmake/debug/armeabi -DANDROID_ABI=armeabi -DANDROID_PLATFORM=android-15 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/home/majes/AndroidStudioProjects/MyApplication2/app/build/intermediates/cmake/debug/obj/armeabi -DCMAKE_BUILD_TYPE=Debug -DANDROID_NDK=/home/majes/Android/Sdk/ndk-bundle -DCMAKE_CXX_FLAGS= -DCMAKE_TOOLCHAIN_FILE=/home/majes/Android/Sdk/ndk-bundle/build/cmake/android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=/home/majes/Android/Sdk/cmake/3.6.4111459/bin/ninja -GAndroid Gradle - Ninja}
-- Check for working C compiler: /home/majes/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
-- Check for working C compiler: /home/majes/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -- broken
It fails with the following output:
Change Dir: /home/majes/AndroidStudioProjects/MyApplication2/app/.externalNativeBuild/cmake/debug/armeabi/CMakeFiles/CMakeTmp
Run Build Command:"/home/majes/Android/Sdk/cmake/3.6.4111459/bin/ninja"
"cmTC_2e591"
[1/2] Building C object CMakeFiles/cmTC_2e591.dir/testCCompiler.c.o
FAILED:
/home/majes/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
--target=armv5te-none-linux-androideabi
--gcc-toolchain=/home/majes/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64
--sysroot=/home/majes/Android/Sdk/ndk-bundle/sysroot -isystem
/home/majes/Android/Sdk/ndk-bundle/sysroot/usr/include/arm-linux-androideabi
-D__ANDROID_API__=15 -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_2e591.dir/testCCompiler.c.o -c
/home/majes/AndroidStudioProjects/MyApplication2/app/.externalNativeBuild/cmake/debug/armeabi/CMakeFiles/CMakeTmp/testCCompiler.c
/home/majes/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang:
error while loading shared libraries: libncurses.so.5: cannot open shared
object file: No such file or directory
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt
-- Configuring incomplete, errors occurred!
See also "/home/majes/AndroidStudioProjects/MyApplication2/app/.externalNativeBuild/cmake/debug/armeabi/CMakeFiles/CMakeOutput.log".
See also "/home/majes/AndroidStudioProjects/MyApplication2/app/.externalNativeBuild/cmake/debug/armeabi/CMakeFiles/CMakeError.log".
/home/majes/Android/Sdk/cmake/3.6.4111459/share/cmake-3.6/Modules/CMakeTestCCompiler.cmake

Error:(61, 0) The C compiler "/home/majes/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang" is not able to compile a simple test program.

Error:(61, 0) The C compiler "/home/majes/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang" is not able to compile a simple test program.

  • 写回答

2条回答

  • qq_39163659 2017-10-29 00:34
    关注

    用Linux玩as需要修改环境变量的,不知道你改了没,看你的报错很有可能没改,可以去搜一下Linux装as教程,里面会教怎么改环境变量。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题