Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ITKInternalEigen3_DIR not found for installed ITK5.3.0 #4840

Closed
gongwaner opened this issue Sep 8, 2024 · 8 comments
Closed

ITKInternalEigen3_DIR not found for installed ITK5.3.0 #4840

gongwaner opened this issue Sep 8, 2024 · 8 comments
Assignees
Labels
type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances

Comments

@gongwaner
Copy link

Description

I have a project that uses ITK as 3rd-party library. I downloaded the source code for ITK5.3.0, and the build was successful, no errors reported. I then installed the library.
For the project that uses ITK, I have this line

find_package(ITK REQUIRED)

in the CMakeLists.txt.
When I built the project, this line caused build error:

CMake Error at C:/Users/gongwaner/Projects/Library/InsightToolkit-5.3.0_install/lib/cmake/ITK-5.3/Modules/ITKEigen3.cmake:16 (find_package):
  Could not find a package configuration file provided by "ITKInternalEigen3"
  (requested version 3.3) with any of the following names:

    ITKInternalEigen3Config.cmake
    itkinternaleigen3-config.cmake

  Add the installation prefix of "ITKInternalEigen3" to CMAKE_PREFIX_PATH or
  set "ITKInternalEigen3_DIR" to a directory containing one of the above
  files.  If "ITKInternalEigen3" provides a separate development package or
  SDK, be sure it has been installed.
Call Stack (most recent call first):
  C:/Users/gongwaner/Projects/Library/InsightToolkit-5.3.0_install/lib/cmake/ITK-5.3/ITKModuleAPI.cmake:76 (include)
  C:/Users/gongwaner/Projects/Library/InsightToolkit-5.3.0_install/lib/cmake/ITK-5.3/ITKModuleAPI.cmake:31 (itk_module_load)
  C:/Users/gongwaner/Projects/Library/InsightToolkit-5.3.0_install/lib/cmake/ITK-5.3/ITKModuleAPI.cmake:129 (_itk_module_config_recurse)
  C:/Users/gongwaner/Projects/Library/InsightToolkit-5.3.0_install/lib/cmake/ITK-5.3/ITKConfig.cmake:88 (itk_module_config)
  CMakeLists.txt:39 (find_package)

