android-experimental + android-cmake (on Windows)

Just another desperate try to get something connected with OpenCV compiled under Windows.

AndroidExperimental looked promising at the beginning. But of course everything just works on Linux without problems.

The step where get_ndk_toolchain_linux.sh is referenced won't work on Windows and actually you don't need to do everything in there if you already have the NDK. So, assuming the NDK is already installed, just run the last portion of the script. The following is what worked for me with Cygwin. ANDROID_NDK was defined in the Windows environment variables and therefore had backslashes in it, somehow this wouldn't want to work, so I overwrite it. NDK_TMPDIR is used in the shell script and with Cygwin it has no write access to this folder. Choosing another folder worked.

export ANDROID_NDK=/cygdrive/d/android-ndk-windows
export NDK_TMPDIR=$ANDROID_NDK/../ndk-tmp

$ANDROID_NDK/build/tools/make-standalone-toolchain.sh --platform=android-5 --install-dir=$ANDROID_NDK/android-toolchain --system=windows

ln -fs $ANDROID_NDK/android-toolchain /opt/android-toolchain

So, this prep-work is done. Unfortunately compiling the hello-cmake sample didn't work and ends with:

-- Check for working C compiler: /cygdrive/d/android-ndk-windows/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc -- broken
CMake Error at /usr/share/cmake-2.8.4/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):
  The C compiler "/cygdrive/d/android-ndk-windows/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc" is not able to compile a simple test program.

I'm not sure why this is happening. Maybe it's because the path to the project has spaces in it. Or what ever.
Trying something else for now.

Leave a Reply