ros/urdfdom_headers

ROS Kinect build failure on raspbian

cambesol opened this issue · 5 comments

Built urdfdom_headers as an external build for Raspbian version:
Linux raspberrypi 4.9.28+ #998 Mon May 15 16:50:35 BST 2017 armv6l GNU/Linux

Version of urdfdom_headers:
pi@raspberrypi:~/ros_catkin_ws/external_src/urdfdom_headers $ git log
commit 5cb0b6b
Merge: 76da8dc 9d2b421
Author: Steven Peters scpeters@osrfoundation.org
Date: Wed Jul 20 10:47:51 2016 -0700

Merge pull request #23 from scpeters/unboost

Use c++11 instead of boost, bump version to 1.0.0

Obtained ROS packages to build as follows:

rosinstall_generator ros_comm --rosdistro kinetic --deps --wet-only --tar > kinetic-ros_comm-wet.rosinstall
rosinstall_generator ros_comm ros_control joystick_drivers laser_geometry tf --rosdistro kinect --deps --wet-only --exclude roslisp --tar > kinect-custom_ros.kinect

Resolved package dependencies:
assimp-3.1.1
collada-dom-2.4.0
console-bridge-0.3.2
urdfdom
urdfdom_headers -> renamed as:

apt list --installed | grep urd
liburdfdom-dev/now 20170703-1 armhf [installed,local]
liburdfdom-headers-dev/now 20170703-1 armhf [installed,local]

Tried to build ROS as follows:
sudo ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/kinetic -j1

After many hours, it failed building robot_state_publisher. Here is a snippet:
/opt/ros/kinetic/include/urdf/urdfdom_compatibility.h:93:14: error: ‘shared_ptr’ in namespace ‘std’ does not name a template type
typedef std::shared_ptr ModelInterfaceSharedPtr;
^
/opt/ros/kinetic/include/urdf/urdfdom_compatibility.h:94:14: error: ‘shared_ptr’ in namespace ‘std’ does not name a template type
typedef std::shared_ptr ModelInterfaceConstSharedPtr;
^
/opt/ros/kinetic/include/urdf/urdfdom_compatibility.h:95:14: error: ‘weak_ptr’ in namespace ‘std’ does not name a template type
typedef std::weak_ptr ModelInterfaceWeakPtr;
^
/opt/ros/kinetic/include/urdf/urdfdom_compatibility.h:100:14: error: ‘shared_ptr’ in namespace ‘std’ does not name a template type
typedef std::shared_ptr ModelSharedPtr;
^
/opt/ros/kinetic/include/urdf/urdfdom_compatibility.h:101:14: error: ‘shared_ptr’ in namespace ‘std’ does not name a template type
typedef std::shared_ptr ModelConstSharedPtr;
^
/opt/ros/kinetic/include/urdf/urdfdom_compatibility.h:102:14: error: ‘weak_ptr’ in namespace ‘std’ does not name a template type
typedef std::weak_ptr ModelWeakPtr;
^
/home/pi/ros_catkin_ws/src/robot_state_publisher/src/robot_state_publisher.cpp: In member function ‘virtual void robot_state_publisher::RobotStatePublisher::addChildren(std::map<std::basic_string, KDL::TreeElement>::const_iterator)’:
/home/pi/ros_catkin_ws/src/robot_state_publisher/src/robot_state_publisher.cpp:68:20: error: ‘const class urdf::Model’ has no member named ‘getJoint’
if (model_.getJoint(child.getJoint().getName()) && model_.getJoint(child.getJoint().getName())->type == urdf::Joint::FLOATING){
^
/home/pi/ros_catkin_ws/src/robot_state_publisher/src/robot_state_publisher.cpp:68:67: error: ‘const class urdf::Model’ has no member named ‘getJoint’
if (model_.getJoint(child.getJoint().getName()) && model_.getJoint(child.getJoint().getName())->type == urdf::Joint::FLOATING){
^
CMakeFiles/robot_state_publisher_solver.dir/build.make:62: recipe for target 'CMakeFiles/robot_state_publisher_solver.dir/src/robot_state_publisher.cpp.o' failed
make[2]: *** [CMakeFiles/robot_state_publisher_solver.dir/src/robot_state_publisher.cpp.o] Error 1
CMakeFiles/Makefile2:573: recipe for target 'CMakeFiles/robot_state_publisher_solver.dir/all' failed
make[1]: *** [CMakeFiles/robot_state_publisher_solver.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
<== Failed to process package 'robot_state_publisher':

Now I have dug into this and it appears to be when the Boost pointers where removed for C++11 with a compatibility header. I have the latest version of the headers and urdf and it is not clear what I should try next. Do you have any hints? I need to run Kinetic, I had a functioning version of Indigo, but I will be working with the Nvidia Jetson TX2 which runs Kinetic so want the two to be compatible.
Thank you for any help you can offer and if you need further details, please don't hesitate to ask.

Apologies for raising this issue. I fixed it by adding the following in:
ros_catkin_ws/src/robot_state_publisher/CMakeLists.txt

include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-std=c++11 HAS_STD_CPP11_FLAG)
if(HAS_STD_CPP11_FLAG)
  add_compile_options(-std=c++11)
endif()

There is an issue raised on robot_state_publisher https://github.com/ros/robot_state_publisher/issues/76
On a Raspberry Pi 1 model B it takes more than five hours to build all the packages I have included so it was a bit slow to fix.

I think the core issue here was urdfdom_headers 1.0.0 requires c++11, but being header only there are no targets to depend on to get the required compile options

How about adding a dummy target add_library(urdfdom_headers INTERFACE)? I think it would allow set_property(TARGET urdfdom_headers PROPERTY CXX_STANRDARD_REQUIRED 11) . Then robot_state_publisher could have its targets depend on urdfdom_headers and get the required compile options for free.

Possibly same issue as #32

I'll close this since the original issue is solved by ros/robot_state_publisher#76, and there is another ticket about build issues due to not setting the compiler flag for c++11 downstream #32. Feel free to reopen if there's more on this ticket that needs resolution.

@sloretz I guess you wrote the comment to close the issue, but then forgot to close the issue itself?