timab25 / android-cmake

Automatically exported from code.google.com/p/android-cmake
0 stars 0 forks source link

cmake install_name_tool error on OSX #2

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When using this toolchain on OSX (10.6.8) with CMake 2.8.4, calling it with:

cmake -DANDROID_NDK=blah -DCMAKE_TOOLCHAIN_FILE=blah ..

Will produce the error: 
CMake Error at /path/to/cmake/Modules/CMakeFindBinUtils.cmake:71
Could not find install_name_tool, please check your installation.

To fix this, you need to provide a path to the install_name_tool binary, 
typically located under /usr/bin/install_name_tool. This can be done by adding 
-DCMAKE_INSTALL_NAME_TOOL=/usr/bin/install_name_tool to the calling line.

In the CMake Platform file Darwin.cmake, they simply check for the presence of 
CMAKE_INSTALL_NAME_TOOL and if not found, they call a find_program to locate 
it. It seems like a reasonable fix to add this to the android.toolchain.cmake 
file, as in the example patch below.

@@ -164,6 +164,11 @@
   message( FATAL_ERROR "Your platform is not supported" )
  endif()

+ # On some platforms (OSX) this may not be defined, so search for it
+ if( NOT DEFINED CMAKE_INSTALL_NAME_TOOL)
+  find_program( CMAKE_INSTALL_NAME_TOOL install_name_tool)
+ endif( NOT DEFINED CMAKE_INSTALL_NAME_TOOL)
+
  set( ANDROID_API_LEVEL $ENV{ANDROID_API_LEVEL} )
  string( REGEX REPLACE "[\t ]*android-([0-9]+)[\t ]*" "\\1" ANDROID_API_LEVEL "${ANDROID_API_LEVEL}" )
  string( REGEX REPLACE "[\t ]*([0-9]+)[\t ]*" "\\1" ANDROID_API_LEVEL "${ANDROID_API_LEVEL}" )

Original issue reported on code.google.com by wizzr...@gmail.com on 19 Aug 2011 at 3:44

GoogleCodeExporter commented 9 years ago
Same issue on Lion 10.7.2, the provided patch resolves the problem.

Original comment by Supernov...@gmail.com on 5 Dec 2011 at 10:17

GoogleCodeExporter commented 9 years ago
I am using OSX 10.6.8 and CMake 2.8.7. 
Android-ndk-r7b 
ANDROID_API_LEVEL=14
Same issue come acrossed. But I add the patch to android.toolchain.cmake. 
Issue also existed.

Original comment by fairy.c....@gmail.com on 1 Mar 2012 at 6:47

GoogleCodeExporter commented 9 years ago
The problem should be fixed with latest update.

Original comment by andrey.k...@itseez.com on 4 Mar 2012 at 1:42