I receive the following error when building ITK from the latest sources:
/usr/bin/ld: CMakeFiles/ITKVtkGlueTestDriver.dir/runViewImage.cxx.o: in function _GLOBAL__sub_I__Z12runViewImageiPPc':
runViewImage.cxx:(.text.startup+0x77): undefined reference tovtkFiltersParallel_AutoInit_Construct()'
Do you have any idea where I could start looking to fix this problem?
@seanm @mathstuf this sounds familiar to the issue you were investigating.
Yes. See also: https://gitlab.kitware.com/vtk/vtk/-/merge_requests/7133#note_906743
I personally have no idea how to fix it. But I think it's VTK that needs a fix, not ITK.
Looking at the source for the build, my guess is that it is this:
vtk_module_autoinit(
TARGETS ITKVtkGlueTestDriver
MODULES ${VTK_LIBRARIES})
without a pairing of target_link_libraries(ITKVtkGlueTestDriver PRIVATE ${VTK_LIBRARIES}). I would recommend listing the modules actually required instead of trying to link to all of VTK as a shortcut.
@thewtex would that be something you know how to fix? Would be nice to fix this before 5.2.
I am not an expert in the intricacies of VTK's build system.
Regarding VTK_LIBRARIES, it looks like the a variable set in the module's top level CMakeLists.txt could be re-used in test/CMakeLists.txt.
The variable is simply a list of all VTK libraries that were requested via COMPONENTS (or all of them if none were specified). https://gitlab.kitware.com/vtk/vtk/-/blob/7fb393e4512ad0f152fac489c78cd9f6dd713ba2/CMake/vtk-config.cmake.in#L28-32
The variable is simply a list of all VTK libraries that were requested via COMPONENTS (or all of them if none were specified). gitlab.kitware.com/vtk/vtk/-/blob/7fb393e4512ad0f152fac489c78cd9f6dd713ba2/CMake/vtk-config.cmake.in#L28-32
Yes. What version of VTK was COMPONENTS support added? We can add an additional find_package if this is the case.
It has been there "forever" (probably since VTK 6). Components are named like vtkCommonCore historically. Support exists for that in 8.90+, but are preferred to be called CommonCore so they can be combined into VTK::CommonCore easily.
I remember before forever :-). There have been many changes, and target name changes were required to keep a working build. At this point, we could drop VTK 5, 6 support; I don't think many customers are using those, but we should wait until ITK 5.3 for that.
@melrobin @seanm please try #2351 and let us know how it goes.
I think that this seems better. There is still a complaint with the module:
In file included from /home/melrobin/packages/ITK/build/Wrapping/itkImageToVTKImageFilter.cxx:16:
/home/melrobin/packages/ITK/Modules/Bridge/VtkGlue/include/itkImageToVTKImageFilter.h:22:10: fatal error: 'vtkImageImport.h' file not found
Could this be a problem with my VTK build?
This is from my VTK build. The file is there, but maybe it is never installed or not installed in the right place:
[melrobin@scorpion VTK]$ find . -name "vtkImageImport.h"
./IO/Image/vtkImageImport.h
The file does install to the system:
[melrobin@scorpion build]$ ls /usr/local/include/vtk-9.0/vtkImageImport*
/usr/local/include/vtk-9.0/vtkImageImportExecutive.h
/usr/local/include/vtk-9.0/vtkImageImport.h
@melrobin is that VTK 9 I guess? What did you set for VTK_DIR?
Yes you're right. It's the latest VTK build. The VTK_DIR is /usr/local/lib64/cmake/vtk-9.0
I do have 8.90 installed as well. vtkImageImport.h is in both versions.
And that folder contains vtk-config.cmake? I succeeded with VTK master, but I'll try with the 9.x branch today.
Yes it contains vtk-config.cmake. Should I look for anything particular in it to troubleshoot?
One of the AVAILABLE COMPONENTS in that file is IOImage.
@melrobin I pushed another patch to #2351 to add the additional include directories required when wrapping. Please let us know if it works for you. Thanks.
It seems that the errors related to VTK are gone. I do get this error now. If you feel that it is unrelated I can close this one and open another after some investigation:
make[2]: * [Wrapping/Modules/ITKReview/CMakeFiles/ITKReviewPython.dir/build.make:5231: Wrapping/Modules/ITKReview/itkFastSymmetricForcesDemonsRegistrationFilterPython.cpp] Error 112
make[1]: [CMakeFiles/Makefile2:116088: Wrapping/Modules/ITKReview/CMakeFiles/ITKReviewPython.dir/all] Error 2
make: ** [Makefile:182: all] Error 2
[melrobin@scorpion build]$