Would like to compile the ITK without external third-party libraries

I can reproduce this locally with main branch. I am taking a look.

Released version 5.4.4. By the way, the download link of 5.4.4 seems wrong, I can only get version 5.4.3 through the download page.

—Original—

@matt.mccormick I think we need to regenerate the documentation. The link change was made in PR 5519.

Turning on Module_IOTransformDCMTK triggers the compile time error in ITKIODCMTK. We don’t even get to issue 2872.

CMAKE_CXX_STANDARD isn’t the only thing that does not propagate properly. PNG, ZLIB, and TIFF specifications here don’t get picked up here due to missing DCMTK_USE_FIND_PACKAGE.

Also entered to the bug tracker as issue 5539.

I think we need to regenerate the documentation. The link change was made in PR 5519.

The documentation builds were updated to build from main instead of master and now have the updated links.

1 Like

Then how could I deal with the error of Google Test. I’ve noticed that

ITKGoogleTest is needed by [ITKImageIntensity-Test;ITKLabelMap-Test;BoneEnhancement-Test;SimpleITKFilters-Test;TextureFeatures-Test;ITKSuperPixel-Test;ITKGroup_ThirdParty].

I still need to retain these tests so that I can verify every module.

Some of the tests are written as GTests. They cannot be compiled without Google Test. We do not make distinction between GTest-based unit tests and other unit tests. No one needed that feature before. If you need that feature so much, you could contribute it. Namely, make compilation of GTest-based unit tests conditionally enabled, only when GTest is turned on. That will entail mostly, if not exclusively, CMake code changes.

I see. But there seems be two targets named “gtest”, and conflict when “add_library”. But if I change it to add library only when there is not target “GTEST_LIBRARY”, the building program cannot find the gtest.h file, as I mentioned before. I think some path needs to be changed so that the program can locate gtest.h properly.

Hi,

I’m trying to compile ITKCommon as dynamic library and keep other modules static, but module dependency checks will enable ITKCommon and compile static library. I attempt to skip the dependency check, but it cannot link with the ITKCommon dynamic lib. Could you please give me some advice?

Rosie

I am not sure that anyone wanted this before. I expect that non-trivial CMake code changes will be required in ITK. Possibly some major changes. I advise against trying this. Pick either ITK to be all dynamic or all static libraries. Either of those choices should work well.

It’s because ITKCommon static library is too large and will occupy a lot of memory when in use.

—Original—

Hi dzenanz,

Thank you very much for your support.

We decided to use shared library but need to add a prefix in the output target to avoid version conflict. So I add:

#change ITK target name
set_target_properties(${_name} PROPERTIES
OUTPUT_NAME “Q${_name}”
ARCHIVE_OUTPUT_NAME “Q${_name}”
RUNTIME_OUTPUT_NAME “Q${_name}”
LIBRARY_OUTPUT_NAME “Q${_name}”
)

in macro(itk_module_add_library _name) of ITKModuleMacros.cmake file. The names of some modules are changed, and some are not. I wonder if there could be something else that need to be modified? I guess it could be possible as each target has a version suffix.

cheers,
Rosie

Maybe it would be helpful to take a look at this commit from this branch of Slicer’s fork of ITK. Its purpose is different, but might provide further inspiration.

Also, @blowekamp or someone else from SimpleITK team might have suggestions about change on-disk library names.

1 Like

This does not source correct to me. A static library is not used during a run-time application, it use used by a linker to create shared libraries and executables. Depending on what parts of the library used and optimization to resolve duplicate symbols done, can effect the size of the linked binaries.

There are more issues to address then conflicting shared libraries names. All of the symbols use by the library and third party libraries need to not conflict and/or resolve correctly. These are difficult tasks.

The SimpleITK approach is to compile all of ITK as static libraries, and hide all the symbols of ITK, and ITK’s third party libraries. These are then linked into the SimpleITK libraries, which only expose the SimpleITK symbols.

3 Likes

Thank you so much. Today I’ve tried to modify the end of the macro(itk_module_target_name _name) in theITKModuleMacros.cmake file.

#change ITK target name
set(_Q_prefix “Q”)
set_property(TARGET ${_name} PROPERTY OUTPUT_NAME ${_Q_prefix}${_itk}${_name}${_lib_suffix})

The target names change as I supposed. I’ll test them in my applications in case any conflict.

1 Like