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

Eigen issue #50

Closed
LiShuaixin opened this issue Jun 10, 2019 · 7 comments
Closed

Eigen issue #50

LiShuaixin opened this issue Jun 10, 2019 · 7 comments

Comments

@LiShuaixin
Copy link

LiShuaixin commented Jun 10, 2019

Hello, thanks for your patience. I cloned the latest develop branch of GTSAM on Ubuntu 16.04 with Boost 1.58 and tried importing it in my project.

Part of CMakeLists.txt looks like this:

find_package(Boost COMPONENTS date_time serialization program_options thread system signals regex filesystem REQUIRED )  
find_package( Eigen3 REQUIRED )  
find_package( GTSAM REQUIRED )

include_directories(
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/include
${Boost_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR} 
${GTSAM_INCLUDE_DIR}
${TBB_INCLUDE_DIRS})

add_library(${PROJECT_NAME}  SHARED
src/factor_graph.cpp)

target_link_libraries(${PROJECT_NAME}
${EIGEN3_LIBS}
${GTSAM_LIBRARY_DIRS}
/usr/lib/x86_64-linux-gnu/libtbb.so)

target_link_libraries(${PROJECT_NAME}
${Boost_LIBRARIES} -lgtsam -ltbb)

factor_graph.cpp is a source code file where I put all factors I need.

This cmakelist worked smoothly and I got a executable. But when I run it, the system broke down, and throw off segment fault directly before step into the main function in executable.cpp file. Then I commented the line src/factor_graph.cpp in CMakeLists and rebuilt it. The executable could run again.

Did I import gtsam right? please help. thanks in advance!

@jlblancoc
Copy link
Member

jlblancoc commented Jun 10, 2019 via email

@LiShuaixin
Copy link
Author

LiShuaixin commented Jun 10, 2019

Hi @jlblancoc , thanks for your reply! I will give it a try and report what happen.

Actually, I can smoothly run lego-loam which uses gtsam to achieve global optimization. I wonder why it fail in my project while success in lego-loam on the same PC

@LiShuaixin
Copy link
Author

Hi, @jlblancoc. I tried rebuilding the branch version, but failed when make check.

Errors output as follow:

99% tests passed, 1 tests failed out of 236

Total Test time (real) =   2.44 sec

The following tests FAILED:
	166 - testDoglegOptimizer (Failed)
Errors while running CTest
CMakeFiles/check.dir/build.make:57: recipe for target 'CMakeFiles/check' failed
make[3]: *** [CMakeFiles/check] Error 8
CMakeFiles/Makefile2:651: recipe for target 'CMakeFiles/check.dir/all' failed
make[2]: *** [CMakeFiles/check.dir/all] Error 2
CMakeFiles/Makefile2:658: recipe for target 'CMakeFiles/check.dir/rule' failed
make[1]: *** [CMakeFiles/check.dir/rule] Error 2
Makefile:221: recipe for target 'check' failed
make: *** [check] Error 2

Then I rebuilt it by 'make -j4' directly, and it worked.

But when I imported it in my project using the same cmakelist file, errors occurred since GTSAM was built against a different version of Eigen:

In file included from /usr/local/include/gtsam/base/Matrix.h:26:0,
                 from /usr/local/include/gtsam/base/Manifold.h:22,
                 from /usr/local/include/gtsam/base/Lie.h:25,
                 from /usr/local/include/gtsam/base/VectorSpace.h:11,
                 from /usr/local/include/gtsam/geometry/Point2.h:20,
                 from /usr/local/include/gtsam/geometry/Unit3.h:23,
                 from /usr/local/include/gtsam/geometry/Rot3.h:25,
                 from /home/lee/loam_ws/src/Inertial-LOAM/Inertial-LOAM/src/mapOptmization.cpp:36:
/usr/local/include/gtsam/base/Vector.h:72:1: error: static assertion failed: Error: GTSAM was built against a different version of Eigen
 static_assert(

@jlblancoc
Copy link
Member

Good, it seems that the crash was caused by mixing Eigen versions (probably)... it's better to have a build error than a runtime crash, IMO.

Try rebuilding GTSAM changing its CMake variables such as it uses the system version of Eigen, assuming that your own project does so as well, make install again, and check if it works.

@LiShuaixin
Copy link
Author

LiShuaixin commented Jun 11, 2019

The screen ouputs shows that the version of Eigen it use is 3.3.7. Is it compatible with GTSAM?
-- Use System Eigen : OFF (Using version: 3.3.7)

@jlblancoc
Copy link
Member

run cmake-gui . from your build directory, check "GTSAM_USE_SYSTEM_EIGEN", configure, generate, rebuild from the console as usual.

@LiShuaixin
Copy link
Author

LiShuaixin commented Jun 11, 2019

I checked the source code and found the reason. Thanks!

@LiShuaixin LiShuaixin changed the title RUN issue Eigen issue Jun 12, 2019
varunagrawal added a commit that referenced this issue Mar 24, 2021
3eff76f60 Merge pull request #53 from borglab/feature/refactor
13215dfa7 Merge pull request #52 from borglab/fix/tests
696913b11 install setuptools
9523328ba Merge branch 'master' into fix/tests
7c630b361 some more cleanup
656993a71 cleaned up  Typename
a16f6f38e move qualified and basis type outside to their own class scope
72ead8bd7 Merge pull request #51 from borglab/fix/test-interface-parser
6deefd4fc added tests for interface_parser
50d490a85 Merge pull request #50 from borglab/feature/refs-all-types
be4511290 updated docs for BasisType
0e80b0d8c update MATLAB tests
0015d7397 added support for shared pointer and ref for basis types
86d2158f1 remove std::string from list of Basis types
94f928441 ignore code coverage reports
2033dd345 replace prints with log.debug statements
ae98091b3 fix deprecation in doc tests
13a2f66c4 Merge pull request #46 from borglab/feature/new-shared-pointer
3c7d85865 updated docs
6d7897088 use @ for raw pointer, go back to * for shared pointer
1d6194c57 updated matlab wrapper to handle both raw and shared pointers
1448f6924 fix some failing tests
2ab1dae32 Merge branch 'master' into feature/new-shared-pointer
96f8a56bd Merge pull request #47 from borglab/fix/ci
6003203f3 run CI only for pull requests
a8f29ead1 fix the python version yml key
fcae17227 check if directory exists when testing
f592f08c9 explicit pip3 so that we don't use Python2
d49c2f3c2 correct call for pip
dfe360526 fix the CI
149b7c523 docs for templated functions
f2189acc6 support typedefing for templated functions
965458a2b added test for templated functions
eaff6e6ab made is_const common for all types
3d9c70b32 added tests and cleaned up a bit
010b89626 support for simple pointers on basis types
6b98fd80c new syntax for shared_ptr
ff7ad0b78 support for templated functions
a1a443c8d Merge pull request #43 from borglab/fix/cmake-and-matlab
2f3a055e4 remove accidentally committed file
770d055e2 set proper paths for cmake and eschew relative paths
773d01ae1 fix bug in matlab wrapper
721ef740f Merge pull request #41 from borglab/feature/type-hints
67aac9758 minor refactor of CI yml
e6a63ae0c fix all mypy issues
a3aaa3e7c remove a lot of linter issues from matlab_wrapper
a96db522f static typing for interface_parser

git-subtree-dir: wrap
git-subtree-split: 3eff76f604b5ba9e71cf4947654e288142ed7a94
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

2 participants