gtsam is not able to find Eigen

561 Views Asked by At

I use version 4.1.1 of GTSAM. I have version 3.3.4 of Eigen installed.

The error is:

/usr/local/include/gtsam/base/OptionalJacobian.h:22:10: fatal error: Eigen/Dense: No such file or directory
 #include <Eigen/Dense>

I tried building GTSAM with the flag -DGTSAM_USE_SYSTEM_EIGEN set to both on and off. The same error message appears in both cases.

For reference this is a ROS project built with catkin.

2

There are 2 best solutions below

0
km11 On BEST ANSWER

I was able to get it working by cloning version 4.0.3 of GTSAM into the src folder of my workspace, then building it with the following arguments:

 -DGTSAM_USE_SYSTEM_EIGEN=ON -DGTSAM_POSE3_EXPMAP=ON -DGTSAM_ROT3_EXPMAP=ON 
1
Ryan Friedman On

Have you seen this PR: https://github.com/borglab/gtsam/pull/1304

If you can upgrade GTSAM to 4.2a8, it uses Eigen's find script's rather than custom ones and should properly find Eigen3, if you have it installed if you require to build from source.

Since you are using ROS, why not go the standard route... Have you declared a dependency on it in your package.xml and installed it with rosdep? https://github.com/ros/rosdistro/pull/23198/files

Add to your package.xml:

<depend>gtsam</depend>

And, your CMakeLists, you just call

find_package(gtsam REQUIRED)

It is unclear to me, if gtsam is available through binaries, why you would be building it from source.