ORB_SLAM编译环境搭建过程当中遇到的问题

来源:互联网 发布:慕课平台有哪些 知乎 编辑:程序博客网 时间:2024/05/19 22:52

一.  

按照一些参考和官方git的搭建过程,然后自己做了对应的环境搭建,但是对ORB_SLAM编译的时候出现了如下问题:

orb-slam System.cc:134:28: error: ‘usleep’ was not declared in this scope~~

ORM_SLAM2/ORB_SLAM2/src/System.cc~~~
参考网上发现是没有添加头文件unistd.h,然后就在System.cc代码里面添加了这个头文件,但是编译到这一步之后又报出了类似的错误,不过是另外一个文件:Viewer.cc,这下我知道,也应该是这个文件里面也没有对应的头文件了,后来发现,网上有总结了要添加这个头文件的所有代码文件,如下:

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

    添加之后再次编译就OK了:

 

 EIGEN_DEPRECATED const unsigned int AlignedBit = 0x80;                                     ^In file included from /home/tiejiang-tech/ORB_SLAM/ORB_SLAM2/Thirdparty/g2o/g2o/types/types_seven_dof_expmap.h:35:0,                 from /home/tiejiang-tech/ORB_SLAM/ORB_SLAM2/include/LoopClosing.h:34,                 from /home/tiejiang-tech/ORB_SLAM/ORB_SLAM2/include/LocalMapping.h:26,                 from /home/tiejiang-tech/ORB_SLAM/ORB_SLAM2/include/Tracking.h:31,                 from /home/tiejiang-tech/ORB_SLAM/ORB_SLAM2/include/System.h:29,                 from /home/tiejiang-tech/ORB_SLAM/ORB_SLAM2/Examples/Stereo/stereo_euroc.cc:30:/home/tiejiang-tech/ORB_SLAM/ORB_SLAM2/Thirdparty/g2o/g2o/types/../core/base_binary_edge.h:60:80: warning: ‘Eigen::AlignedBit’ is deprecated [-Wdeprecated-declarations]       typedef Eigen::Map<Matrix<double, Dj, Di>, Matrix<double, Dj, Di>::Flags & AlignedBit ? Aligned : Unaligned > HessianBlockTransposedTyp                                                                                ^In file included from /usr/local/include/eigen3/Eigen/Core:344:0,                 from /home/tiejiang-tech/ORB_SLAM/Pangolin/include/pangolin/gl/gl.h:39,                 from /home/tiejiang-tech/ORB_SLAM/Pangolin/include/pangolin/pangolin.h:33,                 from /home/tiejiang-tech/ORB_SLAM/ORB_SLAM2/include/MapDrawer.h:27,                 from /home/tiejiang-tech/ORB_SLAM/ORB_SLAM2/include/Viewer.h:26,                 from /home/tiejiang-tech/ORB_SLAM/ORB_SLAM2/include/Tracking.h:28,                 from /home/tiejiang-tech/ORB_SLAM/ORB_SLAM2/include/System.h:29,                 from /home/tiejiang-tech/ORB_SLAM/ORB_SLAM2/Examples/Stereo/stereo_euroc.cc:30:/usr/local/include/eigen3/Eigen/src/Core/util/Constants.h:162:37: note: declared here EIGEN_DEPRECATED const unsigned int AlignedBit = 0x80;                                     ^[100%] Linking CXX executable ../Examples/Stereo/stereo_euroc[100%] Built target stereo_euroc~~~-VirtualBox:~/ORB_SLAM/ORB_SLAM2$ 

网上其他网友编译时候遇到问题的总结

http://blog.csdn.net/panxiying1993/article/details/61922162?locationNum=12&fps=1

二.

    上述问题解决之后还有一个小问题,编译的时候会卡主,即,编译到某个部分的时候虚拟机直接卡住了,原因是我的电脑本来配置不高,而且有事在虚拟机下面跑orb-slam所以导致性能更加不足,这个时候就不能够使用多线程的编译模式了,那就要在build.sh文件里面修改编译方式,将最后一行的make -j 修改为make -l即可,如下所示:

cd Vocabularytar -xf ORBvoc.txt.tar.gzcd ..echo "Configuring and building ORB_SLAM2 ..."mkdir buildcd buildcmake .. -DCMAKE_BUILD_TYPE=Releasemake -l

    最后一行之前是make -j ,修改为make -l即可。



阅读全文
0 0
原创粉丝点击