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

Dear developers,

I’m attempting to compile all possible ITK target without external third-party libraries. I’m not sure if it will NOT compile all modules that depend on external third-party libraries when I set the ITKGroup_ThirdParty off.

Thanks for your support.

Best regards,

Rosie

In ITK’s build system, you indicate which modules you want built. There is no way to indicate some modules to not be built. During configure step, there are messages such as Enabled ITKBridgeNumPy, requested by ITK_BUILD_DEFAULT_MODULES. Examining these allows you to see which modules were built, and why (what module needs them). You need to turn off all the modules which need the modules you want to exclude.

Yes, I see the message. But I don’t know which modules depend on external third-party libraries.

Typically similarly named modules, e.g. ITKIODCMTK depends on ITKDCMTK. Almost all IO modules depend on some third party module. There are also some optional dependencies, e.g. ITKCommon depends on TBB when CMake option Module_ITKTBB is turned on. To get more comprehensive insight into dependencies, you could put some message statements here.

Most IO modules are commercially viable, so it’s okay. I just need to compile third-party libraries without the risk of license infection.

Hi @Rosie ,

The third party libraries distributed with ITK are all commercial-friendly. For more information, see the licenses documentation.

To build common third party libraries externally, set the CMake variable: ITK_USE_SYSTEM_LIBRARIES during initial configuration.

1 Like

That’s great. I learned that ITKFFT module has integrated with FFTW (Fastest Fourier Transform in the West), which requires GPL license. So are those third-party integrated modules commercial-friendly?

No but FFTW is not included by default, you need to activate it in ITK:

I know it’s used by some vendors, for which they pay license fees.

Yeah, I am worried that there might still be dependencies similar to FFTW. Is there a list of modules that needs extra license? In that case I can check these modules and ensure they are not included. I would like to compile modules as more as possible, without any extra license pay.

I remember that Intel’s MKL was free to use, and it can replace FFTW. It might be called differently now.

1 Like

FFTW might be the only one. I think it raises a warning during CMake configure step when enabled.

Maybe check the list in the doc

I’ve checked the list and found ITK didn’t include any package under GPL license. And the only risky part, FFTW, is not included by default. So, it means that I can just compile all ITK modules without license infection risk?

1 Like

That is correct.

I got it. Thank you so much for your help!

1 Like

Hi all,

I’ve attempted to build all of the default and optional modules, as well as all testing and example. There are several errors during configuration and generation. I just simply turn these corresponding modules off, and it works. I’m not sure if some of them are bugs, so here provide these errors for your reference.

Modules

VkFFTBackend: turn off because FFTW GPL risk

WebAssemblyInterface: need to git clone manually

CMake Error at CMake/ITKModuleRemote.cmake:111 (message): Failed to checkout tag: ‘982daf8ea91d5ecb052c3bf707542dbc43a4d1ef’ Call Stack (most recent call first): CMake/ITKModuleRemote.cmake:145 (_git_update) CMake/ITKModuleRemote.cmake:273 (_fetch_with_git) Modules/Remote/WebAssemblyInterface.remote.cmake:45 (itk_fetch_module) Modules/Remote/CMakeLists.txt:21 (include)

ITKTBB: compiled by default module, so don’t need to turn on

CMake Error at Modules/ThirdParty/TBB/itk-module-init.cmake:2 (find_package): Could not find a package configuration file provided by “TBB” with any of the following names: TBBConfig.cmake tbb-config.cmake Add the installation prefix of “TBB” to CMAKE_PREFIX_PATH or set “TBB_DIR” to a directory containing one of the above files. If “TBB” provides a separate development package or SDK, be sure it has been installed. Call Stack (most recent call first): CMake/ITKModuleEnablement.cmake:374 (include) CMakeLists.txt:583 (include)

IOOpenSlide: turn off because LGPL risks

CMake Error at Modules/Remote/IOOpenSlide/CMakeLists.txt:8 (message):

Please specify OPENSLIDE_LIBRARY and OPENSLIDE_INCLUDE_DIR.

ITKVideoBridgeOpenCV:need to install OpenCV in system

CMake Error at Modules/Video/BridgeOpenCV/itk-module-init.cmake:4 (find_package):

By not providing “FindOpenCV.cmake” in CMAKE_MODULE_PATH this project has

asked CMake to find a package configuration file provided by “OpenCV”, but

CMake did not find one.

Could not find a package configuration file provided by “OpenCV” with any

of the following names:

OpenCVConfig.cmake

opencv-config.cmake