I searched for ITKInternalEigen3Config.cmake and it's not in the installed folder. Rather it's under the build folder: InsightToolkit-5.3.0\build\ITKInternalEigen3-build.
I then searched the github repo to see if similar issues have been reported and found this issue similar to mine. In this comment it mentioned the cmake file is located under {ITK_DIR}/modules, but I did not see ITKInternalEigen3.cmake there.(I'm on WIN10 and the comment is on Linux environment, so maybe that's why it's different?)

If I want to use ITK5.3.0, how can I fix this problem?

Versions

ITK 5.3.0

Environment

Platform: windows10.0.19045-x86_64_v3
Cmake version: 3.30.2
Cmake Generator: Visual Studio 2022 17.11.2

Additional Information

Here's my CMakeCache for cmake build process. Maybe it's something wrong with the build options?
CMakeCache.txt

@gongwaner gongwaner added the type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances label Sep 8, 2024
Copy link

github-actions bot commented Sep 8, 2024

Thank you for contributing an issue! 🙏

Welcome to the ITK community! 🤗👋☀️

We are glad you are here and appreciate your contribution. Please keep in mind our community participation guidelines. 📜
Also, please check existing open issues and consider discussion on the ITK Discourse. 📖

This is an automatic message. Allow for time for the ITK community to be able to read the issue and comment on it.

@dzenanz
Copy link
Member

dzenanz commented Sep 9, 2024

This comment indicates the issue was fixed in 5.4.0. There has been quite a number of changes related to eigen between 5.3 and 5.4:
Screenshot 2024-09-09 09 59 36
Maybe go through them and see which ones are relevant to your problem, and cherry-pick those?

@gongwaner
Copy link
Author

hi @dzenanz Thanks for the reply.
I tried ITK5.4 with the exact same steps and the error still persists. The workaround I found, is to use the build directory for ITK_DIR instead of the installed dir.
eg. Providing the source code is unzipped to D:/Library/ITK5.4, with the build folder set to D:/Library/ITK5.4/build.
Setting ITK_DIR to D:/Library/ITK5.4/build works, while setting it to {ITK_install_prefix}/lib/cmake/ITK-5.4 will fail.

@phcerdan
Copy link
Contributor

We are not sure if it is an ITK or a CMake issue. We weren't able to reproduce it constantly with a range of versions. People reporting it for 5.3 find it fixed for 5.4.0, but I wonder if this was just good luck.

Can you try with the release version of ITK 5.4 (5.4.0) and perform a fresh build and install of ITK?

Thanks for the detailed report by the way, really appreciated.

@gongwaner
Copy link
Author

gongwaner commented Sep 11, 2024

@phcerdan Hi thanks for the follow up. I did a fresh install of ITK5.4, here's the detailed steps of installation process.
1.download the source code from ITK v5.4rc01, unzip the file to D:/Library. By default the unzipped folder will be named as "InsightToolkit-5.4rc01", I renamed it to "ITK5.4". Now the source code dir is D:/Library/ITK5.4
2.open cmake gui, set the source code dir to D:/Library/ITK5.4, set the build dir to D:/Library/ITK5.4/build. I unchecked a few options related to testing and examples, and set the install_prefix to D:/Library/ITK5.4_install. you can see it from the updated CMakeCache.txt .
3.configure, generate, no errors reported. Then open the project using VS2022, build the solution. No errors reported. Build the INSTALL project, no errors reported.
Now ITK5.4 is installed to D:/Library/ITK5.4_install.

Now open the project that uses ITK as 3rd-party library, set the ITK_DIR to D:\Library\ITK5.4_install\lib\cmake\ITK-5.4, and the error occurred.

CMake Error at D:/Library/ITK5.4_install/lib/cmake/ITK-5.4/Modules/ITKEigen3.cmake:16 (find_package):
  Could not find a package configuration file provided by "ITKInternalEigen3"
  (requested version 3.3) with any of the following names:

    ITKInternalEigen3Config.cmake
    itkinternaleigen3-config.cmake

  Add the installation prefix of "ITKInternalEigen3" to CMAKE_PREFIX_PATH or
  set "ITKInternalEigen3_DIR" to a directory containing one of the above
  files.  If "ITKInternalEigen3" provides a separate development package or
  SDK, be sure it has been installed.
Call Stack (most recent call first):
  D:/Library/ITK5.4_install/lib/cmake/ITK-5.4/ITKModuleAPI.cmake:76 (include)
  D:/Library/ITK5.4_install/lib/cmake/ITK-5.4/ITKModuleAPI.cmake:31 (itk_module_load)
  D:/Library/ITK5.4_install/lib/cmake/ITK-5.4/ITKModuleAPI.cmake:129 (_itk_module_config_recurse)
  D:/Library/ITK5.4_install/lib/cmake/ITK-5.4/ITKConfig.cmake:88 (itk_module_config)
  CMakeLists.txt:39 (find_package)

CMakeLists.txt:39 (find_package)
refers to this line of code

find_package(ITK REQUIRED)

and as I said before, setting ITK_DIR to D:\Library\ITK5.4\build will fix this error message because on my pc ITKInternalEigen3Config.cmake is located at D:\Library\ITK5.4\build\ITKInternalEigen3-build.
BTW, this is the same for ITK5.3(i.e.ITK_DIR needs to be build dir rather than install dir).

I suspect it's something wrong with the installation process, I used everything to search for "ITKInternalEigen3Config.cmake" and it can only be found in build folder, shouldn't it also be in the install folder?

@dzenanz
Copy link
Member

dzenanz commented Sep 11, 2024

5.4RC1 is a fair bit older than 5.4 final. Can you repeat the test with this version? The build test itself sounds good.

@phcerdan
Copy link
Contributor

phcerdan commented Sep 11, 2024

Yes please, follow @dzenanz advice and try it with the released version 5.4.0 (the rc are release candidates).

And yes, the problem is only in the install, that's why we are suspecting is a CMake issue.
If you can reproduce it with 5.4.0 we will tackle it again.

@gongwaner
Copy link
Author

hi @dzenanz @phcerdan Sorry I downloaded the wrong version of ITK5.4 release code. I tried with the official release of ITK5.4.0 and the error is gone. So just as the previous issue reporter said, it did get fixed in ITK5.4.
Thanks for the help!

KrisThielemans added a commit to KrisThielemans/PETPVC that referenced this issue Dec 10, 2024
Hopefully also solves a problem sometimes occuring as per
InsightSoftwareConsortium/ITK#4840
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances
Projects
None yet
Development

No branches or pull requests

3 participants