Ubuntu18.04装各种软件及加载项后(https://blog.csdn.net/panxiying1993/article/details/61922162);
安装ORB-SLAM2
superchong@superchong-X450VC:~$ cd ORB_SLAM2
superchong@superchong-X450VC:~/ORB_SLAM2$ ./build.sh
出现问题:
CMakeFiles/ORB_SLAM2.dir/build.make:494: recipe for target 'CMakeFiles/ORB_SLAM2.dir/src/Viewer.cc.o' failed
make[2]: *** [CMakeFiles/ORB_SLAM2.dir/src/Viewer.cc.o] Error 1
make[2]: *** 正在等待未完成的任务....
CMakeFiles/ORB_SLAM2.dir/build.make:110: recipe for target 'CMakeFiles/ORB_SLAM2.dir/src/LocalMapping.cc.o' failed
make[2]: *** [CMakeFiles/ORB_SLAM2.dir/src/LocalMapping.cc.o] Error 1
CMakeFiles/ORB_SLAM2.dir/build.make:62: recipe for target 'CMakeFiles/ORB_SLAM2.dir/src/System.cc.o' failed
make[2]: *** [CMakeFiles/ORB_SLAM2.dir/src/System.cc.o] Error 1
CMakeFiles/ORB_SLAM2.dir/build.make:86: recipe for target 'CMakeFiles/ORB_SLAM2.dir/src/Tracking.cc.o' failed
make[2]: *** [CMakeFiles/ORB_SLAM2.dir/src/Tracking.cc.o] Error 1
CMakeFiles/ORB_SLAM2.dir/build.make:134: recipe for target 'CMakeFiles/ORB_SLAM2.dir/src/LoopClosing.cc.o' failed
make[2]: *** [CMakeFiles/ORB_SLAM2.dir/src/LoopClosing.cc.o] Error 1
CMakeFiles/Makefile2:252: recipe for target 'CMakeFiles/ORB_SLAM2.dir/all' failed
make[1]: *** [CMakeFiles/ORB_SLAM2.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
尝试:
1、https://blog.csdn.net/lixujie666/article/details/90023059
编译LoopClosing.h改为:
typedef map,
Eigen::aligned_allocator > > KeyFrameAndPose;
运行结果:
superchong@superchong-X450VC:~/ORB_SLAM2/include$ gcc LoopClosing.h
In file included from MapPoint.h:25:0,
from KeyFrame.h:24,
from LoopClosing.h:24:
Frame.h:24:9: fatal error: vector: 没有那个文件或目录
#include
^~~~~~~~
compilation terminated.
未果;
尝试改正“vector:没有那个文件或目录”错误
superchong@superchong-X450VC:~/ORB_SLAM2/include$ ls
Converter.h LocalMapping.h Optimizer.h System.h
FrameDrawer.h LoopClosing.h ORBextractor.h Tracking.h
Frame.h LoopClosing.h.gch ORBmatcher.h Viewer.h
Initializer.h MapDrawer.h ORBVocabulary.h
KeyFrameDatabase.h Map.h PnPsolver.h
KeyFrame.h MapPoint.h Sim3Solver.h
根据提示,意思貌似为 MapPoint.h,KeyFrame.h, LoopClosing.h缺vector,include目录下确实有这几个文件,
superchong@superchong-X450VC:~/ORB_SLAM2/include$ vim MapPoint.h
superchong@superchong-X450VC:~/ORB_SLAM2/include$ vim KeyFrame.h
superchong@superchong-X450VC:~/ORB_SLAM2/include$ vim LoopClosing.h
尝试各文件编译增加:#include
#include
我哭了。。。修改KeyFrame.h时不知道按了什么快捷键,不小心修改了代码,又rm删除touch新建了个.h(https://blog.csdn.net/Felaim/article/details/79422350)。
继续失败。。。
CMakeFiles/Makefile2:252: recipe for target 'CMakeFiles/ORB_SLAM2.dir/all' failed
make[1]: *** [CMakeFiles/ORB_SLAM2.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
按链接https://blog.csdn.net/panxiying1993/article/details/61922162修改以下源文件分别增加#include
Examples/Monocular/mono_euroc.cc
Examples/Monocular/mono_kitti.cc
Examples/Monocular/mono_tum.cc
Examples/RGB-D/rgbd_tum.cc
Examples/Stereo/stereo_euroc.cc
Examples/Stereo/stereo_kitti.cc
src/LocalMapping.cc
src/LoopClosing.cc
src/System.cc
src/Tracking.cc
src/Viewer.cc
编译过程error更多,结果仍失败。。。
/usr/include/eigen3/Eigen/src/Core/CoreEvaluators.h:154:30: error: uninitialized reference member in ‘Eigen::internal::evaluator > >::Scalar& {aka double&}’ [-fpermissive]
EIGEN_DEVICE_FUNC explicit evaluator(const PlainObjectType& m)
^~~~~~~~~
/usr/include/eigen3/Eigen/src/Core/CoreEvaluators.h:176:20: note: ‘Eigen::internal::evaluator > >::Scalar& Eigen::internal::evaluator > >::coeffRef’ should be initialized
Scalar& coeffRef(Index row, Index col)
^~~~~
CMakeFiles/ORB_SLAM2.dir/build.make:62: recipe for target 'CMakeFiles/ORB_SLAM2.dir/src/System.cc.o' failed
make[2]: *** [CMakeFiles/ORB_SLAM2.dir/src/System.cc.o] Error 1
CMakeFiles/Makefile2:252: recipe for target 'CMakeFiles/ORB_SLAM2.dir/all' failed
make[1]: *** [CMakeFiles/ORB_SLAM2.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
一直fail啊 我太难了