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

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
Post Reply
User avatar
DanielSefton
Ogre Magi
Posts: 1235
Joined: Fri Oct 26, 2007 12:36 am
Location: Mountain View, CA
x 10
Contact:

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

Post 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 :(
Last edited by DanielSefton on Thu Apr 04, 2013 10:57 am, edited 2 times in total.
User avatar
DanielSefton
Ogre Magi
Posts: 1235
Joined: Fri Oct 26, 2007 12:36 am
Location: Mountain View, CA
x 10
Contact:

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

Post 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...
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 99
Contact:

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

Post 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.
User avatar
DanielSefton
Ogre Magi
Posts: 1235
Joined: Fri Oct 26, 2007 12:36 am
Location: Mountain View, CA
x 10
Contact:

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

Post 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 :/
Transporter
Minaton
Posts: 933
Joined: Mon Mar 05, 2012 11:37 am
Location: Germany
x 110

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

Post 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!
aldofk
Gnoblar
Posts: 4
Joined: Thu Nov 18, 2010 3:38 pm

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

Post 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.
Post Reply