Eigen3 Find Module Misbehavior When Eigen3 Missing
I encountered this issue with MOAB 5.3.0, but the version field in the issue form only goes up to 5.2.0.
The Eigen3 find module incorrectly defines EIGEN3_INCLUDES
when Eigen3 is not found. As a result, running find_package(MOAB)
in another project results in an error message about a directory EIGEN3_DIR-NOTFOUND
not existing.
To reproduce, run the following in the root of the repository.
$ git checkout 5.3.0
HEAD is now at 902f803a0 Merged in release/version-5.3.0 (pull request #548)
$ cat > "FindEigen3.patch" <<"EOF"
55a56,57
> message("DEBUG: before `if` statement: EIGEN3_DIR = ${EIGEN3_DIR}")
>
71a74,75
> message("DEBUG: before `else` block `find_path` call: EIGEN3_DIR = ${EIGEN3_DIR}")
>
79a84,85
> message("DEBUG: after `else` block `find_path` call: EIGEN3_DIR = ${EIGEN3_DIR}")
>
89a96,97
>
> message("DEBUG: at end of `else` block: EIGEN3_INCLUDES = ${EIGEN3_INCLUDES}")
EOF
$ patch config/FindEigen3.cmake FindEigen3.patch
patching file config/FindEigen3.cmake
$ cmake -S . -B "build" 2>&1 1>/dev/null | grep '^DEBUG: '
DEBUG: before `if` statement: EIGEN3_DIR =
DEBUG: before `else` block `find_path` call: EIGEN3_DIR =
DEBUG: after `else` block `find_path` call: EIGEN3_DIR = EIGEN3_DIR-NOTFOUND
DEBUG: at end of `else` block: EIGEN3_INCLUDES = -IEIGEN3_DIR-NOTFOUND
$ cmake --build "build" --parallel 1>/dev/null 2>/dev/null
$ grep 'EIGEN3_DIR-NOTFOUND' "build/MOABConfig.cmake"
set(EIGEN3_DIR "EIGEN3_DIR-NOTFOUND")
set (MOAB_PACKAGE_INCLUDES_LIST " -IEIGEN3_DIR-NOTFOUND " )
Then install MOAB and run the following in a new directory.
$ cat > "CMakeLists.txt" <<EOF
cmake_minimum_required(VERSION 3.19)
project(debugging)
find_package(MOAB)
EOF
$ cmake -S . -B "build" | grep 'EIGEN3_DIR-NOTFOUND'
-- Include directory EIGEN3_DIR-NOTFOUND does not exist
Comments (7)
-
-
- changed version to 5.3.0
-
reporter This is on Ubuntu. I haven’t tried it on any other platforms.
$ lsb_release --all No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04.6 LTS Release: 18.04 Codename: bionic
-
Good to know. That makes it hopefully easier to reproduce. Our nightly builds have been running fine, but I now noticed that the Windows builds are failing with a similar error due to Eigen3 configuration [1]. I’ll check this and will let you know when I submit a PR with the fix.
[1] https://ci.appveyor.com/project/vijaysm/moab/builds/41410671
-
Can you retest the configuration on this branch:
vijaysm/eigen3-TR-configure-fix
? Do let me know if that fixes it. -
@Ben Whitney Can you please check https://bitbucket.org/fathomteam/moab/pull-requests/569 to see if that resolves this issue ? If yes, feel free to approve the PR, and if not, please start a discussion there on what else is failing.
-
reporter - changed status to resolved
The issue’s resolved as of 2212a76c2742833ce04703244d967fe0dc6c6505. I think the pull request fixed it. Thanks.
- Log in to comment
Thank you for raising this issue. Is this on a Windows platform or is the behavior replicable in all platforms ?