Closed gregyharra closed 7 years ago
Could be a alignment issue on Matrix of size (3,4)?
I thank you for the answer but I have found the solution to this issue.
The solution that I found was that I had to add flag the “-std=c++11” when I compiled the code as OpenGV but it was not enough. I am also using another library to compute the bearing vectors, that are then inputed to the central posed adapter. This is were the error was. This library also uses Eigen but has the flag “-march=native” used during installation. For some reason that I am unable to tell you, and to be honest I haven’t look into it, OS X is not affected by the fact that the last flag is not set while Linux Ubuntu does.
What was your final solution?
-march=native
to compile openGV too?No, I use -march=native
to compile my own code.
If you want to verify this, run their demo code:
$ cd <opengv_build_dir> $ cmake ..; make -j8
then
$ cd bin $ ./test_relative_pos_sac
or
./bin/test_relative_pose_sac
this should compile and run normally without any segmentation faults
.
Once again I have not looked into it but my guess is that, because my code was not compile with the -march=native
. But my guess is that if you look at the OpenGV CMakeLists.txt
, it states:
IF(MSVC):
add_compile_option(...)
else():
add_definitions(-Wall -march=native -03)
endif()
I guess on Ubuntu MSVC is not set therefore, when compiling OpenGV, the flag -march=native
is set.
Therefore adding the flag when compiling my code fixed it.
Thanks for your detailed answer. I think you can now close the issue.
@gregyharra you sir have just saved my day!
By the way, what's the proper solution if I dont want to compile my code with -native?
@ckchng I haven't looked into the solution as I didn't have time to analyze the problem in more detail. My guess is that the --march=native
flag under ubuntu activates other flags that are not set while compiling the code without it. I guess that you are using Eigen for matrix computations, therefore, the Eigen that you are using doesn't have the same flags that OpenGV uses and thus the Eigen version used will clash.
You can look at the following link to had a look at which flags are set while using the --march=native
:
https://stackoverflow.com/questions/5470257/how-to-see-which-flags-march-native-will-activate
If you don't mind adding the different flags that --march=native
adds, then I would recommend using it.
A workaround that I just thought is to remove the --march=native
flag from OpenGV and then that might work as well, but I am not sure that is a good idea
@gregyharra After wasting 2 days, you sir have saved my life and my MSc Project.
I am currently using OpenGV in order to find the central relative pose between two stereos.
I have tested the code under OSX and it works but for some reasons the model computation provided by OpenGV throws a segmentation fault when running the code under Linux Ubuntu.
I ran the program with GDB to get an idea of the issue and this is the backtrace that I get
I am also running Eigen 3.3.3. Could you help me figure out a way to fix this issue?
Cheers