Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cmake fails with android ndk

I am trying to build something using the Android NdK standalone toolchain. However, I am running into these errors.

        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.

There are two sets of errors. I have no idea where to begin with the first set. The android.toolchain.cmake file looks into sysroot by default but android is not installed there neither does Google require me to install it there.

Regarding the CMAKE variables, I found that most solutions involve installing Developer Tools, which I already have. I tried manually setting the CXX and CC variables but that did not help.

Any ideas as to where to start?

Thank you.

like image 935
maverick1989 Avatar asked Apr 23 '13 19:04

maverick1989


1 Answers

Ok, I'll do a bit of guesswork here, but I think you're using http://code.google.com/p/android-cmake/ and you're calling it with ANDROID_STANDALONE_TOOLCHAIN while providing it the path to your NDK. If I'm right, that's the problem.

You should either call it with ANDROID_NDK and provide the path to your NDK. The android-cmake documentation suggests that this is the way to go.

or

Keep calling it with ANDROID_STANDALONE_TOOLCHAIN, but providing it the path to an installed toochain (something created with make-standalone-toolchain.sh)

If you want to go this way, you can find information about creating standalone toolchains in docs/STANDALONE-TOOLCHAIN.html in your installed NDK.

like image 181
Guillaume Avatar answered Oct 24 '22 05:10

Guillaume