Ask Your Question

Building ROS on OSX 10.9 (solution)

asked 2013-10-27 06:06:49 -0500

Artem gravatar image

updated 2013-12-13 20:18:04 -0500

Building octomap, orocos_kdl and other packages on OSX 10.9 produces the following compilation errors

    /Users/artemlenskiy/ros/hydro/src/octomap/src/Pointcloud.cpp:37:12: fatal error: 'ext/algorithm' file not found
      #include <ext/algorithm>
    [ 29%] Building CXX object src/CMakeFiles/octomap.dir/AbstractOcTree.cpp.o
    In file included from /Users/artemlenskiy/ros/hydro/src/octomap/src/OcTreeLUT.cpp:37:
    In file included from /Users/artemlenskiy/ros/hydro/src/octomap/include/octomap/OcTreeLUT.h:40:
    /Users/artemlenskiy/ros/hydro/src/octomap/include/octomap/OcTreeKey.h:40:12: fatal error: 'tr1/unordered_set' file not found
      #include <tr1/unordered_set>

In the case of orocos_kdl

In file included from /Users/artemlenskiy/ros/hydro/src/orocos_kdl/src/kinfam_io.cpp:22:
In file included from /Users/artemlenskiy/ros/hydro/src/orocos_kdl/src/kinfam_io.hpp:25:
In file included from /Applications/
In file included from /Applications/
In file included from /Applications/
In file included from /Applications/
In file included from /Applications/
/Applications/ error: field has incomplete type 'KDL::TreeElement'
    _T2 second;
edit retag flag offensive close merge delete


Did you find an answer to the orocos_kdl problem? I've built latest version of octomap/devel branch without problem, but I don't know yet how to solve this orocos_kdl error

Bruno Normande gravatar image Bruno Normande  ( 2013-11-18 09:16:45 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2013-11-14 00:51:05 -0500

jensenb gravatar image

updated 2014-08-05 14:19:58 -0500

Edit 5: These workarounds are no longer required. They are kept here purely for reference.

Some of the workarounds listed in this answer are no longer required as the changes have been merged into hydro. Below are the current workarounds still required to get ROS hydro working on Mavericks, suitable to both git and tar based rosinstall distributions.


There is a problem with OROCOS KDL API that is incompatible with libc++ and clang, discussed in more detail in PR 4 and PR 19. You will need to patch KDL source using both of these pull requests.

cd <ROS WORKSPACE DIR>/src/orocos_kinematics_dynamics
curl | patch -p1
curl | patch -p1
# it is not a problem if the following step fails
cd .. && rm -r build_isolated/orocos_kdl

You will also need to patch several dependent ROS packages. For the necessary robot model changes:

cd <ROS WORKSPACE DIR>/src/robot_model
curl | patch -p1
# it is not a problem if the following step fails
cd .. && rm -r build_isolated/kdl_parser

for the necessary robot_state_publisher changes:

cd <ROS WORKSPACE DIR>/src/robot_state_publisher
curl | patch -p1
# it is not a problem if the following step fails
cd ../.. && rm -r build_isolated /robot_state_publisher

OpenCV and Cuda

Currently OpenCV has issues when building with Cuda enabled, so you will have to disable it:

cd build_isolated/opencv/install
# turn off the 'WITH_CUDA' flag and generate

Outdated workarounds no longer necessary

These workarounds are no longer necessary but I am keeping them here for historical reasons in case someone has an older workspace and doesn't want to update.

Prerequisite for any of the following steps is understanding how to checkout Github pull requests locally. The rest of these fixes are currently involve API breaking changes and are under review. I make no guarantees about their correctness, only that they should at least build on Mavericks. For all of the commands below I always your current working directory is your ROS workspace root (NOT src subdirectory).

Octomap Fix

For this particular octomap problem there is a fix committed upstream that should allow compilation with libc++ with Mavericks: . Due to the way ROS packages things, mergeing this change in to the ROS octomap source in your hydro workspace involves a bit of hand work on the command line:

cd <path to your hydro workspace>/src/octomap
git remote upstream
git fetch upstream
git checkout release/hydro/octomap/1.6.1-0
git cherry-pick b7aec9182e102da32f0f210197a55b827e0ae894
git cherry-pick 8a9722d0f479dcde680dc689e0d071e48bb32e99

Rebuild your catkin workspace and the octomap errors should go away.

ROSCPP Message Traits

There is a problem with the roscpp message forward declarations that is discussed in more detail here. The workaround:

cd src/roscpp_traits
curl -o include/ros/message_forward.h ...
edit flag offensive delete link more


I had also troubles compiling rqt_image_view and rviz, although Hans did not have this problem. I had to add opencv_libs into CMakeLists.txt. BTW, I deleted opencv from src, because I prefer to have it installed through homebrew.

Artem gravatar image Artem  ( 2013-11-21 03:48:54 -0500 )edit

how did you add opencv_libs into rqt_image_view CMakeLists.txt ?

iRunner gravatar image iRunner  ( 2013-12-02 19:15:02 -0500 )edit

After adding opencv_libs to CMakeLists.txt the modified line looks like this target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${OPENCV_LIBRARY} ${OpenCV_LIBS})

