编译ORB-SLAM2问题记录及解决办法

安装运行ORBSLAM2过程记录

1、下载源码

git clone https://github.com/raulmur/ORB_SLAM2.git ORB_SLAM2

2、编译

cd ORB_SLAM2/

chmod 777 build.sh

./build.sh

报错1

-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc - broken
CMake Error at /usr/local/share/cmake-3.22/Modules/CMakeTestCCompiler.cmake:69 (message):
  The C compiler

    "/usr/bin/cc"

  is not able to compile a simple test program.

解决办法

sudo apt-get remove gcc

卸载所有gcc,然后重新装就解决了

sudo apt-get install build-essential

不知道为啥就这样解决了

3、编译过程报错

(1)

error: use of undeclared identifier 'usleep'

解决办法:

在ORB_SLAM2/include/System.h文件中添加引用头文件:

#include

(2)编译ORB_SLAM2 ros时报错

CMake Error at /opt/ros/melodic/share/ros/core/rosbuild/private.cmake:99 (message):
  [rosbuild] rospack found package "ORB_SLAM2" at "", but the current
  directory is "/home/XXX/ORB_SLAM2/Examples/ROS/ORB_SLAM2".  You should
  double-check your ROS_PACKAGE_PATH to ensure that packages are found in the
  correct precedence order.

解决办法:

export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:/XXX/ORB_SLAM2/Examples/ROS

其中XXX表示自己的ORB_SLAM文件夹路径。

(3)

/usr/bin/ld: CMakeFiles/RGBD.dir/src/ros_rgbd.cc.o: undefined reference to symbol '_ZN5boost6system15system_categoryEv'
/usr/lib/x86_64-linux-gnu/libboost_system.so: error adding symbols: DSO missing from command line

解决办法:

修改CMakelists.txt:

find_package( Boost REQUIRED )

改为

find_package( Boost REQUIRED COMPONENTS filesystem )

你可能感兴趣的:(#,视觉SLAM学习,计算机视觉,人工智能)