Eigen3Config.cmake not found when building preCICE v3.3.0 or later from source

Hello,

I have a question regarding building preCICE from source.

Following the instructions on the preCICE installation page, I prepared all required dependencies such as Eigen and Boost:

When running CMake to build preCICE, I encounter the following error:

CMake Error at CMakeLists.txt:238 (find_package):
  Could not find a package configuration file provided by "Eigen3" (requested
  version 3.4) with any of the following names:

    Eigen3Config.cmake
    eigen3-config.cmake

  Add the installation prefix of "Eigen3" to CMAKE_PREFIX_PATH or set
  "Eigen3_DIR" to a directory containing one of the above files. If "Eigen3"
  provides a separate development package or SDK, be sure it has been
  installed.

However, when I inspect the Eigen 3.4.0 source tree, I cannot find an Eigen3Config.cmake file under the cmake/ directory (or elsewhere in the source distribution).

Could you please let me know which directory should be added to CMAKE_PREFIX_PATH, or how Eigen3_DIR should be set in this case?

One additional observation is that this issue only occurs with preCICE v3.3.0 and later. I can build preCICE v3.2.0 successfully on the same environment, and Eigen3 is detected correctly without any additional configuration.

My environment

  • preCICE >= v3.3.0
  • Rocky Linux8.6
  • Installation method is CMake
  • Dependency are Boost 1.78.0 and Eigen-3.4.0

Thank you for your help.

Best regards,

@HiroakiAmakawa
Hi,

Ah, we forgot to update the resources. Sorry about this, and thank you very much for reporting!

In preCICE version 3.3.0, we added support for detecting the new version 5.0.0 of Eigen3. The old detection method using the module and the marker in source lead to problems, so we switched to using the CMake config instead.
This config exists in all installations by system package managers that we could find.

When using Eigen from source, this config needs to be generated from the Eigen3 sources by creating a build directory running CMake inside of it. To make this visible, you then need to set this directory as Eigen3_DIR (CMake variable or environment), as stated by the error message from CMake.

cd eigen3-sources
mkdir build
cd build
cmake .. # This generates the config in the build directory
export Eigen3_DIR="$(pwd)"

@fsimonis
Thank you for your reply.

Following your suggestion, I built Eigen3-5.0.0 and configured the required environment variables ‘Eigen3_DIR’. This allowed me to successfully build preCICE 3.4.1.

As a final note, it would be helpful if the official documentation could be updated to reflect this procedure as well.