#1145354 gdcm: FTBFS with swig 4.5.0

#1145354#5
Date:
2026-08-24 12:35:20 UTC
From:
To:
Dear Maintainer,

The gdcm package FTBFS with swig 4.5.0, which is currently in unstable. An excerpt of the build log is shown below.

This is due to the removal of the Python 2 compatibility macros in version 4.5.0. According to the SWIG authors, these macros were retained in the generated code (pyhead.swg) solely for user typemaps. Any typemap using these macros must be updated to call the Python 3 C API directly.

Best,

Rafael Laboissière

##### Build log excerpt

[538/600] /usr/bin/x86_64-linux-gnu-g++ -Dgdcmswig_EXPORTS -I<<BUILD-DIR>>/gdcm-3.0.24/obj-x86_64-linux-gnu/Source/Common -I<<BUILD-DIR>>/gdcm-3.0.24/Source/Common -I<<BUILD-DIR>>/gdcm-3.0.24/Source/DataStructur
eAndEncodingDefinition -I<<BUILD-DIR>>/gdcm-3.0.24/Source/InformationObjectDefinition -I<<BUILD-DIR>>/gdcm-3.0.24/Source/MediaStorageAndFileFormat -I<<BUILD-DIR>>/gdcm-3.0.24/Source/DataDictionary -I<<BUILD-DIR>
otection -Wformat -Werror=format-security -fcf-protection -Wdate-time -D_FORTIFY_SOURCE=2 -std=gnu++20 -fPIC -MD -MT Wrapping/Python/CMakeFiles/gdcmswig.dir/CMakeFiles/gdcmswig.dir/gdcmswigPYTHON_wrap.cxx.o -MF
Wrapping/Python/CMakeFiles/gdcmswig.dir/CMakeFiles/gdcmswig.dir/gdcmswigPYTHON_wrap.cxx.o.d -o Wrapping/Python/CMakeFiles/gdcmswig.dir/CMakeFiles/gdcmswig.dir/gdcmswigPYTHON_wrap.cxx.o -c <<BUILD-DIR>>/gdcm-3.0.
24/obj-x86_64-linux-gnu/Wrapping/Python/CMakeFiles/gdcmswig.dir/gdcmswigPYTHON_wrap.cxx
FAILED: [code=1] Wrapping/Python/CMakeFiles/gdcmswig.dir/CMakeFiles/gdcmswig.dir/gdcmswigPYTHON_wrap.cxx.o
/usr/bin/x86_64-linux-gnu-g++ -Dgdcmswig_EXPORTS -I<<BUILD-DIR>>/gdcm-3.0.24/obj-x86_64-linux-gnu/Source/Common -I<<BUILD-DIR>>/gdcm-3.0.24/Source/Common -I<<BUILD-DIR>>/gdcm-3.0.24/Source/DataStructureAndEncodi
ngDefinition -I<<BUILD-DIR>>/gdcm-3.0.24/Source/InformationObjectDefinition -I<<BUILD-DIR>>/gdcm-3.0.24/Source/MediaStorageAndFileFormat -I<<BUILD-DIR>>/gdcm-3.0.24/Source/DataDictionary -I<<BUILD-DIR>>/gdcm-3.0
.24/Source/MessageExchangeDefinition -I<<BUILD-DIR>>/gdcm-3.0.24/Wrapping/Python -I/usr/include/python3.14 -g -O2 -ffile-prefix-map=<<BUILD-DIR>>/gdcm-3.0.24=. -fstack-protector-strong -fstack-clash-protection -
Wformat -Werror=format-security -fcf-protection -Wdate-time -D_FORTIFY_SOURCE=2 -std=gnu++20 -fPIC -MD -MT Wrapping/Python/CMakeFiles/gdcmswig.dir/CMakeFiles/gdcmswig.dir/gdcmswigPYTHON_wrap.cxx.o -MF Wrapping/P
ython/CMakeFiles/gdcmswig.dir/CMakeFiles/gdcmswig.dir/gdcmswigPYTHON_wrap.cxx.o.d -o Wrapping/Python/CMakeFiles/gdcmswig.dir/CMakeFiles/gdcmswig.dir/gdcmswigPYTHON_wrap.cxx.o -c <<BUILD-DIR>>/gdcm-3.0.24/obj-x86
_64-linux-gnu/Wrapping/Python/CMakeFiles/gdcmswig.dir/gdcmswigPYTHON_wrap.cxx
<<BUILD-DIR>>/gdcm-3.0.24/obj-x86_64-linux-gnu/Wrapping/Python/CMakeFiles/gdcmswig.dir/gdcmswigPYTHON_wrap.cxx: In function ‘PyObject* _wrap_DataElement_SetByteStringValue(PyObject*, PyObject*)’:
<<BUILD-DIR>>/gdcm-3.0.24/obj-x86_64-linux-gnu/Wrapping/Python/CMakeFiles/gdcmswig.dir/gdcmswigPYTHON_wrap.cxx:23137:12: error: ‘PyString_AsString’ was not declared in this scope
23137 |     arg2 = PyString_AsString(swig_obj[1]);
      |            ^~~~~~~~~~~~~~~~~
