laurentkneip / opengv

OpenGV is a collection of computer vision methods for solving geometric vision problems. It is hosted and maintained by the Mobile Perception Lab of ShanghaiTech.
Other
1.02k stars 353 forks source link

ROS dependency for build in Ubuntu ? #2

Closed Beuh closed 10 years ago

Beuh commented 10 years ago

Hi,

Trying to build the lib under ubuntu 12.04, I get errors. Everything is installed as it should, but when I run cmake I get the following error :

CMake Error at CMakeLists.txt:31 (find_package): Could not find module FindEigen.cmake or a configuration file for package Eigen.

Line 31 is actually "find_package(Eigen REQUIRED)". In Ubuntu (and maybe other distros) there is no provided FindEigen.cmake script system-wide, hence the error.

Now, I saw that there was a manifest.xml file and a Makefile.ros in the main folder, so I tried to build in a ros-aware shell (by sourcing the ros config files) and it builds flawlessly. Reason is that ROS (groovy for me) comes with a FindEigen.cmake file in its config. Both rosbuild and a simple cmake + make in a ros-aware shell work.

I don't have time now to make a patch and submit, but a simple solution could be to have a cmake subfolder containing a FindEigen.cmake script and add this line in the CMakeLists.txt :

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

On my config, using the FindEigen.cmake provided in ROS here works : https://code.ros.org/svn/ros-pkg/stacks/laser_pipeline/trunk/laser_geometry/cmake/FindEigen.cmake

Cheers,

Beuh

jkua commented 10 years ago

I ran into similar issues with Ubuntu 12.04. I also downloaded the FindEigen.cmake file above, stuck it in my build directory and ran cmake: cmake .. -DCMAKE_MODULE_PATH=<path to build dir>

However, make still failed with: /usr/include/eigen3/unsupported/Eigen/NonLinearOptimization:30:22: fatal error: Eigen/Core: No such file or directory

Running make VERBOSE=1 showed that eigen was not in the include path. This was because FindEigen.cmake was setting EIGEN_INCLUDE_PATH and CMakeLists.txt was looking for Eigen_INCLUDE_PATH. Modifying the latter solved the problem.

laurentkneip commented 10 years ago

Thanks for these comments guys. I have ROS so I didn't notice. I added the FindEigen.cmake file, it should work now.