Ubuntu16.04,ROS kinectic
报错信息为“
make[2]: *** No rule to make target ‘/home/william/slam/g2o/lib/libg2o_csparse_extension.so‘, needed by ‘/home/william/catkin_ws/devel/lib/rgbdslam/rgbdslam‘. Stop.
CMakeFiles/Makefile2:5881: recipe for target ‘rgbdslam_v2/CMakeFiles/rgbdslam.dir/all‘ failed
make[1]: *** [rgbdslam_v2/CMakeFiles/rgbdslam.dir/all] Error 2
Makefile:127: recipe for target ‘all‘ failed
make: *** [all] Error 2
Invoking "make -j4 -l4" failed
”
报错原因如下:
1. 先是按照https://github.com/felixendres/rgbdslam_v2上的README.md来安装
2. 出现G2O引起的bug,在编译安装g2o时通过,却在编译rgbdslam中报错,依照https://hubpages.com/technology/Instructions-for-compiling-rgbdslam-v2-on-a-fresh-Ubuntu-1604-install-ros-kinetic-in-virtualbox中的6,解决了
缺少依赖,执行sudo apt-get install libsuitesparse-dev(装依赖后再装G2O会好一点),在报错之后安装依赖,如果不行,就装完依赖后再安装g2o
我觉得本次主要讲的大bug就是从这里引起的
3. 遇到https://blog.csdn.net/zhuoyueljl/article/details/78536996?reload中,“required process[rgbdslam-2] has died”......Iinitiating down”问题,解决后,编译出现needed by错误
解决方法为:
工作空间(也有可能是编译G2O时才会出现)的cmake_modules中有个FindG2O.cmake的文件,将其移除掉就可以了,因为用3的方法,make install了G2O,因此不需要cmake_modules来找G2O的包
PS:反思几点
1 使用grep搜索文件中的文本信息,语法是
grep -rw PATTERN [file]
1. 在CMakeLists.txt中,设置找包的路径:
set(G2O ‘包的绝对路径’)
原文地址:https://www.cnblogs.com/williamc17/p/9245131.html