在编译ROS下的ORB-SLAM2时,需要重新编译源文件./build_ros.sh
但在运行时出现下列问题:
/usr/bin/ld: CMakeFiles/Stereo.dir/src/ros_stereo.cc.o: undefined reference to symbol '_ZN5boost6system15system_categoryEv'
/usr/lib/x86_64-linux-gnu/libboost_system.so: 无法添加符号: DSO missing from command line
collect2: error: ld returned 1 exit status
CMakeFiles/Stereo.dir/build.make:182: recipe for target '../Stereo' failed
make[2]: *** [../Stereo] Error 1
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/Stereo.dir/all' failed
make[1]: *** [CMakeFiles/Stereo.dir/all] Error 2
通过查阅资料,发现出错原因是libboost_system.so 与libboost_filesystem.so找不到链接目录。
解决方案
1.查找boost_system和boost_filesystem的目录
locate boost_system
/snap/gnome-3-26-1604/70/usr/lib/x86_64-linux-gnu/libboost_system.so.1.58.0
/snap/gnome-3-26-1604/98/usr/lib/x86_64-linux-gnu/libbo