Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compile option mismatch with g2o dependency #844

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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