[ros-users] Include directories on OSX (Homebrew)

William Woodall wjwwood at gmail.com
Mon Sep 5 22:34:34 UTC 2011


So, I have fixed one problems and uncovered another.  I finally got gtest
fixed upstream in Homebrew, which involved patching gtest-config for
Homebrew.  The problem was that gtest-config --libs would return a file like
"/usr/local/lib/libgtest.la" which was being stripped because .la files
shouldn't be used on the mac.  This was due to the way gtest-config look at
the directories it was installed to.  For those that don't know Homebrew
installs all packages into a container folder called a "Keg" which are all
stored in the "Cellar", like so: "/usr/local/Cellar/gtest/1.5.0/<stuff>".
 Then Homebrew symlinks the appropriate files to
/usr/local/{lib,include,bin,share,etc...}.

So, now gtest-config properly returns -lgtest now instead of the file path,
but something else changed.  Before the patch gtest-config --includedir
returned "/usr/local/include", but now returns
"/usr/local/Cellar/gtest/1.5.0/include".

So why does this matter?  Well this general -I/usr/local/include was
covering another issue.  Once this had changed in gtest-config, roslib
couldn't find boost headers anymore... This is because rosboost-cfg wasn't
returning anything for `rosboost-cfg --include_dirs`, as the boost install
was detected to be a "ver.is_system_install".

So why is /usr/local/include not in there by default?  This is because the
-isysroot command is used to point to the MacOSX10.7.sdk, which does not
have a symlink to /usr/local/include in it.  That means to compile anything
that uses boost (or anything else that has headers in /usr/local/include)
now I have to add -I/usr/local/include manually.

tl;dr:

I need to add -I/usr/local/include to the c++ arguments when compiling
something with boost (but more generally it should be a system default
include).  How should that be accomplished?

   - Should the rosboost-cfg --include_dirs return that?  (currently it
   doesn't because it detects the Homebrew boost as being "system installed"
   and returns "")
      -
      https://code.ros.org/trac/ros/browser/stacks/ros/tags/ros-1.6.2/tools/rosboost_cfg/src/rosboost_cfg/rosboost_cfg.py#L250
      - This implys that the larger issue should be fixed by each individual
      library with headers in /usr/local/include
   - Should "/usr/local/include" be added to the CPLUS_INCLUDE_PATH in
   something like .bashrc?
   - Some other strategy?

Just wanted to get some others input.

Thanks,

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
William Woodall
Graduate Software Engineering
Auburn University
w at auburn.edu
wjwwood at gmail.com
williamjwoodall.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osuosl.org/pipermail/ros-users/attachments/20110905/f4143444/attachment-0002.html>


More information about the ros-users mailing list