Hello. I would like to know if someone can help me to build ITK 5.3.0 with Python bindings in Linux. The idea is to have a reproducible build, which implies that downloading the binary packages is not an option. Thank you in advance.
When I build like this:
cd /pkg
pkgname="${insight-toolkit}"
torsocks git clone https://github.com/InsightSoftwareConsortium/ITK insight-toolkit
torsocks curl -L "https://github.com/InsightSoftwareConsortium/ITK/pull/4066/commits/93bd9fe07e250bdac948ae6f2c2cc749f165f0e9.patch" -o InsightToolkit-gcc13-fix.patch
cd /pkg/insight-toolkit
git checkout v5.3.0
patch -Np1 -i ../InsightToolkit-gcc13-fix.patch
git submodule update --init --recursive
_confopts=(
-DCMAKE_INSTALL_PREFIX:FILEPATH=/usr
-DCMAKE_BUILD_TYPE:STRING=Release
-DCMAKE_CXX_FLAGS:STRING="-std=c++98"
-DITK_LEGACY_SILENT:BOOL=ON
-DBUILD_SHARED_LIBS:BOOL=ON
-DITK_USE_SYSTEM_LIBRARIES:BOOL=ON
-DITK_USE_SYSTEM_EXPAT:BOOL=ON
-DITK_USE_SYSTEM_FFTW:BOOL=ON
-DITK_USE_SYSTEM_GDCM:BOOL=ON
-DITK_USE_SYSTEM_HDF5:BOOL=ON
-DITK_USE_SYSTEM_JPEG:BOOL=ON
-DITK_USE_SYSTEM_PNG:BOOL=ON
-DITK_USE_SYSTEM_TIFF:BOOL=ON
-DITK_USE_SYSTEM_ZLIB:BOOL=ON
-DBUILD_TESTING:BOOL=OFF
-DBUILD_EXAMPLES:BOOL=OFF
-DModule_ITKReview:BOOL=ON
-DModule_ITKIOMINC:BOOL=ON
-DModule_ITKIOTransformMINC:BOOL=ON
-DModule_SimpleITKFilters:BOOL=ON
-G Ninja
-B build -S "${pkgname}" -Wno-dev
)
cmake "${_confopts[@]}"
samu -j6 -C build
The compilation works well.
When I add the Python flags for CMake
pkgname=insight-toolkit
_confopts=(
-DCMAKE_INSTALL_PREFIX:FILEPATH=/usr
-DCMAKE_BUILD_TYPE:STRING=Release
-DCMAKE_CXX_FLAGS:STRING="-std=c++98"
-DITK_LEGACY_SILENT:BOOL=ON
-DBUILD_SHARED_LIBS:BOOL=ON
-DITK_USE_SYSTEM_LIBRARIES:BOOL=ON
-DITK_USE_SYSTEM_EXPAT:BOOL=ON
-DITK_USE_SYSTEM_FFTW:BOOL=ON
-DITK_USE_SYSTEM_GDCM:BOOL=ON
-DITK_USE_SYSTEM_HDF5:BOOL=ON
-DITK_USE_SYSTEM_JPEG:BOOL=ON
-DITK_USE_SYSTEM_PNG:BOOL=ON
-DITK_USE_SYSTEM_TIFF:BOOL=ON
-DITK_USE_SYSTEM_ZLIB:BOOL=ON
-DBUILD_TESTING:BOOL=OFF
-DBUILD_EXAMPLES:BOOL=OFF
-DModule_ITKReview:BOOL=ON
-DModule_ITKIOMINC:BOOL=ON
-DModule_ITKIOTransformMINC:BOOL=ON
-DModule_SimpleITKFilters:BOOL=ON
# Python
-DITK_WRAP_PYTHON:BOOL=ON
-DITK_USE_SYSTEM_SWIG:BOOL=ON
-DITK_USE_SYSTEM_CASTXML:BOOL=ON
# Python
-DITK_WRAP_PYTHON:BOOL=ON
-DITK_USE_SYSTEM_SWIG:BOOL=ON
-DITK_USE_SYSTEM_CASTXML:BOOL=ON
-G Ninja
-B build -S "${pkgname}" -Wno-dev
)
cmake "${_confopts[@]}"
samu -j6 -C build
I get this:
[2900/4214] Generating itkNarrowBandLevelSetImageFilterPython.cpp, ../../Generators/Python/itk/itkNarrowBandLevelSetImageFilterPython.py
samu: job failed: cd /pkg/insight-toolkit/src/build/Wrapping/Typedefs/python && /usr/bin/swig -c++ -python -O -features autodoc=2 -py3 -doxygen -Werror -w302 -w303 -w312 -w314 -w361 -w362 -w350 -w383 -w384 -w389 -w394 -w395 -w467 -w508 -w509 -o /pkg/insight-toolkit/src/build/Wrapping/Modules/ITKLevelSets/itkNarrowBandThresholdSegmentationLevelSetImageFilterPython.cpp -I/usr/share/swig/4.1.1/python -I/usr/share/swig/4.1.1 -I/pkg/insight-toolkit/src/insight-toolkit/Wrapping/Generators -I/pkg/insight-toolkit/src/build/Wrapping/Typedefs/python -I/pkg/insight-toolkit/src/build/Wrapping/Typedefs -outdir /pkg/insight-toolkit/src/build/Wrapping/Generators/Python/itk /pkg/insight-toolkit/src/build/Wrapping/Typedefs/itkNarrowBandThresholdSegmentationLevelSetImageFilter.i
Deprecated command line option: -py3. Ignored, this option is no longer supported.
/pkg/insight-toolkit/src/build/Wrapping/Typedefs/itkNarrowBandThresholdSegmentationLevelSetImageFilter.i:84: Warning 401: Nothing known about base class 'itk::NarrowBandLevelSetImageFilter< itk::Image< float >,itk::Image< float >,float,itk::Image< float > >'. Ignored.
/pkg/insight-toolkit/src/build/Wrapping/Typedefs/itkNarrowBandThresholdSegmentationLevelSetImageFilter.i:84: Warning 401: Maybe you forgot to instantiate 'itk::NarrowBandLevelSetImageFilter< itk::Image< float >,itk::Image< float >,float,itk::Image< float > >' using %template.
/pkg/insight-toolkit/src/build/Wrapping/Typedefs/itkNarrowBandThresholdSegmentationLevelSetImageFilter.i:176: Warning 401: Nothing known about base class 'itk::NarrowBandLevelSetImageFilter< itk::Image< float,3 >,itk::Image< float,3 >,float,itk::Image< float,3 > >'. Ignored.
/pkg/insight-toolkit/src/build/Wrapping/Typedefs/itkNarrowBandThresholdSegmentationLevelSetImageFilter.i:176: Warning 401: Maybe you forgot to instantiate 'itk::NarrowBandLevelSetImageFilter< itk::Image< float,3 >,itk::Image< float,3 >,float,itk::Image< float,3 > >' using %template.
Deprecated command line option: -py3. Ignored, this option is no longer supported.
Deprecated command line option: -py3. Ignored, this option is no longer supported.
Deprecated command line option: -py3. Ignored, this option is no longer supported.
Deprecated command line option: -py3. Ignored, this option is no longer supported.
Deprecated command line option: -py3. Ignored, this option is no longer supported.
samu: subcommand failed
This process takes roughly 30 minutes with 6 cores.
I tried again with CMake (without @samu@) and could not catch the log. Since it takes some time to compile from scratch, I ran again without cmake "${_confopts[@]}"
redirecting stderr
to stdout
and then to a file (which is attached):
cmake --build build 2>&1 | tee compilation.log
compilation.txt (129.5 KB)
samurai 1.2-2
clang 17.0.6-1
cmake 3.28.3-1
gcc 13.2.1-5
swig 4.1.1-2
python 3.11.8-1