Skip to content

BUG: Eigen3 update (64ddc666) breaks downstream FetchContent+find_package use of ITK — eigen_internal removed from main export set #6239

@blowekamp

Description

@blowekamp

Summary

The Eigen3 update in commit 64ddc666 ("Merge branch 'upstream-Eigen3' into eigen-5.0.1-update", May 1, 2026) breaks any downstream project that uses FetchContent with FIND_PACKAGE_ARGS to consume ITK, including SimpleITK.

This was identified via git bisect against the SimpleITK continuous integration dashboard failure reported at:
https://open.cdash.org/builds/11263985/build


Root Cause

Before commit 64ddc666, eigen_internal was exported as part of ITK's main target export set:

install(TARGETS eigen_internal EXPORT ${ITK3P_INSTALL_EXPORT_NAME})

The bad commit changed this to a separate, standalone export set (ITKInternalEigen3Targets) that is never referenced from ITKConfig.cmake:

set_target_properties(eigen_internal PROPERTIES EXPORT_NAME Eigen)
install(TARGETS eigen_internal EXPORT ITKInternalEigen3Targets)
install(EXPORT ITKInternalEigen3Targets NAMESPACE ITKInternalEigen3:: DESTINATION ${CMAKEPACKAGE_INSTALL_DIR})

Because ITKInternalEigen3Targets.cmake is not loaded by ITKConfig.cmake, find_package(ITK) partially fails: ITKTargets.cmake is loaded (registering all other IMPORTED targets globally), but the configure step then errors because ITKEigen3 lists eigen_internal as a library target that doesn't exist as an imported target.


Error Symptoms

When find_package(ITK) is used (directly or via FetchContent ... FIND_PACKAGE_ARGS):

  1. ITKTargets.cmake loads successfully — all ITK IMPORTED targets (itkdouble-conversion, itksys, etc.) are registered into CMake's global namespace.
  2. ITKConfig.cmake then fails because eigen_internal is missing from the loaded targets.
  3. If using FetchContent with a FIND_PACKAGE_ARGS fallback (as SimpleITK does in CMake/sitkITKFetchContent.cmake), CMake falls back to add_subdirectory on the ITK source.
  4. The source build then tries add_library(itkdouble-conversion ...)collision with the already-registered IMPORTED target — causing a hard configure error.

The cascade of CMake errors seen in the dashboard:

CMake Error at .../DoubleConversion/CMakeLists.txt:40 (add_library):
  add_library cannot create target "itkdouble-conversion" because an
  imported target with the same name already exists.

CMake Error at .../FetchContent.cmake:2476 (add_subdirectory):
  EXPORT_NAME property can't be set on imported targets ("itkdouble-conversion")

CMake Error at .../ITKModuleMacros.cmake:778 (export):
  export given target "itkdouble-conversion" which is not built by this project.

CMake Error at .../KWSys/CMakeLists.txt:749 (add_library):
  add_library cannot create target "itksys" because an imported
  target with the same name already exists.

How to Reproduce (with an installed ITK)

Build and install ITK at commit 64ddc666 or later (with the bad Eigen3 update), then configure a project that calls find_package(ITK):

# Build ITK at the bad commit
git clone https://github.com/InsightSoftwareConsortium/ITK.git itk-src
cd itk-src && git checkout 64ddc666
cmake -S . -B ../itk-build -G Ninja \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_INSTALL_PREFIX=../itk-install \
  -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF \
  -DITK_BUILD_DEFAULT_MODULES=ON \
  -DITK_INSTALL_PACKAGE_DIR=lib/cmake/ITK
cmake --build ../itk-build
cmake --install ../itk-build

# Now try to configure SimpleITK against the installed ITK
git clone https://github.com/SimpleITK/SimpleITK.git sitk-src
cmake -S sitk-src -B sitk-build -G Ninja \
  -DITK_DIR=../itk-install/lib/cmake/ITK \
  -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF \
  -DWRAP_DEFAULT=OFF
# ^ This will fail with the target collision errors above

The same error also reproduces on the SimpleITK continuous dashboard: https://open.cdash.org/builds/11263985/build


Bisect Result

Commit Result
c79274e4 (2026-03-09, previous known-good ITK tag in SimpleITK) ✅ Good
64ddc6660c (Merge branch 'upstream-Eigen3' into eigen-5.0.1-update, 2026-05-01) First bad commit

Suggested Fix

Commit 7aa8ae2bd2 from March 12, 2026 appears to contain the correct fix — it reverts eigen_internal back to the ITK main export set:

# 7aa8ae2: the correct approach
install(TARGETS eigen_internal EXPORT ${ITK3P_INSTALL_EXPORT_NAME})

and removes the separate ITKInternalEigen3Targets install/export machinery. It appears these changes from 7aa8ae2 were not carried forward into the May 1 Eigen3 update (64ddc666), which introduced the regression.

Applying the equivalent of 7aa8ae2 to the current state of Modules/ThirdParty/Eigen3/src/itkeigen/CMakeLists.txt — i.e., putting eigen_internal back into ${ITK3P_INSTALL_EXPORT_NAME} and removing the separate ITKInternalEigen3Targets export — is recommended as the starting point for the fix.


Environment

  • CMake 3.28–3.31 (reproduced on multiple versions per CDash)
  • Linux x86_64, GCC
  • SimpleITK main using sitkITKFetchContent.cmake with FetchContent FIND_PACKAGE_ARGS

Metadata

Metadata

Assignees

Labels

type:BugInconsistencies or issues which will cause an incorrect result under some or all circumstances

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions