cmake与android ndk失败

我正在尝试使用Android NdK独立工具链进行构建。 但是,我遇到了这些错误。

        CMake Warning at cmake/android.toolchain.cmake:387 (message):
      Using value of obsolete variable ANDROID_NDK_TOOLCHAIN_ROOT as initial
      value for ANDROID_STANDALONE_TOOLCHAIN.  Please note, that
      ANDROID_NDK_TOOLCHAIN_ROOT can be completely removed in future versions of
      the toolchain.
    Call Stack (most recent call first):
      cmake/android.toolchain.cmake:476 (__INIT_VARIABLE)
      /usr/local/Cellar/cmake/2.8.10.2/share/cmake/Modules/CMakeDetermineSystem.cmake:86 (include)
      CMakeLists.txt:16 (PROJECT)


    CMake Error at cmake/android.toolchain.cmake:412 (FILE):
      file STRINGS file
      "/Users/vgokhale/Desktop/android-ndk-r8e/sysroot/usr/include/android/api-level.h"
      cannot be read.
    Call Stack (most recent call first):
      cmake/android.toolchain.cmake:548 (__DETECT_NATIVE_API_LEVEL)
      /usr/local/Cellar/cmake/2.8.10.2/share/cmake/Modules/CMakeDetermineSystem.cmake:86 (include)
      CMakeLists.txt:16 (PROJECT)

CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER
CMake Error: Could not find cmake module file:/Users/vgokhale/Desktop/torch-android/src/build/CMakeFiles/2.8.10.2/CMakeCCompiler.cmake
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER
CMake Error: Could not find cmake module file:/Users/vgokhale/Desktop/torch-android/src/build/CMakeFiles/2.8.10.2/CMakeCXXCompiler.cmake
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
make: *** No rule to make target `install'.  Stop.

有两组错误。 我不知道从第一组开始。 android.toolchain.cmake文件默认查看sysroot,但没有安装android,Google也没有要求我在那里安装它。

关于CMAKE变量,我发现大多数解决方案都需要安装我已经拥有的开发工具。 我尝试手动设置CXX和CC变量,但没有帮助。

任何想法从哪里开始?

谢谢。


好的,我会在这里做一些猜测,但是我认为您使用的是http://code.google.com/p/android-cmake/,并且您将它与ANDROID_STANDALONE_TOOLCHAIN一起调用,同时将它提供给您的路径NDK。 如果我是对的,那就是问题所在。

您应该使用ANDROID_NDK来调用它并为您的NDK提供路径。 android-cmake文档表明这是要走的路。

要么

继续使用ANDROID_STANDALONE_TOOLCHAIN调用它,但为它提供已安装的toochain的路径(使用make-standalone-toolchain.sh创建的东西)

如果您想这样做,可以在安装的NDK的docs / STANDALONE-TOOLCHAIN.html中找到有关创建独立工具链的信息。

链接地址: http://www.djcxy.com/p/70993.html

上一篇: cmake fails with android ndk

下一篇: Can HTML checkboxes be set to readonly?