Ask Your Question
1

Building OpenCv4Android: CMAKE_CXX_COMPILER_ENV_VAR not set

asked 2013-08-23 05:59:46 -0500

28o87e gravatar image

updated 2013-08-23 10:22:46 -0500

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?

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
1

answered 2013-08-23 12:22:41 -0500

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.

edit flag offensive delete link more

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 ( 2013-10-15 04:42:47 -0500 )edit

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

samduke474 gravatar imagesamduke474 ( 2013-10-15 10:00:44 -0500 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2013-08-23 05:59:46 -0500

Seen: 4,606 times

Last updated: Aug 23 '13