[CMake] linker default library path /usr/local/lib on OSX
amine bezzarga
abezzarg at gmail.com
Thu Sep 22 11:57:02 EDT 2011
Any ideas about how to override the "install_name" of /usr/local/lib on that
library ?
On Wed, Sep 21, 2011 at 1:52 AM, amine bezzarga <abezzarg at gmail.com> wrote:
> Yes I think I get it, I tried that but it doesn't work either:
> install_name_tool -change /usr/local/lib/libirrklang.dylib
> ./Dependencies/IrrKLangAudioEngine/bin/macosx-gcc/
> ./Dependencies/IrrKLangAudioEngine/bin/macosx-gcc/libirrklang.dylib
>
> Can you tell me, what can I do to fix the problem ?
>
> On Tue, Sep 20, 2011 at 2:19 AM, Michael Jackson <
> mike.jackson at bluequartz.net> wrote:
>
>> Yes. Who ever built the irrklang library has set an "install_name" of
>> /usr/local/lib on that library. So it does not matter where the library is
>> located. OS X thinks it is in /usr/local/lib.
>> You need to fix how that library is compiled and linked. Does that
>> make it clear what is going on?
>>
>>
>> -----
>> Mike Jackson <http://www.bluequartz.net>
>> www.bluequartz.net
>> Principal Software Engineer <mike.jackson at bluequartz.net>
>> mike.jackson at bluequartz.net
>> BlueQuartz Software Dayton, Ohio
>> Sent from my mobile device.
>>
>> On Sep 19, 2011, at 19:56, amine bezzarga <abezzarg at gmail.com> wrote:
>>
>> Yeah, I tried the NO_DEFAULT_PATH option but without success.
>> My target_link_library command look like this:
>>
>> target_link_libraries(${CMAKE_PROJECT_NAME} ${OGRE_LIBRARIES}
>> ${OGRE_PLUGIN_LIBRARIES} ${Boost_LIBRARIES} ${OIS_LIBRARIES}
>> ${IrrKlang_LIBRARIES})
>>
>> Here is the otool output of the sound library:
>> $ otool -L
>> ./Dependencies/IrrKLangAudioEngine/bin/macosx-gcc/libirrklang.dylib
>> ./Dependencies/IrrKLangAudioEngine/bin/macosx-gcc/libirrklang.dylib
>> (architecture ppc):
>> /usr/local/lib/libirrklang.dylib (compatibility version 1.0.0, current
>> version 1.0.0)
>> /System/Library/Frameworks/CoreAudio.framework/Versions/A/CoreAudio
>> (compatibility version 1.0.0, current version 1.0.0)
>> /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version
>> 7.4.0)
>> /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version
>> 1.0.0)
>> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version
>> 88.3.3)
>> ./Dependencies/IrrKLangAudioEngine/bin/macosx-gcc/libirrklang.dylib
>> (architecture i386):
>> /usr/local/lib/libirrklang.dylib (compatibility version 1.0.0, current
>> version 1.0.0)
>> /System/Library/Frameworks/CoreAudio.framework/Versions/A/CoreAudio
>> (compatibility version 1.0.0, current version 1.0.0)
>> /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version
>> 7.4.0)
>> /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version
>> 1.0.0)
>> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version
>> 88.3.3)
>>
>> Does it help ?
>>
>>
>> On Mon, Sep 19, 2011 at 1:56 PM, Michael Jackson <<mike.jackson at bluequartz.net>
>> mike.jackson at bluequartz.net> wrote:
>>
>>> My guess is that the audio library has an install path of /usr/local/lib
>>> encoded in it. Try posting tue output of otool for the actual audio
>>> library.
>>>
>>> -----
>>> Mike Jackson <http://www.bluequartz.net><http://www.bluequartz.net>
>>> www.bluequartz.net
>>> Principal Software Engineer <mike.jackson at bluequartz.net><mike.jackson at bluequartz.net>
>>> mike.jackson at bluequartz.net
>>> BlueQuartz Software Dayton, Ohio
>>> Sent from my mobile device.
>>>
>>> On Sep 18, 2011, at 23:38, Cristobal Navarro < <axischire at gmail.com>
>>> axischire at gmail.com> wrote:
>>>
>>> ok i get your point.
>>> mmm. In others words you need something equivalent to rpath command, im
>>> pretty sure cmake can handle this easily let me know if the following helps.
>>>
>>> have you tried adding more options to the find_library command ??
>>> for example have you tried this (also, with the PATHS command just to be
>>> sure):
>>>
>>> find_library(IrrKlang_LIBRARIES irrKlang
>>> PATHS
>>> ${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/IrrKLangAudioEngine/bin/macosx-gcc
>>> NO_DEFAULT_PATH
>>> )
>>>
>>> And what is your "target_link_libraries" command?
>>>
>>>
>>>
>>> On Sun, Sep 18, 2011 at 12:33 PM, amine bezzarga < <abezzarg at gmail.com><abezzarg at gmail.com>
>>> abezzarg at gmail.com> wrote:
>>>
>>>> The issue is not about finding the library at built time, event if my
>>>> library is found in
>>>> ${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/IrrKLangAudioEngine/bin/macosx-gcc and
>>>> after building is done, my app is still looking for the library in
>>>> /usr/local/lib at runtime as you can see with the otools output in my first
>>>> message.
>>>>
>>>> I want to find a way to tell the linker to link the library from where
>>>> it find it.
>>>> Does it make sense ?
>>>>
>>>> On Sun, Sep 18, 2011 at 4:29 PM, Cristobal Navarro <<axischire at gmail.com><axischire at gmail.com>
>>>> axischire at gmail.com> wrote:
>>>>
>>>>> yes
>>>>>
>>>>> you have to provide another option
>>>>> find_library( IrrKlang_LIBRARIES irrKlang PATHS <path1 to
>>>>> library> <path2 to library> ... )
>>>>>
>>>>>
>>>>> <http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:find_library><http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:find_library>
>>>>> http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:find_library
>>>>>
>>>>> is this what you need?
>>>>> best regards
>>>>> Cristobal
>>>>>
>>>>>
>>>>> On Sun, Sep 18, 2011 at 10:16 AM, amine bezzarga <<abezzarg at gmail.com><abezzarg at gmail.com>
>>>>> abezzarg at gmail.com> wrote:
>>>>>
>>>>>> Hello guys,
>>>>>>
>>>>>> I added a sound library to my project, So I first created a cmake
>>>>>> module to find it
>>>>>>
>>>>>> MESSAGE(STATUS "Looking for IrrKlang...")
>>>>>>
>>>>>> find_library(IrrKlang_LIBRARIES irrKlang
>>>>>>
>>>>>> ${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/IrrKLangAudioEngine/bin/macosx-gcc
>>>>>> )
>>>>>>
>>>>>> find_path(IrrKlang_INCLUDE_DIRS irrKlang.h
>>>>>> ${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/IrrKLangAudioEngine/include
>>>>>> )
>>>>>>
>>>>>> IF (IrrKlang_INCLUDE_DIRS AND IrrKlang_LIBRARIES)
>>>>>> SET(IrrKlang_FOUND TRUE)
>>>>>> ENDIF (IrrKlang_INCLUDE_DIRS AND IrrKlang_LIBRARIES)
>>>>>>
>>>>>>
>>>>>> IF (IrrKlang_FOUND)
>>>>>> IF (NOT IrrKlang_FIND_QUIETLY)
>>>>>> MESSAGE(STATUS "Found IrrKlang: ${IrrKlang_LIBRARIES}")
>>>>>> ENDIF (NOT IrrKlang_FIND_QUIETLY)
>>>>>> ELSE (IrrKlang_FOUND)
>>>>>> IF (IrrKlang_FIND_REQUIRED)
>>>>>> MESSAGE(FATAL_ERROR "Could not find IrrKlang")
>>>>>> ENDIF (IrrKlang_FIND_REQUIRED)
>>>>>> ENDIF (IrrKlang_FOUND)
>>>>>>
>>>>>> Everything works fine exept I can't control from where the library is
>>>>>> linked.
>>>>>> Why after I build my project OSX is looking for that library in
>>>>>> /usr/local/lib ?
>>>>>> Is there a way to tell cmake to link the library from where it find it
>>>>>> i.e ${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/IrrKLangAudioEngine/bin/macosx-gcc
>>>>>> ?
>>>>>>
>>>>>> here is my otool output after building the project
>>>>>> $ otool -L ./bin/MacOSX/OgreApp.app/Contents/MacOS/OgreApp
>>>>>> ./bin/MacOSX/OgreApp.app/Contents/MacOS/OgreApp:
>>>>>> @executable_path/../Frameworks/Ogre.framework/Versions/1.7.1/Ogre
>>>>>> (compatibility version 0.0.0, current version 1.7.1)
>>>>>> @executable_path/../Components/libOgreRTShaderSystem.dylib
>>>>>> (compatibility version 0.0.0, current version 1.7.1)
>>>>>> @executable_path/../Frameworks/OIS.framework/Versions/A/OIS
>>>>>> (compatibility version 1.0.0, current version 1.0.0)
>>>>>> /usr/local/lib/libirrklang.dylib (compatibility version 1.0.0,
>>>>>> current version 1.0.0) --> I want cmake to link that lib, because my lib is
>>>>>> not there.
>>>>>> /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current
>>>>>> version 7.9.0)
>>>>>> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
>>>>>> version 123.0.0)
>>>>>>
>>>>>> I know I can correct the path with bundleutilities, but the library
>>>>>> still need to be copied in /usr/local/lib to be preccessed by
>>>>>> bundleutilitities in that case.
>>>>>>
>>>>>> Do you have any ideas ?
>>>>>> Mino
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Powered by <http://www.kitware.com> <http://www.kitware.com>
>>>>>> www.kitware.com
>>>>>>
>>>>>> Visit other Kitware open-source projects at
>>>>>> <http://www.kitware.com/opensource/opensource.html><http://www.kitware.com/opensource/opensource.html>
>>>>>> http://www.kitware.com/opensource/opensource.html
>>>>>>
>>>>>> Please keep messages on-topic and check the CMake FAQ at:
>>>>>> <http://www.cmake.org/Wiki/CMake_FAQ><http://www.cmake.org/Wiki/CMake_FAQ>
>>>>>> http://www.cmake.org/Wiki/CMake_FAQ
>>>>>>
>>>>>> Follow this link to subscribe/unsubscribe:
>>>>>> <http://www.cmake.org/mailman/listinfo/cmake><http://www.cmake.org/mailman/listinfo/cmake>
>>>>>> http://www.cmake.org/mailman/listinfo/cmake
>>>>>>
>>>>>
>>>>
>>>>
>>>>
>>> _______________________________________________
>>> Powered by <http://www.kitware.com> <http://www.kitware.com>
>>> www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> <http://www.kitware.com/opensource/opensource.html><http://www.kitware.com/opensource/opensource.html>
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Please keep messages on-topic and check the CMake FAQ at:
>>> <http://www.cmake.org/Wiki/CMake_FAQ><http://www.cmake.org/Wiki/CMake_FAQ>
>>> http://www.cmake.org/Wiki/CMake_FAQ
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> <http://www.cmake.org/mailman/listinfo/cmake>
>>> http://www.cmake.org/mailman/listinfo/cmake
>>>
>>>
>>
>>
>> --
>> Amine Bezzarga • +33 6 64 89 87 79 • abezzarg at gmail.com • www.gomino.info<http://goog_1766391406>
>> <http://gomino.info>
>>
>>
>>
>
>
> --
> Amine Bezzarga • +33 6 64 89 87 79 • abezzarg at gmail.com • www.gomino.info<http://goog_1766391406>
> <http://gomino.info>
>
>
>
--
Amine Bezzarga • +33 6 64 89 87 79 • abezzarg at gmail.com •
www.gomino.info<http://goog_1766391406>
<http://gomino.info>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110922/d51214c0/attachment-0001.htm>
More information about the CMake
mailing list