Ask Your Question
0

Unable to build opencv for android using cmake

asked 2014-11-14 04:40:23 -0600

zmalex gravatar image

I managed to build OpenCV 2.4.9 for java following the online instructions.

However I am unable to build for Android

I am using OSX Yosemite, CMake 3.0.2, OpenCV 2.4.9.

The output I get is the following:

======

platforms [2.4.9] % sh ./scripts/cmake_android_arm.sh CMake Error at platforms/android/android.toolchain.cmake:827 (list): list index: 17 out of range (-17, 16) Call Stack (most recent call first): platforms/build_android_arm/CMakeFiles/3.0.2/CMakeSystem.cmake:6 (include) CMakeLists.txt:56 (project)

-- Detected version of GNU GCC: 49 (409) -- Performing Test HAVE_CXX_WERROR_ADDRESS CMake Error at /Users/mam/Source/opencv/platforms/android/android.toolchain.cmake:711 (list): list sub-command REMOVE_DUPLICATES requires list to be present. Call Stack (most recent call first): /Users/mam/Source/opencv/platforms/build_android_arm/CMakeFiles/3.0.2/CMakeSystem.cmake:6 (include) CMakeLists.txt:2 (project)

CMake Error at /Users/mam/Source/opencv/platforms/android/android.toolchain.cmake:712 (list): list sub-command SORT requires list to be present. Call Stack (most recent call first): /Users/mam/Source/opencv/platforms/build_android_arm/CMakeFiles/3.0.2/CMakeSystem.cmake:6 (include) CMakeLists.txt:2 (project)

CMake Error at /Users/mam/Source/opencv/platforms/android/android.toolchain.cmake:718 (message): No one of known Android ABIs is supported by this cmake toolchain. Call Stack (most recent call first): /Users/mam/Source/opencv/platforms/build_android_arm/CMakeFiles/3.0.2/CMakeSystem.cmake:6 (include) CMakeLists.txt:2 (project)

CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage CMake Error: Internal CMake error, TryCompile configure of cmake failed -- Configuring incomplete, errors occurred! See also "/Users/mam/Source/opencv/platforms/build_android_arm/CMakeFiles/CMakeOutput.log".

======

I tried setting both: export ANDROID_NDK=~/android-ndk-r8e and export ANDROID_STANDALONE_TOOLCHAIN=~/android-toolchain

but both give same error. Any clues to what is causing this? Bad version of CMake?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2015-01-28 08:58:32 -0600

updated 2015-01-28 20:41:17 -0600

It is an Old question...I hope that you already resolved this problem.

Use android-ndk-r9x. In my case I had a similar problem when I used 3.0.0-beta and android-ndk-r10d.

Check the file ./platform/android/android.toolchain.cmake for matching ANDROID_NDK version.

edit flag offensive delete link more

Comments

After deeper analysis I found that toolchain-name parsing logic in android.toolchain.cmake is not perfect. I recommend to use -DANDROID_TOOLCHAIN_NAME="arm-linux-androideabi-4.9".

profox gravatar imageprofox ( 2015-01-30 06:40:44 -0600 )edit

Thanks. This worked after setting the toolchain explicitly. Also it didn't work with r10. Gave an error about TestBigEndian.cmake . Build went fine r9c.

Bornfree gravatar imageBornfree ( 2015-02-04 08:02:52 -0600 )edit

Question Tools

Stats

Asked: 2014-11-14 04:40:23 -0600

Seen: 1,457 times

Last updated: Jan 28 '15