Add the installation prefix of “OpenCV” to CMAKE_PREFIX_PATH or set

“OpenCV_DIR” to a directory containing one of the above files. If “OpenCV”

provides a separate development package or SDK, be sure it has been

installed.

Call Stack (most recent call first):

CMake/ITKModuleEnablement.cmake:374 (include)

CMakeLists.txt:583 (include)

ITKVtkGlue: need to compile VTK additionally

LesionSizingToolkit:depend on VTKGlue

CMake Error at Modules/Bridge/VtkGlue/itk-module-init.cmake:9 (find_package):

Could not find a package configuration file provided by “VTK” with any of

the following names:

VTKConfig.cmake

vtk-config.cmake

Add the installation prefix of “VTK” to CMAKE_PREFIX_PATH or set “VTK_DIR”

to a directory containing one of the above files. If “VTK” provides a

separate development package or SDK, be sure it has been installed.

Call Stack (most recent call first):

CMake/ITKModuleEnablement.cmake:374 (include)

CMakeLists.txt:583 (include)

SphinxExamples:path too long (ITK folder is already in C:\)

CMake Error at Modules/Remote/SphinxExamples/CMakeLists.txt:65 (message):

The source directory is currently too long, 40 characters. Please move the

Examples source directory to a shorter path.

CudaCommon: CUDA environment needed

CMake Error at Modules/Remote/CudaCommon/src/CMakeLists.txt:12 (target_link_libraries):

Target “CudaCommon” links to:

CUDA::cudart

but the target was not found. Possible reasons include:

* There is a typo in the target name.

* A find_package call is missing for an IMPORTED target.

* An ALIAS target is missing.

Example and Testing

IsotropicWavelets_BUILD_EXAMPLES: lack of module

CMake Error at CMake/ITKModuleAPI.cmake:88 (message):

No such module: “ITKImageIO”

Call Stack (most recent call first):

CMake/ITKModuleAPI.cmake:31 (itk_module_load)

CMake/ITKModuleAPI.cmake:143 (_itk_module_config_recurse)

C:/ITK/build/CMakeTmp/ITKConfig.cmake:52 (itk_module_config)

Modules/Remote/IsotropicWavelets/examples/CMakeLists.txt:4 (find_package)

TubeTK_BUILD_EXAMPLES: cannot find package

CMake Error at Modules/Remote/TubeTK/examples/Applications/CMakeLists.txt:39 (find_package):

By not providing “FindSlicerExecutionModel.cmake” in CMAKE_MODULE_PATH this

project has asked CMake to find a package configuration file provided by

“SlicerExecutionModel”, but CMake did not find one.

Could not find a package configuration file provided by

“SlicerExecutionModel” with any of the following names:

SlicerExecutionModelConfig.cmake

slicerexecutionmodel-config.cmake

Add the installation prefix of “SlicerExecutionModel” to CMAKE_PREFIX_PATH

or set “SlicerExecutionModel_DIR” to a directory containing one of the

above files. If “SlicerExecutionModel” provides a separate development

package or SDK, be sure it has been installed.

Thanks for your support.

Cheers,

Rosie

I think this is only available when building the remote module externally, not when building as part of ITK. This is the way to overcome it:

instead of this:

A pull request is welcome!

SphinxExamples is rather large, so it is best to build externally (first build ITK without it, then build it pointing to the existing ITK build). These configure-time errors are issued to avoid mysterious build time errors later due to path length limitations.

1 Like

Of course, many remote modules and their examples require some additional libraries, as you have noticed.

Hi dzenanz,

New errors came.

The first error is for the GoogleTest module. In Cmake gui, I got:

CMake Error at C:/ITK/build/_deps/cleaver_lib-src/src/test/CMakeLists.txt:64 (add_library): add_library cannot create imported target “gtest” because another target with the same name already exists.

Therefore, I changed the Cmake file from

add_library(${GTEST_LIBRARY} UNKNOWN IMPORTED)

to

if(NOT TARGET {GTEST_LIBRARY}) add_library({GTEST_LIBRARY} UNKNOWN IMPORTED)
endif()

However, I got

Cannot open include file: ‘gtest/gtest.h‘: No such file or directory.

during building. I was confused about it.

The second one is errors of CDMTK.

error: DCMTK was configured to use C++ 11 features, but your compiler does not or was not configured to provide them.

The Visual Studio version is 2022, so it should be C++ 11. I attempted to add the following configuration into CmakeCahe.txt:

CMAKE_CXX_STANDARD=11

But it doesn’t work.

Are you using main branch or one of the released versions?