Artem gravatar image Artem  ( 2013-12-03 00:29:32 -0500 )edit

I'm still getting: Undefined symbols for architecture x86_64: after Linking CXX shared library /Users/miRunner/ros_catkin_ws/devel_isolated/rqt_image_view/lib/librqt_image_view.dylib

iRunner gravatar image iRunner  ( 2013-12-03 03:13:59 -0500 )edit

Do you have find_package(OpenCV REQUIRED) in your CMakeLists.txt?

Artem gravatar image Artem  ( 2013-12-03 03:23:42 -0500 )edit

It should by default use c++11 but try adding set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -v -std=c++11 -stdlib=libc++ ")

Artem gravatar image Artem  ( 2013-12-03 03:24:28 -0500 )edit

nvm i got it to work after adding find_package(OpenCV required)

iRunner gravatar image iRunner  ( 2013-12-03 03:25:24 -0500 )edit

libc++ is used by default, but c++11 support is only active is your set the flag, not be default.

jensenb gravatar image jensenb  ( 2013-12-03 23:29:04 -0500 )edit

answered 2013-10-27 06:08:26 -0500

Artem gravatar image

updated 2013-11-14 17:03:40 -0500

The problem is caused by the tr1 prefix on the headers that is not supported in libc++. That is used in OSX 10.9.

The solution is to explicitly specify libstdc++ by adding the following lines to ./src/octomap/CMakeLists.txt and other corresponding CMakeLists.txt

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}  -stdlib=libstdc++")
  • Edit this is not really a good solution as clang moving towards libc++.
edit flag offensive delete link more


Are you building with clang or gcc? Is that a standard flag that would be compatible with other compilers as well? Would you consider reporting this problem and a fix / pull request at the OctoMap upstream repo?

AHornung gravatar image AHornung  ( 2013-10-27 23:13:05 -0500 )edit

I am building with clang. I will try to do a pull request later this week.

Artem gravatar image Artem  ( 2013-10-28 00:43:35 -0500 )edit

@AHornung adding those flags is not a good solution. The solution is to remove tr1 wherever it appears.

Artem gravatar image Artem  ( 2013-11-11 04:48:38 -0500 )edit

Removing the tr1 prefixes will probably break compilation for most other compilers that don't use tr1 by default... Probing for tr1 and then conditionally include the "right" stuff should work:

AHornung gravatar image AHornung  ( 2013-11-11 04:54:37 -0500 )edit

Yes it will break, it should be conditioned based on OS and compiler.

Artem gravatar image Artem  ( 2013-11-11 04:57:09 -0500 )edit

Didn't work for me. I continue to stop in "fatal error: 'tr1/unordered_set' file not found"

Bruno Normande gravatar image Bruno Normande  ( 2013-11-14 00:27:33 -0500 )edit

This just got fixed for OctoMap in the latest commit on the "devel" branch, if you check that out it should build fine:

AHornung gravatar image AHornung  ( 2013-11-14 00:46:55 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2013-10-27 06:06:49 -0500

Seen: 4,795 times

Last updated: Aug 05 '14