Search code examples
cmakehomebreweigen

Mac - cannot find Eigen3


I am trying to build TheiaSfM.

I build it with this command

cmake -DBUILD_DOCUMENTATION=ON -DEIGEN_INCLUDE_DIR=$EIGEN_INCLUDE_DIR ..

where I set EIGEN_INCLUDE_DIR=/usr/local/Cellar/eigen/3.2.9/include/. This is the path to Eigen in my computer.

But I got this error:

CMake Error at cmake/FindEigen.cmake:77 (message):
  Failed to find Eigen - Could not find file:
  /usr/local/Cellar/eigen/3.2.9/include/Eigen/src/Core/util/Macros.h
  containing version information in Eigen install located at:
  /usr/local/Cellar/eigen/3.2.9/include.
Call Stack (most recent call first):
  cmake/FindEigen.cmake:123 (eigen_report_not_found)
  CMakeLists.txt:108 (find_package)

I guess this is trivial, but I already tried to search but cannot really understand the problem. I am really new to this, so, any help would be really appreciated.


Solution

  • According to your error message, your program cannot find where the dir "Eigen" is. I guess it is in

    /usr/local/Cellar/eigen/3.2.9/
    

    Have you looked if there really is a sub-dir "include" in the above path? Official source code does not have this sub-dir.


    So now you find that the dir Eigen is in

    /usr/local/Cellar/eigen/3.2.9/include/eigen3
    

    As for the version issue, you could go to Eigen's website and download the desired version.

    http://eigen.tuxfamily.org/index.php?title=Main_Page