大家好,欢迎来到IT知识分享网。
昨天晚上帮大四学弟在Ubuntu16.04(ROS-Kinetic)上编译ORB-SLAM2,在执行build.sh脚本时出现如下错误:
错误信息如下:
Build type: Release
-- Using flag -std=c++11.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/wang/SLAM/src/ORB_SLAM2/build
Scanning dependencies of target ORB_SLAM2
[ 3%] Building CXX object CMakeFiles/ORB_SLAM2.dir/src/System.cc.o
[ 6%] Building CXX object CMakeFiles/ORB_SLAM2.dir/src/Tracking.cc.o
[ 9%] Building CXX object CMakeFiles/ORB_SLAM2.dir/src/LocalMapping.cc.o
[ 12%] Building CXX object CMakeFiles/ORB_SLAM2.dir/src/LoopClosing.cc.o
/home/wang/SLAM/src/ORB_SLAM2/src/LoopClosing.cc: In member function ‘void ORB_SLAM2::LoopClosing::CorrectLoop()’:
/home/wang/SLAM/src/ORB_SLAM2/src/LoopClosing.cc:417:20: warning: use of an operand of type ‘bool’ in ‘operator++’ is deprecated [-Wdeprecated]
mnFullBAIdx++;
^~
In file included from /usr/include/c++/8/map:61,
from /home/wang/SLAM/src/ORB_SLAM2/Thirdparty/DBoW2/DBoW2/BowVector.h:14,
from /home/wang/SLAM/src/ORB_SLAM2/include/Frame.h:27,
from /home/wang/SLAM/src/ORB_SLAM2/include/MapPoint.h:25,
from /home/wang/SLAM/src/ORB_SLAM2/include/KeyFrame.h:24,
from /home/wang/SLAM/src/ORB_SLAM2/include/LoopClosing.h:24,
from /home/wang/SLAM/src/ORB_SLAM2/src/LoopClosing.cc:21:
/usr/include/c++/8/bits/stl_map.h: In instantiation of ‘class std::map<ORB_SLAM2::KeyFrame*, g2o::Sim3, std::less<ORB_SLAM2::KeyFrame*>, Eigen::aligned_allocator<std::pair<const ORB_SLAM2::KeyFrame*, g2o::Sim3> > >’:
/home/wang/SLAM/src/ORB_SLAM2/src/LoopClosing.cc:439:21: required from here
/usr/include/c++/8/bits/stl_map.h:122:21: error: static assertion failed: std::map must have the same value_type as its allocator
static_assert(is_same<typename _Alloc::value_type, value_type>::value,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:178: 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
具体原因不详,在网上找到解决办法:打开LoopClosing.h,将
typedef map<KeyFrame*,g2o::Sim3,std::less<KeyFrame*>,
Eigen::aligned_allocator<std::pair<const KeyFrame*, g2o::Sim3> > > KeyFrameAndPose;
改为
typedef map<KeyFrame*,g2o::Sim3,std::less<KeyFrame*>,
Eigen::aligned_allocator<std::pair<KeyFrame *const, g2o::Sim3> > > KeyFrameAndPose;
如下所示:
然后重新编译即可通过。
免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://yundeesoft.com/24702.html