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 vs2019中数据导出问题
  • ¥20 云服务Linux系统TCP-MSS值修改?
  • ¥20 关于#单片机#的问题:项目:使用模拟iic与ov2640通讯环境:F407问题:读取的ID号总是0xff,自己调了调发现在读从机数据时,SDA线上并未有信号变化(语言-c语言)
  • ¥20 怎么在stm32门禁成品上增加查询记录功能
  • ¥15 Source insight编写代码后使用CCS5.2版本import之后,代码跳到注释行里面
  • ¥50 NT4.0系统 STOP:0X0000007B
  • ¥15 想问一下stata17中这段代码哪里有问题呀
  • ¥15 flink cdc无法实时同步mysql数据
  • ¥100 有人会搭建GPT-J-6B框架吗?有偿