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

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Frank
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
Reply | Threaded
Open this post in threaded view
|

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

matlabbe
Administrator
Hi,

I tried yesterday building the latest source on Ubuntu 14.04 Indigo and no problems (using ROS Indigo binaries for PCL and OpenCV).

Note that if you install the binaries, the rtabmap built from source should not be installed, otherwise the binaries ros-indigo-rtabmap-ros would link on rtabmap package built from source (in the catkin workspace) instead of the one installed with ros-indigo-rtabmap. The rtabmap libraries are different between source and binaries, which may cause linking errors on runtime if one finds the libraries of the other version first.

What is exactly the error when you launch the binaries?

cheers
Reply | Threaded
Open this post in threaded view
|

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

Frank
This post was updated on .
Alright.
I am trying this now:
1. I have uninstalled the source files by doing sudo make uninstall (from the build folder of rtabmap).
2. re-installed the binaries (not source) by sudo apt-get install ros-indigo-rtabmap-ros
3. i launch the demo by
roslaunch rtabmap_ros demo_robot_mapping.launch
rosbag play --clock demo_mapping.bag
4. and here is the output as well as error (last few lines)

[ INFO] [1430606789.997768580]: Starting node...
[ INFO] [1430606790.064827724]: rtabmap: frame_id = base_footprint
[ INFO] [1430606790.064935751]: rtabmap: map_frame_id = map
[ INFO] [1430606790.064975534]: rtabmap: queue_size = 10
[ INFO] [1430606790.065023223]: rtabmap: tf_delay = 0.050000
[ INFO] [1430606790.170893240]: Setting RTAB-Map parameter "LccBow/InlierDistance"="0.1"
[ INFO] [1430606790.173544220]: Setting RTAB-Map parameter "LccBow/MaxDepth"="0.0"
[ INFO] [1430606790.178827672]: Setting RTAB-Map parameter "LccIcp/Type"="2"
[ INFO] [1430606790.329131056]: Setting RTAB-Map parameter "RGBD/LocalLoopDetectionSpace"="true"
[ INFO] [1430606790.329814987]: Setting RTAB-Map parameter "RGBD/LocalLoopDetectionTime"="false"
[ INFO] [1430606790.334837269]: Setting RTAB-Map parameter "RGBD/OptimizeFromGraphEnd"="false"
[ INFO] [1430606790.335575531]: Setting RTAB-Map parameter "RGBD/PoseScanMatching"="true"
[ INFO] [1430606790.586038749]: RTAB-Map rate detection = 1.000000 Hz
[ INFO] [1430606790.649546224]: rtabmap: Deleted database "/home/frank/.ros/rtabmap.db" (--delete_db_on_start is set).
[ INFO] [1430606790.649604196]: rtabmap: Using database from "/home/frank/.ros/rtabmap.db".
[ INFO] [1430606791.453759532]: Starting node...
[ INFO] [1430606792.669150185]: rtabmapviz: Using configuration from "/opt/ros/indigo/share/rtabmap_ros/launch/config/rgbd_gui.ini"
[ INFO] [1430606795.222827302]: Registering Depth+LaserScan callback...
[ INFO] [1430606795.226908443]: rtabmap started...
[ INFO] [1430606795.602759693]: Reading parameters from the ROS server...
[ INFO] [1430606795.698753932]: Parameters read = 160
[ INFO] [1430606795.698804031]: Parameters successfully read.
[ INFO] [1430606795.976236318]: Registering Depth+LaserScan callback...
[ INFO] [1430606795.988303668]: rtabmapviz started.
[ WARN] [1430606803.276944414, 1368730003.593206127]: Lookup would require extrapolation into the past.  Requested time 1368730003.446602750 but the earliest data is at time 1368730003.924972857, when looking up transform from frame [base_laser_link] to frame [base_footprint]
[ WARN] [1430606803.382188234, 1368730003.694028431]: Lookup would require extrapolation into the past.  Requested time 1368730003.521858750 but the earliest data is at time 1368730003.924972857, when looking up transform from frame [base_laser_link] to frame [base_footprint]
[ WARN] [1430606803.476801834, 1368730003.794814477]: Lookup would require extrapolation into the past.  Requested time 1368730003.596578750 but the earliest data is at time 1368730003.924972857, when looking up transform from frame [base_laser_link] to frame [base_footprint]
[ WARN] [1430606803.477290592, 1368730003.794814477]: Lookup would require extrapolation into the future.  Requested time 1368730003.721525750 but the latest data is at time 1368730003.707868865, when looking up transform from frame [base_laser_link] to frame [base_footprint]
[ WARN] [1430606803.758676397, 1368730004.072299446]: Lookup would require extrapolation into the past.  Requested time 1368730003.896618750 but the earliest data is at time 1368730003.924972857, when looking up transform from frame [base_laser_link] to frame [base_footprint]
[ WARN] [1430606804.276030368, 1368730004.596970035]: Could not get transform from base_footprint to base_laser_link after 1 second!
[ WARN] [1430606804.364572722, 1368730004.677735584]: Use depth image with "unsigned short" type to avoid conversion. This message is only printed once...
/opt/ros/indigo/lib/rtabmap_ros/rtabmap: symbol lookup error: /opt/ros/indigo/lib/rtabmap_ros/rtabmap: undefined symbol: _ZN11rtabmap_ros13mapGraphToROSERKSt3mapIiN7rtabmap9TransformESt4lessIiESaISt4pairIKiS2_EEERKS0_IiiS4_SaIS5_IS6_iEEERKSt8multimapIiNS1_4LinkES4_SaIS5_IS6_SI_EEERKS2_RNS_6Graph_ISaIvEEE
[rtabmap/rtabmap-2] process has died [pid 3816, exit code 127, cmd /opt/ros/indigo/lib/rtabmap_ros/rtabmap --delete_db_on_start odom:=/az3/base_controller/odom scan:=/jn0/base_scan rgb/image:=/data_throttled_image depth/image:=/data_throttled_image_depth rgb/camera_info:=/data_throttled_camera_info __name:=rtabmap __log:=/home/frank/.ros/log/1255c5d8-f11d-11e4-8d7b-acb57d02f12d/rtabmap-rtabmap-2.log].
log file: /home/frank/.ros/log/1255c5d8-f11d-11e4-8d7b-acb57d02f12d/rtabmap-rtabmap-2*.log


