Ask Your Question
0

How do I debug ld error linking tf2 transform of geometry_msgs::Point32

asked 2019-03-22 13:00:52 -0500

blakejwc gravatar image

Hello ROS Answers,

I'm out of ideas for debugging an linking error on my machine. I need help solving the problem below or advice on how to debug further.

Platform:

  • Distro: Indigo
  • OS: Ubuntu 14.04
  • Kernel: 4.4.0-142-generic
  • gcc: Ubuntu 4.8.5-4ubuntu8~14.04.2

Problem:

Everything was working and building fine until last Monday.

I'm using catkin_make to build a forked version of the pointcloud_to_laserscan package in perception_pcl. Although the The build fails with some linking error while trying to link the pointcloud_to_laserscan_node executable.

The exact command I use is catkin_make --pkg pointcloud_to_laserscan -DCMAKE_CXX_FLAGS:STRING="" -j1. See the error below:

[  0%] Built target _roscpp_generate_messages_check_deps_GetLoggers
[  0%] Built target _roscpp_generate_messages_check_deps_Logger
[  0%] Built target _roscpp_generate_messages_check_deps_Empty
[  0%] Built target _roscpp_generate_messages_check_deps_SetLoggerLevel
[  0%] Built target roscpp_generate_messages_cpp
[  0%] Built target roscpp_gencpp
[100%] Built target roscpp
[100%] Built target pointcloud_to_laserscan
Linking CXX executable /my_catkinws/devel/lib/pointcloud_to_laserscan/pointcloud_to_laserscan_node
/my_catkinws/devel/lib/libpointcloud_to_laserscan.so: error: undefined reference to 'ros::Time const& tf2::getTimestamp<geometry_msgs::Point32_<std::allocator<void> > >(geometry_msgs::Point32_<std::allocator<void> > const&)'
/my_catkinws/devel/lib/libpointcloud_to_laserscan.so: error: undefined reference to 'std::string const& tf2::getFrameId<geometry_msgs::Point32_<std::allocator<void> > >(geometry_msgs::Point32_<std::allocator<void> > const&)'
/my_catkinws/devel/lib/libpointcloud_to_laserscan.so: error: undefined reference to 'void tf2::doTransform<geometry_msgs::Point32_<std::allocator<void> > >(geometry_msgs::Point32_<std::allocator<void> > const&, geometry_msgs::Point32_<std::allocator<void> >&, geometry_msgs::TransformStamped_<std::allocator<void> > const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [/my_catkinws/devel/lib/pointcloud_to_laserscan/pointcloud_to_laserscan_node] Error 1
make[1]: *** [forked/perception_pcl/pointcloud_to_laserscan/CMakeFiles/pointcloud_to_laserscan_node.dir/all] Error 2
make: *** [all] Error 2
Invoking "make -j1" failed

Debuging Notes:

If have tried rolling back to previous commits across my workspace, but all previously building commits fail in the same way above.

If I comment out line 158 (161 with the headers I added), the package builds:

155  for(; iter_x != iter_x.end(); ++iter_x, ++iter_y, ++iter_z){
156  
157    point.x = *iter_x;
158    point.y = *iter_y;
159    point.z = *iter_z;
160    if(!(output.header.frame_id == cloud_msg->header.frame_id)){
161>     //point = tf2_.transform(point, output.header.frame_id, output.header.stamp, cloud_msg->header.frame_id);
162    }

Additionally, I spammed the package with more dependencies and headers. I added tf2_msgs, tf2_sensor_msgs, tf2_geometry_msgs, geometry_msgs, sensor_msgs, and message_generation as build and run dependencies, and I added them to CMakeLists.txt. Below I have the headers for the pointcloud_to_laserscan_nodelet.cpp/h marked with the headers I added to the respective files.

Package Details:

  • pointcloud_to_laserscan 1.2.4
  • tf2_ros 0.5.12
  • geometry_msgs 1.11.8
  • nodelet 1.9.3

Headers in pointcloud_to_laserscan_nodelet.cpp:

41 #include <pointcloud_to_laserscan/pointcloud_to_laserscan_nodelet.h>
42 #include <sensor_msgs/LaserScan.h>
43 #include <pluginlib/class_list_macros.h>
44 #include <sensor_msgs/point_cloud2_iterator.h>
45> #include <tf2_geometry_msgs/tf2_geometry_msgs.h>
46 #include <geometry_msgs/Point32.h>
47> #include <geometry_msgs/TransformStamped.h>
48> #include <geometry_msgs/PointStamped.h>

Headers in pointcloud_to_laserscan_nodelet.h:

44 #include <ros/ros.h>
45 #include <boost/thread/mutex.hpp>
46 
47 #include <nodelet/nodelet.h>
48 #include <tf2/buffer_core.h>
49 #include <tf2_ros/transform_listener.h>
50 #include <tf2_ros/message_filter.h>
51 #include <message_filters ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-03-22 13:22:38 -0500

ahendrix gravatar image

The linker error says that the explicit template specialization of doTransform for geometry_msgs/Point32 does not exist. I cannot find it in https://github.com/ros/geometry2/blob... either, so it seems quite likely that it doesn't exist.

If this code compiled at some point in the past, you may want to go back and figure out if the previous version had some dependency that provided that doTransform.

If you're not able to find it, you may need to implement it yourself. You can just put the template specialization in one of your headers, or near the top of the source file that uses it.

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

2 followers

Stats

Asked: 2019-03-22 13:00:52 -0500

Seen: 96 times

Last updated: Mar 22