Ask Your Question
2

Compiling messages with libc++ - OSX 10.9

asked 2013-11-01 04:24:06 -0500

Hansg91 gravatar image

Hi,

In my next step for my quest to get ros to compile on OSX 10.9, I am stuck on compiling messages with libc++. Generating the messages works fine, but compiling with a ros message give me the following issue:

/opt/ros/hydro/install_isolated/include/std_msgs/String.h:67:68: error: implicit instantiation of undefined template 'std::allocator<void>'
  typedef std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other >  _data_type;
                                                                   ^
/opt/ros/hydro/src/roscpp/src/libros/service_publication.cpp:139:24: note: in instantiation of template class 'std_msgs::String_<std::allocator<void> >' requested here
      std_msgs::String error_string;
                       ^
/opt/ros/hydro/install_isolated/include/ros/message_forward.h:33:28: note: template is declared here
template<typename T> class allocator;
                           ^
In file included from /opt/ros/hydro/src/roscpp/src/libros/service_publication.cpp:42:
/opt/ros/hydro/install_isolated/include/std_msgs/String.h:67:97: error: 'rebind' following the 'template' keyword does not refer to a template
  typedef std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other >  _data_type;
                                                                                                ^~~~~~

I believe the issue is that in libc++, using a forward declared class in a template is no longer compiling and gives an error instead. If I try to build it with libstdc++ instead, I get a chain reaction of other compile errors (ros::console, log4cxx, boost, xmlrpcpp, etc.). Anyone have an idea how to fix this?

Best regards, Hans

edit retag flag offensive close merge delete

Comments

I removed all software and trying rebuild everything. But unfortunately c++11 is more strict and many warning became errors. Some of them errors are not really easy to resolve. I am currently stuck at compiling PCL again. Regarding your problem, haven't gotten there yet. Hope someone will know.

Artem gravatar image Artem  ( 2013-11-01 05:51:41 -0500 )edit

BTW, you are saying chain reaction, do you mean linking issues?

Artem gravatar image Artem  ( 2013-11-01 05:54:21 -0500 )edit

Yes, they are linking errors, but what I meant with chain reaction is that if I build it with libstdc++ instead, many other packages give me linking errors and I didn't manage to fix them all by compiling them too with libstdc++. I am trying to compile bare-bone at the moment, much easier (still hard)

Hansg91 gravatar image Hansg91  ( 2013-11-02 04:50:11 -0500 )edit

Would you please describe how you solved the problem?

Artem gravatar image Artem  ( 2013-11-09 21:44:20 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2013-11-09 22:06:20 -0500

Hansg91 gravatar image

To "fix" this, I applied the following patch :

https://github.com/ros/roscpp_core/pull/15

I'm not sure why that was in there, I assume it really is needed on other systems, but on OSX with libc++ at least it will give compile time errors. Commenting that section out fixed my problems.

edit flag offensive delete link more

Comments

Perfect! It worked!

Artem gravatar image Artem  ( 2013-11-10 00:13:33 -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

1 follower

Stats

Asked: 2013-11-01 04:24:06 -0500

Seen: 748 times

Last updated: Nov 09 '13