<<BUILD-DIR>>/gdcm-3.0.24/obj-x86_64-linux-gnu/Wrapping/Python/CMakeFiles/gdcmswig.dir/gdcmswigPYTHON_wrap.cxx:23141:25: error: ‘PyString_Size’ was not declared in this scope; did you mean ‘PyMapping_Size’?
23141 |     Py_ssize_t length = PyString_Size(swig_obj[1]);
      |                         ^~~~~~~~~~~~~
      |                         PyMapping_Size
<<BUILD-DIR>>/gdcm-3.0.24/obj-x86_64-linux-gnu/Wrapping/Python/CMakeFiles/gdcmswig.dir/gdcmswigPYTHON_wrap.cxx: In function ‘PyObject* _wrap_Bitmap_GetDimensions(PyObject*, PyObject*)’:
<<BUILD-DIR>>/gdcm-3.0.24/obj-x86_64-linux-gnu/Wrapping/Python/CMakeFiles/gdcmswig.dir/gdcmswigPYTHON_wrap.cxx:32202:21: error: ‘PyInt_FromLong’ was not declared in this scope; did you mean ‘PyLong_FromLong’?
32202 |       PyObject *o = PyInt_FromLong((long) result[i]);
      |                     ^~~~~~~~~~~~~~
      |                     PyLong_FromLong
<<BUILD-DIR>>/gdcm-3.0.24/obj-x86_64-linux-gnu/Wrapping/Python/CMakeFiles/gdcmswig.dir/gdcmswigPYTHON_wrap.cxx: In function ‘PyObject* _wrap_CSAElement_SetByteStringValue(PyObject*, PyObject*)’:
<<BUILD-DIR>>/gdcm-3.0.24/obj-x86_64-linux-gnu/Wrapping/Python/CMakeFiles/gdcmswig.dir/gdcmswigPYTHON_wrap.cxx:37910:12: error: ‘PyString_AsString’ was not declared in this scope
37910 |     arg2 = PyString_AsString(swig_obj[1]);
      |            ^~~~~~~~~~~~~~~~~
<<BUILD-DIR>>/gdcm-3.0.24/obj-x86_64-linux-gnu/Wrapping/Python/CMakeFiles/gdcmswig.dir/gdcmswigPYTHON_wrap.cxx:37914:25: error: ‘PyString_Size’ was not declared in this scope; did you mean ‘PyMapping_Size’?
37914 |     Py_ssize_t length = PyString_Size(swig_obj[1]);
      |                         ^~~~~~~~~~~~~
      |                         PyMapping_Size
<<BUILD-DIR>>/gdcm-3.0.24/obj-x86_64-linux-gnu/Wrapping/Python/CMakeFiles/gdcmswig.dir/gdcmswigPYTHON_wrap.cxx: In function ‘PyObject* _wrap_ImageCodec_GetDimensions(PyObject*, PyObject*)’:
<<BUILD-DIR>>/gdcm-3.0.24/obj-x86_64-linux-gnu/Wrapping/Python/CMakeFiles/gdcmswig.dir/gdcmswigPYTHON_wrap.cxx:74406:21: error: ‘PyInt_FromLong’ was not declared in this scope; did you mean ‘PyLong_FromLong’?
74406 |       PyObject *o = PyInt_FromLong((long) result[i]);
      |                     ^~~~~~~~~~~~~~
      |                     PyLong_FromLong

#1145354#10
Date:
2026-08-24 12:43:52 UTC
From:
To:
I proposed a patch for fixing the issue as a merge request at Salsa:
https://salsa.debian.org/med-team/gdcm/-/merge_requests/5

Best,

Rafael Laboissière