-----------
I tried installing the rtabmap (binaries) on a friends computer last night. He had Ubuntu 14.04 and ROS Indigo (ROS indigo binaries for PCL and OpenCV just like yourself) and the demo worked flawlessly. I however, have PCL 1.7.2 installed as well as OpenCV 2.4.10 (i am using them both for the project and wish to use rtabmap as well).

Please let me know if any of this makes sense to you.
Thank you very much :)
-Frank

----
Update 1:
Using c++filt on the symbol above:
echo _ZN11rtabmap_ros13mapGraphToROSERKSt3mapIiN7rtabmap9TransformESt4lessIiESaISt4pairIKiS2_EEERKS0_IiiS4_SaIS5_IS6_iEEERKSt8multimapIiNS1_4LinkES4_SaIS5_IS6_SI_EEERKS2_RNS_6Graph_ISaIvEEE|c++filt

results in:
rtabmap_ros::mapGraphToROS(std::map<int, rtabmap::Transform, std::less<int>, std::allocator<std::pair<int const, rtabmap::Transform> > > const&, std::map<int, int, std::less<int>, std::allocator<std::pair<int const, int> > > const&, std::multimap<int, rtabmap::Link, std::less<int>, std::allocator<std::pair<int const, rtabmap::Link> > > const&, rtabmap::Transform const&, rtabmap_ros::Graph_<std::allocator<void> >&)

Thanks
Reply | Threaded
Open this post in threaded view
|

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

matlabbe
Administrator
rtabmap_ros::mapGraphToROS() has not the same interface between latest code source (0.8.12) and the binaries (0.8.3).

The binaries are looking for the 0.8.3 version, instead it finds on runtime the recent version of librtabmap_ros library (generated from the rtabmap_ros package). Make sure that in your~/catkin_ws/devel/lib, librtabmap_ros.so is not here (as well as all other librtabmap_*.so).
Reply | Threaded
Open this post in threaded view
|

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

Frank
This post was updated on .
Thanks for the reply!
Okay, I tried:

1) uninstalled rtabmap binaries
sudo apt-get remove ros-indigo-rtabmap*

2) I removed everything related to rtabmap in my lib forlder:
 (i removed all of the rtabmap stuff)

(removed)


3) re-installed the binaries
sudo apt-get install ros-indigo-rtabmap-ros

4) sourced the binaries workspace
source /opt/ros/indigo/setup.bash

5) ran the demo
roslaunch rtabmap_ros demo_robot_mapping.launch
rosbag play --clock demo_mapping.bag

6) the output is as follows:

