davidmball / ratslam

Automatically exported from code.google.com/p/ratslam
GNU General Public License v3.0
156 stars 59 forks source link

catkin_make failed #11

Closed sunt40 closed 5 years ago

sunt40 commented 5 years ago

I catkin_make with ubuntu16.04 ROSkinetic Opencv3.4 . The result is as follow,how to solve it? home/sunt/catkin_ws/devel/lib/libratslam.so:对‘cv::String::deallocate()’未定义的引用

collect2: error: ld returned 1 exit status

ratslam_ros/CMakeFiles/ratslam_pc.dir/build.make:132: recipe for target '/home/sunt/catkin_ws/devel/lib/ratslam_ros/ratslam_pc' failed

make[2]: *** [/home/sunt/catkin_ws/devel/lib/ratslam_ros/ratslam_pc] Error 1

CMakeFiles/Makefile2:494: recipe for target 'ratslam_ros/CMakeFiles/ratslam_pc.dir/all' failed

make[1]: *** [ratslam_ros/CMakeFiles/ratslam_pc.dir/all] Error 2

make[1]: *** 正在等待未完成的任务....

/home/sunt/catkin_ws/devel/lib/libratslam.so:对‘cv::String::deallocate()’未定义的引用

collect2: error: ld returned 1 exit status

ratslam_ros/CMakeFiles/ratslam_em.dir/build.make:132: recipe for target '/home/sunt/catkin_ws/devel/lib/ratslam_ros/ratslam_em' failed

make[2]: *** [/home/sunt/catkin_ws/devel/lib/ratslam_ros/ratslam_em] Error 1

CMakeFiles/Makefile2:1588: recipe for target 'ratslam_ros/CMakeFiles/ratslam_em.dir/all' failed

make[1]: *** [ratslam_ros/CMakeFiles/ratslam_em.dir/all] Error 2

Makefile:138: recipe for target 'all' failed

make: *** [all] Error 2

Invoking "make -j8 -l8" failed

scott-- commented 5 years ago

@sunt40 I found the same problem on my current setup - Ubuntu 18.10 with ROS melodic.

I modified the CMakeLists.txt file to add additional OpenCV dependencies, and it fixed the problem for me.

Try updating to the latest version and see if it fixes the problem.

sunt40 commented 5 years ago

@scott-- Thank you very much!

texonidas commented 5 years ago

@scott-- what additional OpenCV dependencies did you need to add? Running into this same issue myself.

scott-- commented 5 years ago

I only modified the CMakeLists.txt to apply the same dependencies to all the executables. The structure is such that there are 4 executables: ratslam_lv, ratslam_pc, ratslam_em, and ratslam_vo, that all link against the same library: libratslam.so.

libratslam.so depends on OpenCV (I'm currently using version 3.2), but only ratslam_vo uses functionality that depends on OpenCV. So at some point, only ratslam_vo was linked against OpenCV and everything worked fine, but with my current g++ (version 8.2), this is no longer the case.

See here for this (3 line) change: https://github.com/davidmball/ratslam/commit/2a7542a621bd1efe573aa61f466b7965714e5357

texonidas commented 5 years ago

@scott-- I've edited out the stuff I had posted here, turns out my Ubuntu box was running out of memory, and adding a GB of swap memory made the magic happen.

Anyone else having their build hang on an EC2 instance, you probably just need more memory.