Fix compile option mismatch with g2o dependency #844
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This compile option should match between ORB_SLAM2 and Thirdparty/g2o :
-march=native
.The Eigen library uses this flag to compute the value of the macro
EIGEN_DEFAULT_ALIGN_BYTES
, which then impacts Matrix objects sizes in memory.If ORB_SLAM2 and Thirdparty/g2o are compiled with and without the -march flag, code defined in .cpp files (in libg2o.so) and code defined in .h files (in libORB_SLAM2.so) will not have the same value of Eigen alignment and seg fault can appear.
In particular, segmentation fault appears when building g2o and ORB_SLAM2 in Debug and running examples.
In Debug, g2o is not compiled with the
-march=native
flag (CMAKE_CXX_FLAGS_RELEASE
) while ORB_SLAM2 is, leading to alignment incompatibility, bad object addresses and seg fault.In Release, no incompatibility as the flag is used for both ORB_SLAM2 and g2o.
More information on the
-march=native
flag in g2o : RainerKuemmerle/g2o#314.Probably fixes #493, fixes #634 and maybe fixes #605.