ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Can ROS be compiled for libc++ with clang and c++98?

asked 2017-11-03 14:48:02 -0600

RDaneelOlivaw gravatar image

updated 2017-11-06 06:40:26 -0600

My question, is there any build or way of compiling ROS from source so that its compiled with libc++ instead of libstdc++? I've reached to compile quite a lot of it with clang,libc++ and c++98 but, there is an error that I don't quite know how to bypass:

/home/ubuntu/ros_catkin_ws/src/ros_comm/rosconsole/src/rosconsole/rosconsole.cpp:428:3: error: use of undeclared identifier 'va_copy'

Bare in mind that I'm only interested in the ROS Barebones of Indigo in this case.

Any idea of how I can bypass this ? Maybe a code susbtitute?

Edit: Thanks for the fast response.

The problem is that I need to import ROS libraries in a system that has been compiled differently. This is an example: In this system when looking for the function ros::NodeHandle it asks for this symbol in the .so:

_ZN3ros10NodeHandleC1ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKNS1_3mapIS7_S7_NS1_4lessIS7_EENS5_INS1_4pairIS8_S7_EEEEEE

But in the ros .so libraries compiled by default, that same function was compiled differently:

_ZN3ros10NodeHandleC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt3mapIS6_S6_St4lessIS6_ESaISt4pairIS7_S6_EEE

THats why it doesnt find it. So maybe I'm trying to compile with a version too old that I really dont need? The only thing I know of the system is that was compiled with libc++ instead of libstdc++. As fas as my limited comprehension goes, we need to compile with clang to be able to use libc++? Or at least for ROS compilation to recognise cxxflags. These are the procedure that I use to compile ROS barebones. am I doing something wrong or could it be changed to make it work?

cd /home/ubuntu/ros_catkin_ws
export CC=/usr/bin/clang-3.9 export
CXX=/usr/bin/clang++-3.9 export
CXXFLGAS="$CXXFLAGS -stdlib=libc++ -std=c++98"
./src/catkin/bin/catkin_make_isolated --install

Any ideas? Am I missing something or overcomplicating stuff? Thanks in advance

edit retag flag offensive close merge delete

Comments

1

Don't use answers unless you are answering your own question. Use comments or edit your original question.

gvdhoorn gravatar image gvdhoorn  ( 2017-11-04 14:47:06 -0600 )edit

Thanks, I'll bare in mind next time

RDaneelOlivaw gravatar image RDaneelOlivaw  ( 2017-11-06 06:41:35 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-11-03 15:53:11 -0600

ahendrix gravatar image

According to https://linux.die.net/man/3/va_copy , va_copy was added in C99. I'm not sure if a compiler in C++98 compatibility mode will expose that macro or not.

According to REP-3, ROS has always targeted C++03, so I suspect there may be some compatibility issues if you're trying to compile with a C++98 compiler. This may only be the tip of the iceberg, and there will probably be more compatibility issues after you get past this one.

If you explain why you want to use a C++ standard that's almost 20 years old, perhaps we can help you find an alternate solution that isn't as invasive.

edit flag offensive delete link more

Comments

I've edited the question, to make it clear.

RDaneelOlivaw gravatar image RDaneelOlivaw  ( 2017-11-06 06:41:03 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2017-11-03 14:48:02 -0600

Seen: 1,066 times

Last updated: Nov 06 '17