https://www.imooc.com/article/details/id/29136
1. 提示“CMAKE_CXX_COMPILER-NOTFOUND ”
具体形式:
Check for working CXX compiler: CMAKE_CXX_COMPILER-NOTFOUND
CMake Error: your CXX compiler: "CMAKE_CXX_COMPILER-NOTFOUND" was not found.
Please set CMAKE_CXX_COMPILER to a valid compiler path or name.
解决方法:
sudo apt-get install g++
2.(1)在ubuntu18.04系统上安装opencv但是在安装依赖包的过程中,有一个依赖包,libjasper-dev在使用命令
sudo apt-get install libjaster-dev
提示:无法定位软件包 libjasper-dev
后来google到解决办法,复制到这里
sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"
sudo apt update
sudo apt install libjasper1 libjasper-dev
成功的解决了问题,其中libjasper1是libjasper-dev的依赖包
(2)提示“ROS / OpenCV Ubuntu安装“usr/include/c++/6/cstdlib:75:25: fatal error: stdlib.h: 没有那个文件或目录””
解决办法:
预编译的问题,在编译前加入命令屏蔽预编译就行了
-D ENABLE_PRECOMPILED_HEADERS=OFF
3. 注意eigen 本人亲测Eigen3.2.10
wget https://bitbucket.org/eigen/eigen/get/3.2.10.tar.bz2
tar -xjf 3.2.10.tar.bz2
改文件夹名字
cd eigen
mkdir build
cd build
cmake ..
make
sudo make install
4. ImportError: No module named catkin_pkg.package
注意Python版本 ros-melodic对应Python3
5. 编译安装python3.7时
提示“ModuleNotFoundError: No module named '_ctypes'”
解决办法
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get install build-essential python-dev python-setuptools python-pip python-smbus
sudo apt-get install build-essential libncursesw5-dev libgdbm-dev libc6-dev
sudo apt-get install zlib1g-dev libsqlite3-dev tk-dev
sudo apt-get install libssl-dev openssl
sudo apt-get install libffi-dev
安装完libffi后在编译安装就不报错了
6. 编译./build_ros.sh
提示[rosbuild] rospack found package "ORB_SLAM2" at "", but the current directory is "/home/angelo/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.
解决办法:输入
sudo ln -s ~/ORB_SLAM2/Examples/ROS/ORB_SLAM2 /opt/ros/<ros版本名>/share/ORB_SLAM2
7. 编译遇到找不到#include<Eigen/Dense>
解决办法:进入usr/local/include/eigen3将eigen3中的Eigen文件递归地复制到上一层文件夹(直接放到include):因为在很多程序中include时经常使用#include <Eigen/Dense>而不是使用的#include <eigen3/Eigen/Dense>所以要做下处理,否则一些程序在编译时会因找不到Eigen/Dense而报错。
8. 编译遇到libboost_system.so: 无法添加符号: DSO missing from command line
解决办法:在Examples/ROS/ORB_SLAM2/Cmakelist.txt 的文件后面加入两句话:
target_link_libraries(Stereo boost_system boost_filesystem)
target_link_libraries(RGBD boost_system boost_filesystem)
9.安装Opencv的时候
提示
CMake Error at cmake/OpenCVDetectCXXCompiler.cmake:85 (list):
list GET given empty list
Call Stack (most recent call first):
CMakeLists.txt:109 (include)
CMake Error at cmake/OpenCVDetectCXXCompiler.cmake:86 (list):
list GET given empty list
Call Stack (most recent call first):
CMakeLists.txt:109 (include)
CMake Error at cmake/OpenCVDetectCXXCompiler.cmake:89 (math):
math cannot parse the expression: "*100 + ": syntax error, unexpected
exp_TIMES, expecting exp_OPENPARENT or exp_NUMBER (1)
Call Stack (most recent call first):
CMakeLists.txt:109 (include)
解决办法:
在文件opencv/cmake/OpenCVDetectCXXCompiler.cmake中,将“dumpversion”改为“dumpfullversion”
10.编译ORB_SLAM2_ROS时
①提示以下错误:
/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: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
解决方案:
将libboost_system.so与libboost_filesystem.so复制到ORB_SLAM2/lib下
locate boost_system
locate boost_filesystem
并且将ORBSLAM2/Examples/ROS/ORBSLAM2下的Cmakelists.txt中加入库目录,具体为
set(LIBS
${OpenCV_LIBS}
${EIGEN3_LIBS}
${Pangolin_LIBRARIES}
${PROJECT_SOURCE_DIR}/../../../Thirdparty/DBoW2/lib/libDBoW2.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o/lib/libg2o.so
${PROJECT_SOURCE_DIR}/../../../lib/libORB_SLAM2.so
${PROJECT_SOURCE_DIR}/../../../lib/libboost_filesystem.so
${PROJECT_SOURCE_DIR}/../../../lib/libboost_system.so
)
②提示以下内容
[rosbuild] rospack found package "ORB_SLAM2" at "", but the current directory is "/home/angelo/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.
Call Stack (most recent call first):
/opt/ros/kinetic/share/ros/core/rosbuild/public.cmake:177 (_rosbuild_check_package_location)
CMakeLists.txt:4 (rosbuild_init)
解决办法:
这通常是因为没有设置好 ORB_SLAM2 的环境变量或者前后设置存在冲突。请打开 ~/.bash.rc 文件,检查以下设置是否正确:
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:PATH/ORB_SLAM2/Examples/ROS
11.提示
error: static assertion failed: YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY
解决方法:
打开Thirdparty/g2o/g2o/solvers/linear_solver_eigen.h
将
typedef Eigen::PermutationMatrix<Eigen::Dynamic, Eigen::Dynamic, SparseMatrix::Index> PermutationMatrix;
改成
typedef Eigen::PermutationMatrix<Eigen::Dynamic, Eigen::Dynamic, int> PermutationMatrix;
12.编译Build时,出现以下错误
../lib/libORB_SLAM2.so:对‘ORB_SLAM2::Frame::InitializeScaleLevels()’未定义的引用 collect2: error: ld returned 1 exit status CMakeFiles/mono_kitti.dir/build.make:125: recipe for target '../Examples/Monocular/mono_kitti' failed
解决方法:将/ORB_SLAM2/src/Frame.cc中"inlier void Frame::InitializeScaleLeve " to " void Frame::InitializeScaleLevels()"
13.编译Build时,出现以下错误
error: ‘FAST’ was not declared in this scope
FAST(cellImage,cellKeyPoints[i][j],fastTh,true);
^
解决方法:在src/ORBextractor.cc中添加
#include <opencv2/opencv.hpp>
14.遇到
Could not find a configuration file for package "OpenCV" that is compatible
with requested version "2.4.3".
解决办法:
将~/ORB_SLAM2/Examples/ROS/ORB_SLAM2中CMakeLists.txt的
find_package(OpenCV 2.3. REQUIRED)
>
find_package(OpenCV 3.2. REQUIRED)