Ask Your Question
1

Building OpenCv4Android: CMAKE_CXX_COMPILER_ENV_VAR not set

asked Aug 23 '13

28o87e gravatar image

updated Aug 23 '13

I'm trying to build OpenCv4Android on OSX using the instructions found here.

They seem to be slightly out of date, as they reference the old location of the git respository, and say I should be doing this:

cd opencv/android
sh ./scripts/cmake_android.sh

Whereas in the current repository, scripts live in platforms/scripts, so I'm doing this:

sh /platforms/scripts/cmake_android_arm.sh

However, that produces the following error:

  opencv git:(master)  ./platforms/scripts/cmake_android_arm.sh 
CMake Error at platforms/android/android.toolchain.cmake:694 (message):
  Could not find any working toolchain in the NDK.  Probably your Android NDK
  is broken.
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/2.8.11.2/share/cmake/Modules/CMakeDetermineSystem.cmake:90 (include)
  CMakeLists.txt:45 (project)


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/dan/workspace/opencv/platforms/build_android_arm/CMakeFiles/2.8.11.2/CMakeCXXCompiler.cmake
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/dan/workspace/opencv/platforms/build_android_arm/CMakeFiles/2.8.11.2/CMakeCCompiler.cmake
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!

Despite the error message, I'm using a clean installation of the NDK and have it set on $ANDROID_NDK.

Any ideas what I'm doing wrong?

Preview: (hide)

1 answer

Sort by » oldest newest most voted
1

answered Aug 23 '13

Your error messages mean that cmake cannot find cmake toolchain file. Run scripts/cmake_android_arm.sh script from platforms folder:

cd <OpenCV_Direcory>/platfroms
sh scripts/cmake_android_arm.sh

Thank you for feedback about wiki. I will fix it.

Preview: (hide)

Comments

Hi, i still get errors about the android toolchain etc doing as you say (I've specified the android NDK location)

samduke474 gravatar imagesamduke474 (Oct 15 '13)edit

problem was that the opencv version i had checked out didnt support android ndk r9.

samduke474 gravatar imagesamduke474 (Oct 15 '13)edit

Question Tools

Stats

Asked: Aug 23 '13

Seen: 5,562 times

Last updated: Aug 23 '13