[ros-users] OpenCV on Snow Leapard

Daniel Stonier d.stonier at gmail.com
Wed Apr 14 01:30:59 UTC 2010


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



More information about the ros-users mailing list