introlab / rtabmap_ros

RTAB-Map's ROS package.
http://wiki.ros.org/rtabmap_ros
BSD 3-Clause "New" or "Revised" License
930 stars 550 forks source link

Compile errors Ubuntu 14.04 #217

Closed aaravrav142 closed 6 years ago

aaravrav142 commented 6 years ago

Hi,

I am trying to build rtabmap from source. Followed all the instructions carefully. Was able to build rtabmap but when trying to catkin_make on the catkin_ws frequently getting the build error as follows:

/usr/bin/ld: warning: libpointmatcher.so.1, needed by /usr/local/lib/librtabmap_core.so, not found (try using -rpath or -rpath-link)
/usr/local/lib/librtabmap_core.so: undefined reference to `PointMatcher<float>::DataPoints::getDescriptorRowViewByName(std::string const&, unsigned int) const'
/usr/local/lib/librtabmap_core.so: undefined reference to `PointMatcher<float>::DataPoints::DataPoints(PointMatcher<float>::DataPoints::Labels const&, PointMatcher<float>::DataPoints::Labels const&, unsigned long)'
/usr/local/lib/librtabmap_core.so: undefined reference to `PointMatcher<float>::ICPChainBase::setDefault()'
/usr/local/lib/librtabmap_core.so: undefined reference to `PointMatcher<float>::ErrorMinimizer::getWeightedPointUsedRatio() const'
/usr/local/lib/librtabmap_core.so: undefined reference to `PointMatcher<float>::DataPoints::getDescriptorRowViewByName(std::string const&, unsigned int)'
/usr/local/lib/librtabmap_core.so: undefined reference to `PointMatcher<float>::ICPChainBase::ICPChainBase()'
/usr/local/lib/librtabmap_core.so: undefined reference to `PointMatcher<float>::DataPoints::featureExists(std::string const&) const'
/usr/local/lib/librtabmap_core.so: undefined reference to `PointMatcher<float>::ICPChainBase::loadAdditionalYAMLContent(YAML_PM::Node&)'
/usr/local/lib/librtabmap_core.so: undefined reference to `PointMatcher<float>::DataPoints::DataPoints()'
/usr/local/lib/librtabmap_core.so: undefined reference to `PointMatcher<float>::DataPoints::Label::Label(std::string const&, unsigned long)'
/usr/local/lib/libopencv_nonfree.so.2.4.11: undefined reference to `cv::ocl::integral(cv::ocl::oclMat const&, cv::ocl::oclMat&)'
/usr/local/lib/librtabmap_core.so: undefined reference to `PointMatcher<float>::DataPoints::getFeatureViewByName(std::string const&) const'
/usr/local/lib/librtabmap_core.so: undefined reference to `PointMatcher<float>::ICP::operator()(PointMatcher<float>::DataPoints const&, PointMatcher<float>::DataPoints const&)'
/usr/local/lib/librtabmap_core.so: undefined reference to `PointMatcher<float>::ICPChainBase::~ICPChainBase()'
/usr/local/lib/librtabmap_core.so: undefined reference to `PointMatcher<float>::ICPChainBase::loadFromYaml(std::istream&)'
/usr/local/lib/librtabmap_core.so: undefined reference to `PointMatcher<float>::DataPoints::Labels::Labels()'
/usr/local/lib/librtabmap_core.so: undefined reference to `PointMatcher<float>::get()'
/usr/local/lib/librtabmap_core.so: undefined reference to `PointMatcher<float>::DataPoints::getFeatureViewByName(std::string const&)'
/usr/local/lib/librtabmap_core.so: undefined reference to `PointMatcherSupport::InvalidElement::InvalidElement(std::string const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [/home/alex/catkin_ws/devel/lib/rtabmap_ros/icp_odometry] Error 1
make[1]: *** [rtabmap_ros/CMakeFiles/icp_odometry.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

\ My CMake config after invoking cmake .. is as following

~/rtabmap/build$ cmake ..
-- Found OpenMP
-- Found OpenCV: /usr/local/include/opencv;/usr/local/include
-- Found PCL: /usr/include/pcl-1.7;/usr/include/eigen3;/usr/include;/usr/include/ni;/usr/include/openni2;/usr/include/vtk-5.8
-- Found ZLIB: /usr/include
-- Found Freenect: /usr/include
CMake Warning at cmake_modules/FindKinectSDK2.cmake:71 (message):
  Directory "" not found.
Call Stack (most recent call first):
  cmake_modules/FindKinectSDK2.cmake:119 (check_dir)
  CMakeLists.txt:270 (FIND_PACKAGE)

-- KinectSDK2_FOUND : FALSE
-- Found OpenNI2: /usr/include/openni2
-- Found DC1394: /usr/include/dc1394
-- Found g2o: /opt/ros/indigo/include;/usr/include/suitesparse;/usr/include/suitesparse
-- GTSAM include directory:  /usr/local/lib/cmake/GTSAM/../../../include;/usr/include;/usr/local/include/gtsam/3rdparty/Eigen/
-- Found cvsba: /usr/local/include
-- Found libpointmatcher: /usr/include;/usr/include/eigen3;/home/alex/catkin_ethzasl_lib/ws1/devel_isolated/libnabo/include;/home/alex/catkin_ethzasl_lib/ws1/src/libpointmatcher/contrib/yaml-cpp-pm/include;/home/alex/catkin_ethzasl_lib/ws1/src/libpointmatcher;/home/alex/catkin_ethzasl_lib/ws1/src/libpointmatcher/pointmatcher
-- Found RealSense: /opt/ros/indigo/include
-- Found octomap: /opt/ros/indigo/include
-- Found Pthreads
-- --------------------------------------------
-- Info :
--   Version : 0.15.0
--   CMAKE_INSTALL_PREFIX = /usr/local
--   CMAKE_BUILD_TYPE =     Release
--   CMAKE_INSTALL_LIBDIR = lib
--   BUILD_APP =            ON
--   BUILD_TOOLS =          ON
--   BUILD_EXAMPLES =       ON
--   BUILD_SHARED_LIBS =    ON
--   CMAKE_CXX_FLAGS =  -fmessage-length=0  -Wno-deprecated -fopenmp -std=c++11
--   With OpenCV 2 nonfree module (SIFT/SURF) = YES (License: Non commercial)
--   With Freenect             = YES (License: Apache v2 and/or GPLv2)
--   With OpenNI2              = YES (License: Apache v2)
--   With Freenect2            = NO (libfreenect2 not found)
--   With Kinect for Windows 2 = NO (Kinect for Windows 2 SDK not found)
--   With dc1394               = YES (License: LGPL)
--   With FlyCapture2/Triclops = NO (Point Grey SDK not found)
--   With TORO                 = YES (License: Creative Commons [Attribution-NonCommercial-ShareAlike])
--   With g2o                  = YES (License: BSD)
--   With GTSAM                = YES (License: BSD)
--   With VERTIGO              = YES (License: GPLv3)
--   With cvsba                = YES (License: GPLv2)
--   With libpointmatcher      = YES (License: BSD)
--   With ZED                  = NO (ZED sdk not found)
--   With RealSense            = YES (License: Apache-2)
--   With RealSenseSlam        = NO (WITH_REALSENSE_SLAM=OFF)
--   With OCTOMAP              = YES (License: BSD)
--   With CPUTSDF              = NO (CPUTSDF not found)
--   With libfovis             = NO (libfovis not found)
--   With libviso2             = NO (libviso2 not found)
--   With dvo_core             = NO (dvo_core not found)
--   With ORB_SLAM2            = NO (WITH_G2O should be OFF as ORB_SLAM2 uses its own g2o version)
--   With Qt4                  = YES (License: Open Source or Commercial)
-- --------------------------------------------
-- Configuring done
-- Generating done
-- Build files have been written to: /home/alex/rtabmap/build

Can you suggest something. Thanks

matlabbe commented 6 years ago

Can you do "ldd /usr/local/lib/librtabmap_core.so" to see if ldd can actually find libpointmatcher.so.1 library?

EDIT: You may have to edit LD_LIBRARY_PATH to add /usr/local/lib, then do "sudo ldconfig".

aaravrav142 commented 6 years ago

Hi, This solved the problem. I had to edit the LD_LIBRARY_PATH. But then again I am facing another error:

/usr/local/lib/libopencv_nonfree.so.2.4.11: undefined reference to `cv::ocl::integral(cv::ocl::oclMat const&, cv::ocl::oclMat&)'
collect2: error: ld returned 1 exit status

Although OpenCV was installed earlier and rtabmap build did not complain about OpenCL, i am not sure why rtabmap_ros cannot find it.

matlabbe commented 6 years ago

That problem should have been fixed since 2015, see http://official-rtab-map-forum.206.s1.nabble.com/catkin-make-ros-pkg-failed-td22.html

You can try a clean catkin build (delete catkin_ws/build folder and redo catkin_make)

aaravrav142 commented 6 years ago

Hi, I know this should have been solved. Do not know why it is coming up now. I build openCV 2 with openCL = off and everything works fine now. I will dig into this later. Thanks a lot Mathieu for the help.