Page 1 of 1

[solved] CMake driving me nuts - Not able to find NDK

Posted: Thu Apr 04, 2013 2:51 am
by DanielSefton
Literally no matter what I do I get the following error when trying to configure CMake on OSX with the CMake/toolchain/android.toolchain.cmake:
CMake Error at CMake/toolchain/android.toolchain.cmake:432 (message):
Could not find neither Android NDK nor Android standalone toolcahin.

You should either set an environment variable:
export ANDROID_NDK=~/my-android-ndk
or
export ANDROID_STANDALONE_TOOLCHAIN=~/my-android-toolchain
or put the toolchain or NDK in the default path:
sudo ln -s ~/my-android-ndk /opt/android-ndk
sudo ln -s ~/my-android-toolchain /opt/android-toolchain
Call Stack (most recent call first):
/Applications/CMake 2.8-10.app/Contents/share/cmake-2.8/Modules/CMakeDetermineSystem.cmake:89 (include)
CMakeLists.txt:48 (project)
I'm using CMake 2.8-10 and Android NDK r8e on OSX Lion.

I've added the following to both my ~/.profile and ~/.bash_profile:
export ANDROID_NDK="/Applications/android-ndk-r8e"
export PATH=$PATH:$ANDROID_NDK
When I run $ANDROID_NDK in terminal I get:

-bash: /Applications/android-ndk-r8e: is a directory

It also exists in my $PATH.

I've tried rebooting, no luck. I've tried adding it to /opt/android-ndk, no luck. I've tried sudo ln -s ~/my-android-ndk /opt/android-ndk, no luck.

It could be something stupid that I've missed, but I'm out of ideas :(

Re: CMake driving me nuts - Not able to find NDK

Posted: Thu Apr 04, 2013 10:56 am
by DanielSefton
Solved. 2 things:

1) Any Android NDK newer than r8 will not work. I thought I might give it a try, but nope.
2) You need to add ANDROID_NDK as a CMake variable. The instructions should be updated to indicate that...

Re: [solved] CMake driving me nuts - Not able to find NDK

Posted: Thu Apr 04, 2013 3:08 pm
by Wolfmanfx
thats not true i am using latest ndk and you do not need to add as cmake var.
I am using 0.8e on osx and 0.8d on windows.

Re: [solved] CMake driving me nuts - Not able to find NDK

Posted: Thu Apr 04, 2013 9:24 pm
by DanielSefton
Wolfmanfx wrote:thats not true i am usibg latest ndk and you do not need to add as cmake var.
I am using 0.8e on osx and 0.8d on windows.
0.8e on OSX? Ah. Hmm. I'll try again I guess...

Yeah, it just won't detect it for me for some reason :/

Re: [solved] CMake driving me nuts - Not able to find NDK

Posted: Thu Jun 27, 2013 10:05 pm
by Transporter
0.8e needs a few modifications on window:

Code: Select all

diff -r d8768a44c7af CMake/toolchain/android.toolchain.cmake
--- a/CMake/toolchain/android.toolchain.cmake	Thu Jun 27 09:32:17 2013 +0200
+++ b/CMake/toolchain/android.toolchain.cmake	Thu Jun 27 23:01:55 2013 +0200
@@ -203,7 +203,7 @@
 #this one not so much
 set( CMAKE_SYSTEM_VERSION 1 )
 
-set( ANDROID_SUPPORTED_NDK_VERSIONS ${ANDROID_EXTRA_NDK_VERSIONS} -r8b -r7c -r7b -r7 -r6b -r6 -r5c -r5b -r5 "" )
+set( ANDROID_SUPPORTED_NDK_VERSIONS ${ANDROID_EXTRA_NDK_VERSIONS} -r8e -r8d -r8c -r8b -r7c -r7b -r7 -r6b -r6 -r5c -r5b -r5 "" )
 if(NOT DEFINED ANDROID_NDK_SEARCH_PATHS)
  if( CMAKE_HOST_WIN32 )
   file( TO_CMAKE_PATH "$ENV{PROGRAMFILES}" ANDROID_NDK_SEARCH_PATHS )
@@ -358,7 +358,7 @@
 if( CMAKE_HOST_APPLE )
  set( ANDROID_NDK_HOST_SYSTEM_NAME "darwin-x86" )
 elseif( CMAKE_HOST_WIN32 )
- set( ANDROID_NDK_HOST_SYSTEM_NAME "windows" )
+ set( ANDROID_NDK_HOST_SYSTEM_NAME "windows-x86_64" )
  set( TOOL_OS_SUFFIX ".exe" )
 elseif( CMAKE_HOST_UNIX )
  set( ANDROID_NDK_HOST_SYSTEM_NAME "linux-x86" )
windows is replaced by windows-x86_64 on x64 system. But it's still not working:

Code: Select all

-- Configuring OGRE 1.9.0unstable
-- Check size of void*
-- Check size of void* - failed
-- Performing Test OGRE_GCC_HAS_SSE
-- Performing Test OGRE_GCC_HAS_SSE - Failed
-- Performing Test OGRE_GCC_VISIBILITY
-- Performing Test OGRE_GCC_VISIBILITY - Failed
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - not found
-- Looking for stdint.h
-- Looking for stdint.h - not found
-- Looking for stddef.h
-- Looking for stddef.h - not found
-- Check size of unsigned short
-- Check size of unsigned short - failed
-- Check size of unsigned int
-- Check size of unsigned int - failed
-- Check size of unsigned long
-- Check size of unsigned long - failed
CMake Error at D:/Work/Tools/cmake-2.8.11-win32-x86/share/cmake-2.8/Modules/Test
BigEndian.cmake:44 (message):
  no suitable type found
Call Stack (most recent call first):
  CMakeLists.txt:190 (test_big_endian)


-- Configuring incomplete, errors occurred!

Re: [solved] CMake driving me nuts - Not able to find NDK

Posted: Thu Oct 03, 2013 11:11 am
by aldofk
not sure if this can help,

the normal procedure of configuration with cmake on my pc (kubuntu) failed to find the correct ndk toolchain.
it looked for folders which did not exist on my ndk (r9).
then I figured that the installed ndk was the 64 bit version, and all the folder searched had a trailing _64
(as per linux-x86_64 against linux-x86) which kept cmake to correctly locate them.
downgrading the ndk to the 32 bit version solved the issue.
I do not know if there is a smarter way to fix it, or a way to tell cmake that I am using a 64 bit version.