Raise minimum required Eigen version to 3.3.4

Ubuntu 22.04 ships with Eigen 3.4.0. The MinGW workaround for -O3
related crashes has been available in Eigen since at least version
3.2.0, see https://gitlab.com/libeigen/eigen/-/commit/cc03c9d68354ea3fed03481de045c185ddc1fc49.

Change-Id: Iebfd6ed1fa55a6b0f5bd57bd920188e7b486d8cb
This commit is contained in:
Sergiu Deitsch
2025-02-17 22:07:39 +01:00
parent 2d2b7b57c7
commit f0720aeb84
2 changed files with 3 additions and 23 deletions
+1 -21
View File
@@ -234,17 +234,9 @@ unset(CERES_COMPILE_OPTIONS)
# Eigen.
# Eigen delivers Eigen3Config.cmake since v3.3.3
find_package(Eigen3 3.3 REQUIRED)
find_package(Eigen3 3.3.4 REQUIRED NO_MODULE)
if (Eigen3_FOUND)
message("-- Found Eigen version ${Eigen3_VERSION}: ${Eigen3_DIR}")
if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*)" AND
Eigen3_VERSION VERSION_LESS 3.3.4)
# As per issue #289: https://github.com/ceres-solver/ceres-solver/issues/289
# the bundle_adjustment_test will fail for Eigen < 3.3.4 on aarch64.
message(FATAL_ERROR "-- Ceres requires Eigen version >= 3.3.4 on aarch64. "
"Detected version of Eigen is: ${Eigen3_VERSION}.")
endif()
if (EIGENSPARSE)
message("-- Enabling use of Eigen as a sparse linear algebra library.")
list(APPEND CERES_COMPILE_OPTIONS CERES_USE_EIGEN_SPARSE)
@@ -545,18 +537,6 @@ else (NOT CMAKE_BUILD_TYPE)
endif (CMAKE_BUILD_TYPE STREQUAL "Debug")
endif (NOT CMAKE_BUILD_TYPE)
if (MINGW)
# MinGW produces code that segfaults when performing matrix multiplications
# in Eigen when compiled with -O3 (see [1]), as such force the use of -O2
# which works.
#
# [1] http://eigen.tuxfamily.org/bz/show_bug.cgi?id=556
message("-- MinGW detected, forcing -O2 instead of -O3 in Release for Eigen due "
"to a MinGW bug: http://eigen.tuxfamily.org/bz/show_bug.cgi?id=556")
string(REPLACE "-O3" "-O2" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
update_cache_variable(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
endif (MINGW)
# After the tweaks for the compile settings, disable some warnings on MSVC.
if (MSVC)
# Insecure standard library functions
+2 -2
View File
@@ -21,7 +21,7 @@ optional. For details on customizing the build process, see
- `CMake <http://www.cmake.org>`_ (**required**) 3.16 or later.
- `Eigen <http://eigen.tuxfamily.org/index.php?title=Main_Page>`_
(**Required**) 3.3 or later.
(**Required**) 3.3.4 or later.
.. NOTE ::
@@ -361,7 +361,7 @@ Studio 2019 and newer.
#. Get dependencies; unpack them as subdirectories in ``ceres/``
(``ceres/eigen``, ``ceres/glog``, etc.)
#. ``Eigen`` 3.3 . Configure and optionally install Eigen. It should be
#. ``Eigen`` 3.3.4 . Configure and optionally install Eigen. It should be
exported into the CMake package registry by default as part of the
configure stage so installation should not be necessary.