Skip to content

Update eigen 5.0.1 v3#6259

Merged
blowekamp merged 3 commits into
InsightSoftwareConsortium:mainfrom
blowekamp:update_eigen_5.0.1_v3
May 13, 2026
Merged

Update eigen 5.0.1 v3#6259
blowekamp merged 3 commits into
InsightSoftwareConsortium:mainfrom
blowekamp:update_eigen_5.0.1_v3

Conversation

@blowekamp
Copy link
Copy Markdown
Member

PR Checklist

  • No API changes were made (or the changes have been approved)
  • No major design changes were made (or the changes have been approved)
  • Added test (or behavior not changed)
  • Updated API documentation (or API not changed)
  • Added license to new files (if any)
  • Added Python wrapping to new files (if any) as described in ITK Software Guide Section 9.5
  • Added ITK examples for all new major features (if any)

Refer to the ITK Software Guide for
further development details if necessary.

@seanm
Copy link
Copy Markdown
Contributor

seanm commented May 12, 2026

Will this fix the breakage I reported a few days ago here?

@blowekamp
Copy link
Copy Markdown
Member Author

Will this fix the breakage I reported a few days ago here?

I am just testing from an installed ITK with SimpleITK and it seems to be working. There are more things that I need to check and it will take some time to do so.

@hjmjohnson
Copy link
Copy Markdown
Member

Build matrix results for PR #6259 (Linux, 48-core cortex.ecn.uiowa.edu)

Repeating the M1–M6 gauntlet from PR #6249 against this PR's head (19091e73fe). All six modes pass cleanly.

Mode What Status Notes
M1 FetchContent root build SimpleITK CMakeLists.txtsitkITKFetchContent.cmake, ITK_GIT_REPOSITORY pointed at local PR head ✅ 3186/3186 targets, 0 errors, 50 libSimpleITK*.a ITK fetched + built fresh from PR head
M2 Superbuild from installed ITK USE_SYSTEM_ITK=ON, ITK_DIR=<install>/lib/cmake/ITK-6.0 ✅ Superbuild 37/37, 0 errors, 94 libSimpleITK*.a ITK::eigen_internal present in installed ITKTargets.cmake
M3 Superbuild with ITK_USE_BUILD_DIR=ON ITK_DIR=<ITK-bld> (build tree consumer) ✅ Superbuild 45/45, 0 errors, 100 libSimpleITK*.a ITK::eigen_internal present in build-tree ITKTargets.cmake
M4 M2 with system Eigen 5.0.1 ITK rebuilt + installed with ITK_USE_SYSTEM_EIGEN=ON, Eigen3_DIR=<conda-forge eigen 5.0.1> ✅ Superbuild 37/37, 0 errors, 94 libSimpleITK*.a eigen_internal absent (system path) — PR's fork-tag has no effect
M5 M3 with system Eigen 3.4.0 ITK build tree configured with ITK_USE_SYSTEM_EIGEN=ON, Eigen3_DIR=/usr/share/eigen3/cmake ✅ Superbuild 45/45, 0 errors, 100 libSimpleITK*.a Same bypass as M4; ITK 5.0.1 fork still compatible with system Eigen 3.4.0
M6 Wrapped remote module vs ITK build tree ITKTotalVariation PR #57 (cmake_interface_update) with ITK_DIR=<ITK-bld> libitkproxTV-6.0.a + TotalVariationTestDriver + TotalVariationHeaderTest1 linked proxTV <Eigen/Dense> resolution via ITKEigen3_INCLUDE_DIRS clean
Linux-specific substitutions for system Eigen

The original PR #6249 matrix used macOS homebrew Eigen 5.0.1 for M4 and a downloaded Eigen 3.4.0 for M5. On Linux, the equivalent sources are:

  • M4 (Eigen 5.0.1): conda-forge::eigen-5.0.1-hc65338a_0 installed via pixi into /home/johnsonhj/src/eigen6259-eigen501-env/.pixi/envs/default/share/eigen3/cmake. SHA256 f122c5bb618532eb40124f34dc3d467b9142c4a573c206e3e6a51df671345d6a.
  • M5 (Eigen 3.4.0): Ubuntu libeigen3-dev 3.4.0-4build0.1, CMake config at /usr/share/eigen3/cmake.