[ INFO] [1430780676.609884383]: Starting node...
[ INFO] [1430780676.610201356]: Starting node...
[ INFO] [1430780676.681968082]: rtabmap: frame_id = base_footprint
[ INFO] [1430780676.682028525]: rtabmap: map_frame_id = map
[ INFO] [1430780676.682045257]: rtabmap: queue_size = 10
[ INFO] [1430780676.682066072]: rtabmap: tf_delay = 0.050000
[ INFO] [1430780676.756005263]: rtabmapviz: Using configuration from "/opt/ros/indigo/share/rtabmap_ros/launch/config/rgbd_gui.ini"
[ INFO] [1430780676.805853032]: Setting RTAB-Map parameter "LccBow/InlierDistance"="0.1"
[ INFO] [1430780676.808597933]: Setting RTAB-Map parameter "LccBow/MaxDepth"="0.0"
[ INFO] [1430780676.813676320]: Setting RTAB-Map parameter "LccIcp/Type"="2"
[ INFO] [1430780676.986151354]: Setting RTAB-Map parameter "RGBD/LocalLoopDetectionSpace"="true"
[ INFO] [1430780676.987043230]: Setting RTAB-Map parameter "RGBD/LocalLoopDetectionTime"="false"
[ INFO] [1430780676.992076210]: Setting RTAB-Map parameter "RGBD/OptimizeFromGraphEnd"="false"
[ INFO] [1430780676.992706493]: Setting RTAB-Map parameter "RGBD/PoseScanMatching"="true"
[ INFO] [1430780677.196148468]: RTAB-Map rate detection = 1.000000 Hz
[ INFO] [1430780677.196266464]: rtabmap: Deleted database "/home/frank/.ros/rtabmap.db" (--delete_db_on_start is set).
[ INFO] [1430780677.196294881]: rtabmap: Using database from "/home/frank/.ros/rtabmap.db".
[ INFO] [1430780679.535643095]: Reading parameters from the ROS server...
[ INFO] [1430780679.632737115]: Parameters read = 160
[ INFO] [1430780679.632780730]: Parameters successfully read.
[ INFO] [1430780679.989173444]: Registering Depth+LaserScan callback...
[ INFO] [1430780680.005879212]: rtabmapviz started.
[ INFO] [1430780681.421181167]: Registering Depth+LaserScan callback...
[ INFO] [1430780681.425888948]: rtabmap started...
[ WARN] [1430780694.289810701, 1368730003.591011384]: Lookup would require extrapolation into the past.  Requested time 1368730003.446602750 but the earliest data is at time 1368730003.965610098, when looking up transform from frame [base_laser_link] to frame [base_footprint]
[ WARN] [1430780694.396128407, 1368730003.702068083]: Lookup would require extrapolation into the past.  Requested time 1368730003.521858750 but the earliest data is at time 1368730003.965610098, when looking up transform from frame [base_laser_link] to frame [base_footprint]
[ WARN] [1430780694.492963733, 1368730003.792808273]: Lookup would require extrapolation into the past.  Requested time 1368730003.596578750 but the earliest data is at time 1368730003.965610098, when looking up transform from frame [base_laser_link] to frame [base_footprint]
[ WARN] [1430780694.652662785, 1368730003.953971980]: Lookup would require extrapolation into the past.  Requested time 1368730003.721525750 but the earliest data is at time 1368730003.965610098, when looking up transform from frame [base_laser_link] to frame [base_footprint]
[ WARN] [1430780694.683855956, 1368730003.984162321]: Lookup would require extrapolation into the past.  Requested time 1368730003.871489750 but the earliest data is at time 1368730003.965610098, when looking up transform from frame [base_laser_link] to frame [base_footprint]
[ WARN] [1430780695.292200393, 1368730004.599848293]: Could not get transform from base_footprint to base_laser_link after 1 second!
[ WARN] [1430780696.299412695, 1368730005.606087500]: Could not get transform from base_footprint to base_laser_link after 1 second!
[ WARN] [1430780696.477603878, 1368730005.777524988]: Use depth image with "unsigned short" type to avoid conversion. This message is only printed once...
[ INFO] [1430780696.630476441, 1368730005.929071965]: rtabmap: Update rate=1.000000s, Limit=0.000000s, Processing time = 0.153744s (1 local nodes)
[ WARN] (2015-05-04 16:04:57.668) Memory.cpp:2009::computeIcpTransform() Clouds 2D empty ?!?
[ WARN] (2015-05-04 16:04:57.668) Rtabmap.cpp:873::process() Scan matching rejected: Clouds 2D empty ?!?
[ INFO] [1430780697.669335896, 1368730006.976816503]: rtabmap: Update rate=1.000000s, Limit=0.000000s, Processing time = 0.105409s (2 local nodes)
/opt/ros/indigo/lib/rtabmap_ros/rtabmapviz: symbol lookup error: /opt/ros/indigo/lib/x86_64-linux-gnu/librtabmap_core.so.0.8: undefined symbol: _ZN3pcl6search6KdTreeINS_8PointXYZEEC1Eb
[rtabmap/rtabmapviz-3] process has died [pid 11520, exit code 127, cmd /opt/ros/indigo/lib/rtabmap_ros/rtabmapviz -d /opt/ros/indigo/share/rtabmap_ros/launch/config/rgbd_gui.ini rgb/image:=/data_throttled_image depth/image:=/data_throttled_image_depth rgb/camera_info:=/data_throttled_camera_info scan:=/jn0/base_scan odom:=/az3/base_controller/odom __name:=rtabmapviz __log:=/home/frank/.ros/log/ea15f354-f2b1-11e4-b5ce-acb57d02f12d/rtabmap-rtabmapviz-3.log].
log file: /home/frank/.ros/log/ea15f354-f2b1-11e4-b5ce-acb57d02f12d/rtabmap-rtabmapviz-3*.log


