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

double free or corruption (out) while using fivept_kneip #88

Open
rakshith95 opened this issue Dec 4, 2018 · 2 comments
Open

double free or corruption (out) while using fivept_kneip #88

rakshith95 opened this issue Dec 4, 2018 · 2 comments

Comments

@rakshith95
Copy link

rakshith95 commented Dec 4, 2018

opengv::relative_pose::CentralRelativeAdapter adapter(bearing_vectors1, bearing_vectors2);
vector< int > indices;
for(int i=10;i<100;i+=20)
indices.push_back(i);
opengv::rotations_t R;
R = opengv::relative_pose::fivept_kneip(adapter, indices);
cout<<R.size()<<"\n";

Running this gives the following error:
double free or corruption (out)
Aborted (core dumped

Any idea why this happens?

@samontab
Copy link

Your compiler settings are not setup correctly.

If you look at the OpenGV CMakeLists.txt file you'll see that they add a few different definitions to compile the code correctly. Try compiling the tests by setting BUILD_TESTS=ON. You'll see that test_relative_pose uses fivept_kneip without any issues.

Add those definitions to your compilation and your code should run fine.

For example, if you're using cmake on a laptop, you just need to add this line to your CMakeLists.txt:

add_definitions(-march=native)

@chutsu
Copy link

chutsu commented Sep 17, 2019

IMO having -march=native is probably not a sensible default. Most people who use Eigen in their projects will probably not have that on by default, causing compilation to go through but Eigen to conk out during runtime when using OpenGV due to Eigen mismatch. (OpenGV compiled with optimized Eigen, against non-optimized user code).

I certainly got caught out and had spent some time on this issue. It would probably be best to either:

  • Remove the -march=native default option
  • Document in big bold letters that the option is in use, and advise users of the library of this issue.

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

No branches or pull requests

3 participants