pyushkevich / greedy

Very fast greedy diffeomorphic registration code
GNU General Public License v3.0
59 stars 16 forks source link

newest VTK cannot be found #35

Open ShuonanChen opened 1 year ago

ShuonanChen commented 1 year ago

When compiling greedy, it asked for VTK binary directory. Following similar issue here, I installed VTK but now is giving this error:

From the VTK git repo I could not find IOCore or IOGeometry or the others. Could you suggest how to resolve this? Thank you!

Ubuntu system.

 GREEDY Version: 1.3.0-alpha Released Sep 28, 2022
 GIT Info:
   Branch : master
   SHA    : ee6a9efa12fea5fe9a746babc7c53b54ab49a1c2
   Date   : 2022-09-28 07:52:39 -0400
 CMake Error at CMakeLists.txt:66 (FIND_PACKAGE):
   Found package configuration file:

     /home/ubuntu/code/vtk/build/vtk-config.cmake

   but it set VTK_FOUND to FALSE so package "VTK" is considered to be NOT
   FOUND.  Reason given by package:

   Could not find the VTK package with the following required components:
   IOCore, IOGeometry, IOLegacy, IOPLY.
jilei-hao commented 1 year ago

What is the vtk version(branch) you are using?

ShuonanChen commented 1 year ago

Thank you - I am using the newest one from git clone --recursive https://gitlab.kitware.com/vtk/vtk.git

jilei-hao commented 1 year ago

Please try v9.1.0. You can always find the required vtk version from this line in the CMakeLists.txt https://github.com/pyushkevich/greedy/blob/ee6a9efa12fea5fe9a746babc7c53b54ab49a1c2/CMakeLists.txt#L66

We haven't tested with the latest vtk branch.

ShuonanChen commented 1 year ago

The most recent version was 9.2.0. I installed v9.1.0 now but getting the same error... :/

ShuonanChen commented 1 year ago

I just tried to replicate on the mac and it was the same error. Any suggestions would be appreciated!

jilei-hao commented 1 year ago

I would try following steps:

ShuonanChen commented 1 year ago

Thank you.

Also. where are IOCore, IOLegacy etc located in VTK? From quick search on vtk source, I was not able to pinpoint where they are.

jilei-hao commented 1 year ago

Can you share the CMakeCache.txt in your greedy binary folder?

You can find the module enable info in the CMakeCache.txt file in the vtk binary folder. VTK group the modules in folders. For example, the IOCore module is located at /{vtkbinaryfolder}/IO/Core

It's also a way to find related module name for specific filter. If the filter located at Filter/General/..., then the module to include is FilterGeneral

ShuonanChen commented 1 year ago

Here is the CMakeCache.txt from the greedy binary - thanks so much!

CMakeCache_greedy.txt

jilei-hao commented 1 year ago

It looks OK. Can you also attach the CMakeCache.txt from you VTK build directory?

ShuonanChen commented 1 year ago

Here! Thank you!!!! πŸ™

CMakeCache_VTK.txt

jilei-hao commented 1 year ago

I don't see any issues in these files. Has vtk been successfully built? Can you check the lib directory under vtk binary folder, to see if the library binaries have been generated there. What were the cmake command (or configurations) you were using to configure vtk and greedy? Are you still getting the "not found" error message when configuring greedy or is there anything else generated?

ShuonanChen commented 1 year ago

for both VTK and greedy i am using ccmake, and for the configuration for greedy I only changed CMAKE_BUILD_TYPE=Release (as instructed from the website).

For vtk, these are some of the build configurations I have (no error with this config, but when turning on VTK_GROUP_ENABLE_Rendering it throws error telling it cannot find OpenGL..)

 BUILD_SHARED_LIBS                ON
 CMAKE_BUILD_TYPE                 Release
 CMAKE_INSTALL_PREFIX             /usr/local
 OPENGL_GLES2_INCLUDE_DIR         OPENGL_GLES2_INCLUDE_DIR-NOTFOUND
 OPENGL_GLES3_INCLUDE_DIR         OPENGL_GLES3_INCLUDE_DIR-NOTFOUND
 VTK_BUILD_DOCUMENTATION          OFF
 VTK_BUILD_EXAMPLES               OFF
 VTK_BUILD_SCALED_SOA_ARRAYS      OFF
 VTK_BUILD_TESTING                OFF
 VTK_EXTRA_COMPILER_WARNINGS      OFF
 VTK_GLEXT_FILE                   /home/ubuntu/code/vtk-v9.1.0/Utilities/ParseOGLExt/h
 VTK_GLXEXT_FILE                  /home/ubuntu/code/vtk-v9.1.0/Utilities/ParseOGLExt/h
 VTK_GROUP_ENABLE_Imaging         DEFAULT
 VTK_GROUP_ENABLE_MPI             DONT_WANT
 VTK_GROUP_ENABLE_Qt              DEFAULT
 VTK_GROUP_ENABLE_Rendering       DONT_WANT
 VTK_GROUP_ENABLE_StandAlone      DONT_WANT
 VTK_GROUP_ENABLE_Views           DEFAULT
 VTK_GROUP_ENABLE_Web             DEFAULT
 VTK_PYTHON_VERSION               3
 VTK_SMP_IMPLEMENTATION_TYPE      Sequential
 VTK_USE_CUDA                     OFF
 VTK_USE_LARGE_DATA               OFF
 VTK_USE_MEMKIND                  OFF
 VTK_USE_MPI                      OFF
 VTK_WGLEXT_FILE                  /home/ubuntu/code/vtk-v9.1.0/Utilities/ParseOGLExt/h
 VTK_WRAP_JAVA                    OFF
 VTK_WRAP_PYTHON                  OFF