Using c++filt on the symbol above:
echo _ZN3pcl6search6KdTreeINS_8PointXYZEEC1Eb|c++filt
pcl::search::KdTree<pcl::PointXYZ>::KdTree(bool)

---
Looks like it is complaining about PCL now. I have both PCL (ros binaries) and PCL 1.7.2 installed. Do you think it is linking with 1.7.2 but requires the ROS version?

Thanks,
-Frank

---
Update 1:
I uninstalled PCL 1.7.2 and tried again.
1) sudo make uninstall (from the build folder of pcl)
2) Then i reinstalled the rtabmap binaries.
3) Then I ran the demo and it worked perfectly.

How can I specify for the binaries to link with pcl_ros and not PCL 1.7.2? I want to keep 1.7.2 installed since I'm developing with it. I will try again compiling from source but I'm not sure how to make it link with pcl_ros and not PCL 1.7.2. I will update how it goes.

---
Update 2:
I compiled from source by following these steps:
1) uninstalled the binaries
sudo apt-get remove ros-indigo-rtabmap-ros

2) pulled from git and compiled rtabmap
it compiled fine

3) pulled from git and compiled rtabmap_ros using catkin_make. It failed.
Here is the failure:


How do you make rtabmap_ros link with PCL 1.7.2?

Thanks!
Reply | Threaded
Open this post in threaded view
|

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

matlabbe
Administrator
I tried your setup and I reproduced the "pcl::search::KdTree" error. The easier solution I've found is to uninstall libpcl-1.7-all and all ros packages depending on it like ros-indigo-perception-pcl, ros-indigo-pcl-ros, ros-indigo-pcl-conversions.

Now get pcl_conversions and perception_pcl, and put them in your catkin workspace to build with catkin_make. They should build while linking to PCL 1.7.2 installed in your /usr/local. After that, building RTAB-Map is done as usual.

cheers
Reply | Threaded
Open this post in threaded view
|

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

Frank
How should I "uninstall libpcl-1.7-all"? sudo apt-get remove?
Is this the pcl that comes with ROS, or pcl 1.7.2? I'm assuming it's not 1.7.2 since you stated that pcl_conversions and perception_pcl would link with PCL 1.7.2.

So we are effectively causing pcl_conversions and perception_pcl (which rtabmap relies on) to link with PCL 1.7.2 and thus allow the build of rtabmap to use 1.7.2?

Thanks a ton Matlabbe.
-Frank
Reply | Threaded
Open this post in threaded view
|

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

matlabbe
Administrator
Yes, ROS installs PCL 1.7.1-3 (libpcl-1.7-all): the packages ros-indigo-perception-pcl, ros-indigo-pcl-ros and ros-indigo-pcl-conversions installed by ROS depend on it. I just noticed that you don't have to remove libpcl-1.7-all already installed by ROS, you should only remove the pcl ROS packages and build them again in your workspace (they will link on the first pcl found, which is the one in /usr/local/lib instead of the one in /usr/lib).

In summary to use 1.7.2:
Build/Install PCL 1.7.2 (in /usr/local by default):
$ git clone https://github.com/PointCloudLibrary/pcl.git pcl-1.7.2
$ cd pcl-1.7.2
$ git checkout tags/pcl-1.7.2
$ mkdir build
$ cmake ..
$ make
$ sudo make install

Remove indigo pcl packages:
$ sudo apt-get remove ros-indigo-perception-pcl ros-indigo-pointcloud-to-laserscan ros-indigo-pcl-ros ros-indigo-pcl-conversions

Build indigo pcl packages:
$ roscd
$ cd ../src
$ git clone -b indigo-devel https://github.com/ros-perception/pcl_conversions.git
$ git clone -b indigo-devel https://github.com/ros-perception/perception_pcl.git

$ cd ..
$ catkin_make


Now you can follow the RTAB-Map's installation instructions. Everything should be linked on your PCL 1.7.2 built from source.

cheers

Reply | Threaded
Open this post in threaded view
|

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

matlabbe
Administrator
Note that PCL 1.7.2 is the default one for Ubuntu utopic (14.10) and vivid (15.04). Well, ROS Jade should be used too for these versions.