[ros-users] OpenCV on Snow Leapard

Brian Gerkey gerkey at willowgarage.com
Mon Apr 19 14:43:13 UTC 2010

hi Daniel,

The documentation suggests that the INSTALL_NAME_DIR property will
cause install_name_tool to be run during installation.  And if you
want to skip the install step (e.g., if you're copying binaries
directly out of the built tree), the BUILD_WITH_INSTALL_RPATH property
will do the work during the build.  I haven't used these options much
myself, so I can't promise anything.


On Tue, Apr 13, 2010 at 6:30 PM, Daniel Stonier <d.stonier at gmail.com> wrote:
> Just starting to learn the ropes on macosx and hoping for some advice.
> I have a colleague running ros with snow leapard and ran into a few
> problems with opencv and rpaths.
> Recently I set up a trimmed down version of opencv (compatible with
> what we will have running on the embedded board), so we just copied
> the opencv package in ros and turned off alot of the cmake flags that
> were being used. This worked fine on linux, but created libraries that
> couldn't be found on the mac. My colleague hacked a solution to run a
> script that ran 'install_name_tool" on the generated libs:
> **************************************************************************************
> #! /bin/bash
> # On Mac OSX, every dynamic library (*.dylib) has its own 'install name',
> # and it is used for locating the actual library file at runtime.
> # The install name shows up at the first line of the output of 'otool
> -L <name.dylib>'.
> # When a program or a library is linked with other libraries, it copies
> # all the install names of the other libraries, so that it can find
> them in run-time.
> #
> # For an unknown reason, in our cumstomized OpenCV package, 'opencv_embedded',
> # the dynamic libraries do not have full path information in their
> install names.
> # This results in the 'image not found' error at runtime.
> # This script (only for Mac OSX) fixes this problem by changing the
> install names.
> # You just need to run this script only once after building
> 'opencv_embedded' pacakge.
> install_name_tool -id `pwd`/opencv/lib/libcv.2.1.dylib
> opencv/lib/libcv.2.1.0.dylib
> install_name_tool -id `pwd`/opencv/lib/libcvaux.2.1.dylib
> opencv/lib/libcvaux.2.1.0.dylib
> install_name_tool -id `pwd`/opencv/lib/libcxcore.2.1.dylib
> opencv/lib/libcxcore.2.1.0.dylib
> install_name_tool -id `pwd`/opencv/lib/libhighgui.2.1.dylib
> opencv/lib/libhighgui.2.1.0.dylib
> install_name_tool -id `pwd`/opencv/lib/libml.2.1.dylib
> opencv/lib/libml.2.1.0.dylib
> install_name_tool -change libcxcore.2.1.dylib
> `pwd`/opencv/lib/libcxcore.2.1.dylib  opencv/lib/libcv.2.1.0.dylib
> install_name_tool -change libcxcore.2.1.dylib
> `pwd`/opencv/lib/libcxcore.2.1.dylib  opencv/lib/libcvaux.2.1.0.dylib
> install_name_tool -change libcv.2.1.dylib
> `pwd`/opencv/lib/libcv.2.1.dylib      opencv/lib/libcvaux.2.1.0.dylib
> install_name_tool -change libhighgui.2.1.dylib
> `pwd`/opencv/lib/libhighgui.2.1.dylib opencv/lib/libcvaux.2.1.0.dylib
> install_name_tool -change libml.2.1.dylib
> `pwd`/opencv/lib/libml.2.1.dylib      opencv/lib/libcvaux.2.1.0.dylib
> install_name_tool -change libcxcore.2.1.dylib
> `pwd`/opencv/lib/libcxcore.2.1.dylib
> opencv/lib/libhighgui.2.1.0.dylib
> install_name_tool -change libcv.2.1.dylib
> `pwd`/opencv/lib/libcv.2.1.dylib
> opencv/lib/libhighgui.2.1.0.dylib
> install_name_tool -change libcxcore.2.1.dylib
> `pwd`/opencv/lib/libcxcore.2.1.dylib  opencv/lib/libml.2.1.0.dylib
> echo "Install names have been changed in opencv/lib/*.dylib files"
> **************************************************************************************
> However, is there a way to set the install names in the opencv cmake
> build itself without running a script post-install?
> Cheers,
> Daniel Stonier.
> --
> Phone : +82-10-5400-3296 (010-5400-3296)
> Home: http://snorriheim.dnsdojo.com/
> Yujin Robot: http://www.yujinrobot.com/
> Embedded Control Libraries: http://snorriheim.dnsdojo.com/redmine/wiki/ecl
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users

More information about the ros-users mailing list