Skip to content

Conversation

@DreamWaterFound
Copy link

Excellent work! Thank you very much for your contribution to the open source community. 😘 The work of ORB-SLAM series has helped and inspired many researchers and engineers.

I encountered a small error after I compiled the source code of ORB-SLAM3:

In file included from /usr/include/c++/10/map:61,
                 from <ORB_SLAM3_ROOT>/Thirdparty/DBoW2/DBoW2/BowVector.h:14,
                 from <ORB_SLAM3_ROOT>/include/KeyFrame.h:24,
                 from <ORB_SLAM3_ROOT>/include/MapPoint.h:23,
                 from <ORB_SLAM3_ROOT>/include/Map.h:23,
                 from <ORB_SLAM3_ROOT>/include/Optimizer.h:23,
                 from <ORB_SLAM3_ROOT>/src/Optimizer.cc:20:
/usr/include/c++/10/bits/stl_map.h: In instantiation of ‘class std::map<ORB_SLAM3::KeyFrame*, g2o::Sim3, std::less<ORB_SLAM3::KeyFrame*>, Eigen::aligned_allocator<std::pair<const ORB_SLAM3::KeyFrame*, g2o::Sim3> > >’:
<ORB_SLAM3_ROOT>/src/Optimizer.cc:2388:37:   required from here
/usr/include/c++/10/bits/stl_map.h:123:71: error: static assertion failed: std::map must have the same value_type as its allocator
   123 |       static_assert(is_same<typename _Alloc::value_type, value_type>::value,
       |                                                                       ^~~~~

After testing, this error only appeared with higher version of GCC/G++ compiler such as G++9, G++10. I replaced

typedef map<KeyFrame*,g2o::Sim3,std::less<KeyFrame*>,
        Eigen::aligned_allocator<std::pair<const KeyFrame*, g2o::Sim3> > > KeyFrameAndPose;

with

typedef map<KeyFrame*,g2o::Sim3,std::less<KeyFrame*>,
        Eigen::aligned_allocator<std::pair<KeyFrame *const, g2o::Sim3> > > KeyFrameAndPose;

in the head of file LoopClosing.h and this error was fixed. It works well with G++ 10.0.1, 9.3.0, 8.4.0, 7.5.0, 6.4.0 and 5.5.0.


My environmental information:

OS: Ubuntu 20.04 LTS
GNU GCC/G++: 10.0.1
cmake: 3.16.3
GNU make: 4.2.1

Pangolin: commit 86eb497
OpenCV: 3.2.0
Eigen: 3.2.10

@keeeeenw
Copy link

I had to fix the same issue for supporting building the library on OSX 10.15.5.

@DreamWaterFound DreamWaterFound deleted the dev_bugs_fixed branch July 29, 2020 08:24
@DreamWaterFound
Copy link
Author

I accidentally deleted the branch so this pull request was closed. 😂 New pull request with more bugs fixed: #25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants