Compiling in ROS-Indigo with PCL-1.7.2: Undefined reference to...

Posted by Frank on
URL: http://official-rtab-map-forum.206.s1.nabble.com/Compiling-in-ROS-Indigo-with-PCL-1-7-2-Undefined-reference-to-tp386.html

Hello,

I am trying to compile and run RTAB-Map with ROS Indigo on Ubuntu 14.04. I have also previously installed PCL 1.7.2 and OpenCV 2.4.10, however, rtabmap is unable to compile. I have pulled the latest code from git, compiled and installed rtabmap while specifying the proper -DCMAKE_INSTALL_PREFIX and it compiled fully.

However, when pulling and compiling through ROS with catkin_make, it fails saying:

/home/frank/cv_ros_ws/devel/lib/librtabmap_core.so: undefined reference to `pcl::search::KdTree<pcl::PointNormal, pcl::KdTreeFLANN<pcl::PointNormal, flann::L2_Simple<float> > >::KdTree(bool)'
/home/frank/cv_ros_ws/devel/lib/librtabmap_core.so: undefined reference to `pcl::search::KdTree<pcl::PointXYZ, pcl::KdTreeFLANN<pcl::PointXYZ, flann::L2_Simple<float> > >::setPointRepresentation(boost::shared_ptr<pcl::PointRepresentation<pcl::PointXYZ> const> const&)'
/home/frank/cv_ros_ws/devel/lib/librtabmap_core.so: undefined reference to `pcl::search::KdTree<pcl::PointNormal, pcl::KdTreeFLANN<pcl::PointNormal, flann::L2_Simple<float> > >::setPointRepresentation(boost::shared_ptr<pcl::PointRepresentation<pcl::PointNormal> const> const&)'
/home/frank/cv_ros_ws/devel/lib/librtabmap_core.so: undefined reference to `pcl::search::KdTree<pcl::PointXYZRGB, pcl::KdTreeFLANN<pcl::PointXYZRGB, flann::L2_Simple<float> > >::KdTree(bool)'
/home/frank/cv_ros_ws/devel/lib/librtabmap_core.so: undefined reference to `pcl::search::KdTree<pcl::PointXYZ, pcl::KdTreeFLANN<pcl::PointXYZ, flann::L2_Simple<float> > >::KdTree(bool)'
//usr/local/lib/libopencv_nonfree.so.2.4: undefined reference to `cv::ocl::integral(cv::ocl::oclMat const&, cv::ocl::oclMat&)'
/home/frank/cv_ros_ws/devel/lib/librtabmap_core.so: undefined reference to `pcl::search::KdTree<pcl::PointXYZRGBNormal, pcl::KdTreeFLANN<pcl::PointXYZRGBNormal, flann::L2_Simple<float> > >::KdTree(bool)'
collect2: error: ld returned 1 exit status
make[2]: *** [/home/frank/cv_ros_ws/devel/lib/rtabmap_ros/camera] Error 1
make[1]: *** [rtabmap_ros/CMakeFiles/camera.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs...

I also downloaded the binaries using apt-get install, but it failed after running for 2 seconds. I ran the demo file described below:
roslaunch rtabmap_ros demo_robot_mapping.launch
rosbag play --clock demo_mapping.bag

It complained saying something about symbol lookup error: undefined symbol and the process died. I decoded the symbol code following this post.
It said something about PCL again which leads me to think it's the same problem I had when compiling from source.

Is there a specific way to compile from source when using PCL 1.7.2? I tried changing the CMakeLists.txt file to find_project(PCL 1.7.2 EXACT), but that did not work as well. Any ideas why this is not compiling? I would really want to use rtabmap as it seems like the best package for my robot application :)

Thank you so much for taking the time to read this! Let me know if you need any more information to help answer my question.
-Frank