Skip to content

Conversation

@adrienkaiser
Copy link

@adrienkaiser adrienkaiser commented Nov 29, 2019

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.

@azuryl
Copy link

azuryl commented Jul 23, 2024

you can refer silencht/SG-SLAM#31

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

Labels

None yet

Projects

None yet

2 participants