[ros-users] Request for Clue: OSX-specific linker flags, dependency resolution

Brian Gerkey gerkey at willowgarage.com
Tue Jan 18 20:11:56 UTC 2011


On Fri, Jan 14, 2011 at 9:06 AM, Nicholas Butko <nbutko at ucsd.edu> wrote:
> Brian, I had a question about this.
> In CMake, I typically call "find_library" before calling
> "target_link_library". I was wondering if there's a reason that you don't.
> On the ROS OSX install site, it asks the user to add these environment
> variables to .profile:
> export CPATH=/opt/local/include
> export LIBRARY_PATH=/opt/local/lib
> They are very important to add for ROS, but they sometimes seem to interfere
> with the installation of other packages. For example, I was getting some
> strange interference between installing OpenCV from SVN, and the macports
> version of libjpeg. More importantly, they do not seem helpful for my
> non-ros CMake projects.
> I am wondering now if the reason ROS requires special environment variables
> is that "find_library" is not being called.
> Do you have any thoughts on this?

hi Nick,

Using find_library() may be the "right" way to use CMake in that
you'll end up with an absolute path to the library, which is what
CMake now prefers (see earlier thread on this topic).

As to the behavior that you're seeing: are you using CMake from
MacPorts?  If so, I would guess that it is configured to look in
/opt/local for headers and libs.

Our advice to explicitly add /opt/local to compiler/linker search
paths via environment variables is based on the idea of making the OSX
+ MacPorts setup look as much like a standard Linux setup, where
nothing special is required to let the compiler and linker know how to
find things.  The goal is to be able to tell the linker '-lfoo', and
have it find /opt/local/lib/libfoo.dylib.

	brian.



More information about the ros-users mailing list