如何使用Cmake和Android-NDK修复“ C ++编译器无法编译简单的tst程序”

时间:2019-01-02 17:03:00

标签: cmake android-ndk clang clang++

当尝试使用Cmake和Android NDK编译项目时,它表示以下内容: C ++ Comnpiler“ / opt / android-ndk / toolchains / llvm / prebuilt / linux-x86_64 / bin / clang ++”无法编译简单的测试程序。

我正在使用Cmake 3.8和Android NDK r18。 在CMakelists中,CXX编译器设置为g ++,所以我不知道为什么要使用clang ++。

CMake将无法正确生成此项目。 呼叫堆栈(最近的呼叫优先):   CMakeLists.txt:9(项目)

-检查工作的CXX编译器:/ opt / android-ndk / toolchains / llvm / prebuilt / linux-x86_64 / bin / clang ++-损坏 在/usr/share/cmake/Modules/CMakeTestCXXCompiler.cmake处的CMake错误:45(消息):   C ++编译器

"/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++"

无法编译简单的测试程序。

它失败,显示以下输出:

    Change Dir: /builder/DualBootPatcher/builder/android/android-app_arm64-v8a-prefix/src/android-app_arm64-v8a-build/CMakeFiles/CMakeTmp

    Run Build Command:"/usr/bin/gmake" "cmTC_48d2d/fast"
    gmake[3]: Entering directory '/builder/DualBootPatcher/builder/android/android-app_arm64-v8a-prefix/src/android-app_arm64-v8a-build/CMakeFiles/CMakeTmp'
    /usr/bin/gmake -f CMakeFiles/cmTC_48d2d.dir/build.make CMakeFiles/cmTC_48d2d.dir/build
    gmake[4]: Entering directory '/builder/DualBootPatcher/builder/android/android-app_arm64-v8a-prefix/src/android-app_arm64-v8a-build/CMakeFiles/CMakeTmp'
    Building CXX object CMakeFiles/cmTC_48d2d.dir/testCXXCompiler.cxx.o
    /usr/bin/ccache /opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --sysroot=/opt/android-ndk/sysroot   -isystem /opt/android-ndk/sources/cxx-stl/llvm-libc++/include -isystem /opt/android-ndk/sources/cxx-stl/llvm-libc++abi/include  -isystem /opt/android-ndk/sysroot/usr/include/aarch64-linux-android -target aarch64-none-linux-android21 -gcc-toolchain /opt/android-ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -Wa,--noexecstack -Wformat -Werror=format-security -std=c++11   -fPIE   -o CMakeFiles/cmTC_48d2d.dir/testCXXCompiler.cxx.o -c /builder/DualBootPatcher/builder/android/android-app_arm64-v8a-prefix/src/android-app_arm64-v8a-build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
    ccache: error: Failed to create directory /builder/.ccache/tmp: Permission denied
    gmake[4]: *** [CMakeFiles/cmTC_48d2d.dir/build.make:66: CMakeFiles/cmTC_48d2d.dir/testCXXCompiler.cxx.o] Error 1
    gmake[4]: Leaving directory '/builder/DualBootPatcher/builder/android/android-app_arm64-v8a-prefix/src/android-app_arm64-v8a-build/CMakeFiles/CMakeTmp'
    gmake[3]: *** [Makefile:126: cmTC_48d2d/fast] Error 2
    gmake[3]: Leaving directory '/builder/DualBootPatcher/builder/android/android-app_arm64-v8a-prefix/src/android-app_arm64-v8a-build/CMakeFiles/CMakeTmp'




  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:9 (project)


-- Configuring incomplete, errors occurred!
See also "/builder/DualBootPatcher/builder/android/android-system_armeabi-v7a-prefix/src/android-system_armeabi-v7a-build/CMakeFiles/CMakeOutput.log".
See also "/builder/DualBootPatcher/builder/android/android-system_armeabi-v7a-prefix/src/android-system_armeabi-v7a-build/CMakeFiles/CMakeError.log".
-- Configuring incomplete, errors occurred!
See also "/builder/DualBootPatcher/builder/android/android-app_armeabi-v7a-prefix/src/android-app_armeabi-v7a-build/CMakeFiles/CMakeOutput.log".
See also "/builder/DualBootPatcher/builder/android/android-app_armeabi-v7a-prefix/src/android-app_armeabi-v7a-build/CMakeFiles/CMakeError.log".
-- Configuring incomplete, errors occurred!
See also "/builder/DualBootPatcher/builder/android/android-app_arm64-v8a-prefix/src/android-app_arm64-v8a-build/CMakeFiles/CMakeOutput.log".
See also "/builder/DualBootPatcher/builder/android/android-app_arm64-v8a-prefix/src/android-app_arm64-v8a-build/CMakeFiles/CMakeError.log".
make[2]: *** [android/CMakeFiles/android-app_armeabi-v7a.dir/build.make:106: android/android-app_armeabi-v7a-prefix/src/android-app_armeabi-v7a-stamp/android-app_armeabi-v7a-configure] Error 1
make[2]: *** [android/CMakeFiles/android-system_armeabi-v7a.dir/build.make:106: android/android-system_armeabi-v7a-prefix/src/android-system_armeabi-v7a-stamp/android-system_armeabi-v7a-configure] Error 1
make[1]: *** [CMakeFiles/Makefile2:1098: android/CMakeFiles/android-app_armeabi-v7a.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:1396: android/CMakeFiles/android-system_armeabi-v7a.dir/all] Error 2
make[2]: *** [android/CMakeFiles/android-app_arm64-v8a.dir/build.make:106: android/android-app_arm64-v8a-prefix/src/android-app_arm64-v8a-stamp/android-app_arm64-v8a-configure] Error 1
make[1]: *** [CMakeFiles/Makefile2:1322: android/CMakeFiles/android-app_arm64-v8a.dir/all] Error 2
make: *** [Makefile:163: all] Error 2

0 个答案:

没有答案