Both report Found Eigen3: ... (found suitable version "<expected>") in the ITK CMake configure pass.

@hjmjohnson
Copy link
Copy Markdown
Member

@blowekamp, very minor ghostflow issues. I think it may need to be addressed in ISC/eigen with a new branch that is then updated here.

Used ISC eigen branch name "itk_module_install" as prior forked
branch. Rebased all prior fork commits onto upstream 5.0.1.

Ported ITK local commit for eigen to be applied to fork.
@blowekamp blowekamp force-pushed the update_eigen_5.0.1_v3 branch 2 times, most recently from 7700a8c to eb3e74d Compare May 12, 2026 21:06
@blowekamp
Copy link
Copy Markdown
Member Author

@blowekamp, very minor ghostflow issues. I think it may need to be addressed in ISC/eigen with a new branch that is then updated here.

Yes that did the trick. I added another commit to the fork branch:
https://github.com/InsightSoftwareConsortium/eigen/commits/for/itk-5.0.1-v3/

Likely some of these should be squashed to make future updates easier. For example just one commit for the modification of the CMakeLists.txt file and the commit message updates.

With these changes and workflow, Eigen should be updated to 5.0.1, and have the same functionality as before the update to 5 started. There are still a couple questionable features within the ITK Cmake infrastructure that are in a questionable state.

@hjmjohnson
Copy link
Copy Markdown
Member

@blowekamp I would recommend pushing this as-is to resolve the eigen bugs I introduced, and then follow up with

  • Squash the ITK commits to a minimum subset of commits.
  • Careful review of "Cmake infrastructure that are in a questionable state"

@blowekamp blowekamp marked this pull request as ready for review May 13, 2026 12:36
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 13, 2026

Greptile Summary