Yes I think the library binaries have been generated for VTK... this is what im seeing under the vtk-build/lib:

./lib/cmake:
vtk-9.1

./lib/vtk:
hierarchy
ubuntu@ip-172-31-71-153:~/code/vtk_build$ ls ./lib/*/*
./lib/cmake/vtk-9.1:
FindCGNS.cmake               Findutf8cpp.cmake
FindEXPAT.cmake              VTK-targets.cmake
FindEigen3.cmake             VTK-vtk-module-find-packages.cmake
FindExprTk.cmake             VTK-vtk-module-properties.cmake
FindFFMPEG.cmake             patches
FindFontConfig.cmake         vtk-config-version.cmake
FindFreetype.cmake           vtk-config.cmake
FindGL2PS.cmake              vtk-find-package-helpers.cmake
FindGLEW.cmake               vtk-prefix.cmake
FindJOGL.cmake               vtk-use-file-compat.cmake
FindJsonCpp.cmake            vtk-use-file-deprecated.cmake
FindLZ4.cmake                vtk-use-file-error.cmake
FindLZMA.cmake               vtkCMakeBackports.cmake
FindLibHaru.cmake            vtkDetectLibraryType.cmake
FindLibPROJ.cmake            vtkEncodeString.cmake
FindLibXml2.cmake            vtkHashSource.cmake
FindMySQL.cmake              vtkModule.cmake
FindNetCDF.cmake             vtkModuleGraphviz.cmake
FindODBC.cmake               vtkModuleJson.cmake
FindOGG.cmake                vtkModuleTesting.cmake
FindOSMesa.cmake             vtkModuleWrapJava.cmake
FindOpenSlide.cmake          vtkModuleWrapPython.cmake
FindOpenVR.cmake             vtkObjectFactory.cmake
FindPEGTL.cmake              vtkObjectFactory.cxx.in
FindSDL2.cmake               vtkObjectFactory.h.in
FindTBB.cmake                vtkTestingDriver.cmake
FindTHEORA.cmake             vtkTestingRenderingDriver.cmake
Finddouble-conversion.cmake  vtkTopologicalSort.cmake
Findmpi4py.cmake

./lib/vtk/hierarchy:
VTK
jilei-hao commented 1 year ago

For linux shared library binaries, you need to look for .so files. It looks like they are missing from the build folder. Those .cmake files are not binaries. Is there any lib64 folder that contains those files?

The lib or lib64 folder should look like this:

cmake                                           libvtkImagingColor-9.1.so.1              libvtkIOVeraOut-9.1.so
libvtkcgns-9.1.so                               libvtkImagingColor-9.1.so.9.1.0          libvtkIOVeraOut-9.1.so.1
libvtkcgns-9.1.so.1                             libvtkImagingCore-9.1.so                 libvtkIOVeraOut-9.1.so.9.1.0
libvtkcgns-9.1.so.9.1.0                         libvtkImagingCore-9.1.so.1               libvtkIOVideo-9.1.so
libvtkChartsCore-9.1.so                         libvtkImagingCore-9.1.so.9.1.0           libvtkIOVideo-9.1.so.1
libvtkChartsCore-9.1.so.1                       libvtkImagingFourier-9.1.so              libvtkIOVideo-9.1.so.9.1.0
libvtkChartsCore-9.1.so.9.1.0                   libvtkImagingFourier-9.1.so.1            libvtkIOXML-9.1.so
...

CMake build projects via two-step process, first is configuration. After configuration shown "Configuration Done, Generating Done", a make or cmake --build . command need to be executed to actually compile the project.

Have you executed the actual building step after configuring the project using ccmake?

ShuonanChen commented 1 year ago

Thank you that was super helpful - I just built the VTK, and now the lib from the vtk shows these:

ls ./lib/
cmake                               libvtkCommonTransforms-9.1.so.9.1.0
libvtkCommonCore-9.1.so             libvtkWrappingTools-9.1.so
libvtkCommonCore-9.1.so.1           libvtkWrappingTools-9.1.so.1
libvtkCommonCore-9.1.so.9.1.0       libvtkWrappingTools-9.1.so.9.1.0
libvtkCommonDataModel-9.1.so        libvtkkissfft-9.1.so
libvtkCommonDataModel-9.1.so.1      libvtkkissfft-9.1.so.1
libvtkCommonDataModel-9.1.so.9.1.0  libvtkkissfft-9.1.so.9.1.0
libvtkCommonMath-9.1.so             libvtkloguru-9.1.so
libvtkCommonMath-9.1.so.1           libvtkloguru-9.1.so.1
libvtkCommonMath-9.1.so.9.1.0       libvtkloguru-9.1.so.9.1.0
libvtkCommonMisc-9.1.so             libvtkpugixml-9.1.so
libvtkCommonMisc-9.1.so.1           libvtkpugixml-9.1.so.1
libvtkCommonMisc-9.1.so.9.1.0       libvtkpugixml-9.1.so.9.1.0
libvtkCommonSystem-9.1.so           libvtksys-9.1.so
libvtkCommonSystem-9.1.so.1         libvtksys-9.1.so.1
libvtkCommonSystem-9.1.so.9.1.0     libvtksys-9.1.so.9.1.0
libvtkCommonTransforms-9.1.so       vtk

but it seems ccmake for greedy show the exact same error messages.. here is the full error messages..

GREEDY Version: 1.3.0-alpha Released Sep 28, 2022
 GIT Info:
   Branch : master
   SHA    : ee6a9efa12fea5fe9a746babc7c53b54ab49a1c2
   Date   : 2022-09-28 07:52:39 -0400
 CMake Error at CMakeLists.txt:66 (FIND_PACKAGE):
   Found package configuration file:

     /home/ubuntu/code/vtk_build/vtk-config.cmake

   but it set VTK_FOUND to FALSE so package "VTK" is considered to be NOT
   FOUND.  Reason given by package:

   Could not find the VTK package with the following required components:
   IOCore, IOGeometry, IOLegacy, IOPLY.

 Configuring incomplete, errors occurred!

Thanks so much for the help!! πŸ™

jilei-hao commented 1 year ago

The IOCore, IOGeometry, IOLegacy, IOPLY modules has not been built according your build configurations.

If you check this file under vtk source directory /vtk/IO/Core/vtk.module you will find which module group you need to turn on to have IOCore module enabled. Similarly for other modules.

So you need to turn on VTK_GROUP_ENABLE_StandAlone in your ccmake configuration to enable these modules. Set it to WANT or YES and build again to see if it works.

More about vtk modules: https://vtk.org/doc/nightly/html/md__builds_gitlab-kitware-sciviz-ci_Documentation_Doxygen_ModuleSystem.html

ShuonanChen commented 1 year ago

Thanks so much, this is super helpful!! I turned on the standalone and now VTK has these modules.

And configuration of greedy was successful! However when I tried to run make -j 8, I got this error this time..

...
/home/ubuntu/code/greedy_dir/greedy/src/GreedyAPI.cxx: In instantiation of β€˜std::__cxx11::string GreedyApproach<VDim, TReal>::PrintIter(int, int, const MultiComponentMetricReport&) const [with unsigned int VDim = 4; TReal = double; std::__cxx11::string = std::__cxx11::basic_string<char>]’:
/home/ubuntu/code/greedy_dir/greedy/src/GreedyAPI.cxx:3275:16:   required from here
/home/ubuntu/code/greedy_dir/greedy/src/GreedyAPI.cxx:1528:12: warning: zero-length gnu_printf format string [-Wformat-zero-length]
CMakeFiles/Makefile2:256: recipe for target 'CMakeFiles/test_accum.dir/all' failed
make[1]: *** [CMakeFiles/test_accum.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 60%] Linking CXX static library libgreedyapi.a
[ 60%] Built target greedyapi
Makefile:165: recipe for target 'all' failed

Could you suggest what might went wrong??? thanks so much!!!

jilei-hao commented 1 year ago

The actual error message was printed before the section you pasted. Can you attach the entire building output including the error message?

ShuonanChen commented 1 year ago

Thanks so much Jilei! This is what i am seeing now...

[  6%] Built target text_to_hex
[ 30%] Built target docs_to_hex
make[2]: *** No rule to make target '/home/ubuntu/code/ITK-build/lib/libitkdouble-conversion-5.2.a', needed by 'test_accum'.  Stop.
CMakeFiles/Makefile2:256: recipe for target 'CMakeFiles/test_accum.dir/all' failed
make[1]: *** [CMakeFiles/test_accum.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 56%] Built target greedyapi
Makefile:165: recipe for target 'all' failed
make: *** [all] Error 2
jilei-hao commented 1 year ago

It cannot find an ITK library. Has ITK been built?

ShuonanChen commented 1 year ago

[RESOLVED. ] Thank you! You were totally right and I needed to build ITK ...! thanks so much for the help on installation!!! @jilei-hao