This PR updates the vendored Eigen library from a development snapshot to the official 5.0.1 release, syncing the ITK-specific CMake integration to match the new upstream structure.

  • The bulk of the 316 changed files are upstream Eigen header updates; the ITK-specific integration is concentrated in CMakeLists.txt and cmake/Eigen3Config.cmake.in.
  • CMakeLists.txt drops several ITK-local patches (GCC false-positive warning suppressions, AOCL integration, CACHE STRING version variables) and reworks include-path and export-target configuration for eigen_internal/eigen_external.
  • Two bugs were introduced in the ITK-specific section: version macros are now parsed from Macros.h (which doesn't define them in Eigen 5 — they live in Eigen/Version), producing an empty EIGEN_VERSION_NUMBER; and the Eigen3Config.cmake.in guard was changed to check NOT TARGET eigen instead of NOT TARGET Eigen3::Eigen, breaking idempotent find_package(Eigen3) calls.

Confidence Score: 3/5

The upstream Eigen header changes are a straightforward vendor sync; the ITK CMake integration layer has two functional regressions that would cause configure-time failures.

Version parsing now reads a file that no longer contains the version macros, so the generated Eigen3ConfigVersion.cmake will carry an empty version string; this breaks find_package(Eigen3 5.0.1) for any project that depends on ITK. Separately, the Eigen3Config.cmake.in guard checks the wrong target name, causing a CMake error on the second invocation of find_package(Eigen3). Both failures occur at configure time rather than silently at runtime, but they would prevent clean builds.

Modules/ThirdParty/Eigen3/src/itkeigen/CMakeLists.txt (version parsing block, lines 827-835) and Modules/ThirdParty/Eigen3/src/itkeigen/cmake/Eigen3Config.cmake.in both need fixes before this can land cleanly.

Important Files Changed

Filename Overview
Modules/ThirdParty/Eigen3/src/itkeigen/CMakeLists.txt ITK-specific build integration updated for Eigen 5.0.1: include paths, export targets, and version parsing changed — version parsing now reads Macros.h which no longer defines version macros in Eigen 5, producing an empty EIGEN_VERSION_NUMBER.
Modules/ThirdParty/Eigen3/src/itkeigen/cmake/Eigen3Config.cmake.in Target guard changed from Eigen3::Eigen to eigen; the latter is never defined, breaking idempotent find_package(Eigen3) calls.
Modules/ThirdParty/Eigen3/UpdateFromUpstream.sh Updated upstream tag from for/itk-20260501-879885e1 to for/itk-5.0.1-v3 and promoted exact_tree_match=false to a readonly variable; straightforward bookkeeping change.
Modules/ThirdParty/Eigen3/src/itkeigen/Eigen/Version Version bumped to the official 5.0.1 release; pre-release and build metadata cleared, version string is now "5.0.1".
Modules/ThirdParty/Eigen3/src/itkeigen/Eigen/src/Core/util/Macros.h Upstream sync: CUDA version detection logic relaxed to support pre-9.0 toolchains and older CUDACC_VER form; minimum CUDA and ROCm/HIP version guards removed; RISC-V arch detection removed.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[CMakeLists.txt - ITK section] --> B{Version parsing}
    B -->|reads| C["Eigen/src/Core/util/Macros.h\n(no version #defines in Eigen 5)"]
    C --> D["EIGEN_VERSION_NUMBER = '..'"]
    D --> E["write_basic_package_version_file\n❌ invalid version"]

    A --> F[eigen_external target]
    F --> G["Eigen3Targets.cmake\ncreates Eigen3::Eigen"]
    G --> H["Eigen3Config.cmake from template"]
    H --> I{"if NOT TARGET eigen"}
    I -->|always true - eigen never created| J["Re-include Eigen3Targets.cmake\n❌ target already exists error"]

    A --> K[eigen_internal target]
    K --> L["BUILD_INTERFACE: CMAKE_CURRENT_SOURCE_DIR\n= itkeigen/ (was itkeigen/..)"]
    L --> M["#include Eigen/X ✓\n#include itkeigen/Eigen/X requires parent dir"]
Loading

Comments Outside Diff (1)

  1. Modules/ThirdParty/Eigen3/src/itkeigen/CMakeLists.txt, line 914-920 (link)

    P2 The comment still says "go one directory before to localize the headers: #include <itkeigen/Eigen/x>", but BUILD_INTERFACE now points to ${CMAKE_CURRENT_SOURCE_DIR} (the itkeigen/ directory itself), which exposes #include <Eigen/x>. The .. suffix that produced the itkeigen/Eigen/x path was removed. The stale comment will mislead maintainers about how headers are resolved.

Reviews (1): Last reviewed commit: "Merge branch 'upstream-Eigen3' into upda..." | Re-trigger Greptile

Comment thread Modules/ThirdParty/Eigen3/src/itkeigen/CMakeLists.txt Outdated
Comment thread Modules/ThirdParty/Eigen3/src/itkeigen/cmake/Eigen3Config.cmake.in Outdated
@hjmjohnson hjmjohnson added this to the ITK 6.0.0 milestone May 13, 2026
kwrobot and others added 2 commits May 13, 2026 14:44
Code extracted from:

    https://github.com/InsightSoftwareConsortium/eigen

at commit d77dca0dddd36b243bf89079066695fe6c0b3bdb (for/itk-5.0.1-v3).
* upstream-Eigen3:
  Eigen3 2026-05-13 (d77dca0d)
@blowekamp blowekamp force-pushed the update_eigen_5.0.1_v3 branch from eb3e74d to 798f0b2 Compare May 13, 2026 14:46
@blowekamp blowekamp requested review from dzenanz, hjmjohnson and seanm May 13, 2026 15:20
@dzenanz
Copy link
Copy Markdown
Member

dzenanz commented May 13, 2026

Looks good on a glance.

@blowekamp blowekamp merged commit 61e193c into InsightSoftwareConsortium:main May 13, 2026
19 checks passed
@hjmjohnson
Copy link
Copy Markdown
Member

@blowekamp THANK YOU!

@blowekamp
Copy link
Copy Markdown
Member Author

I am working on a ReadMe in a welcome branch like slicer/ITK to provide documentation for the fork. We will probably need some common ITK docs documentation on this topic to and then do a similar thing to the DCMTK fork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants