[Debian-med-packaging] Bug#672242: insighttoolkit: cannot convert 'const TIFFField* {aka const _TIFFField*}' to 'const TIFFFieldInfo*' in initialization

Mathieu Malaterre malat at debian.org
Wed May 9 11:28:09 UTC 2012


Package: insighttoolkit
Version: 3.20.1-6
Severity: normal


ITK does not compile with libtiff5-dev it fails with:

/build/buildd-insighttoolkit_3.20.1-6-armhf-yNw00B/insighttoolkit-3.20.1/Code/IO/itkTIFFImageIO.cxx: In member function 'bool itk::TIFFImageIO::CanFindTIFFTag(unsigned int)':
/build/buildd-insighttoolkit_3.20.1-6-armhf-yNw00B/insighttoolkit-3.20.1/Code/IO/itkTIFFImageIO.cxx:1869:78: error: cannot convert 'const TIFFField* {aka const _TIFFField*}' to 'const TIFFFieldInfo*' in initialization
/build/buildd-insighttoolkit_3.20.1-6-armhf-yNw00B/insighttoolkit-3.20.1/Code/IO/itkTIFFImageIO.cxx: In member function 'void* itk::TIFFImageIO::ReadRawByteFromTag(unsigned int, short int&)':
/build/buildd-insighttoolkit_3.20.1-6-armhf-yNw00B/insighttoolkit-3.20.1/Code/IO/itkTIFFImageIO.cxx:1887:78: error: cannot convert 'const TIFFField* {aka const _TIFFField*}' to 'const TIFFFieldInfo*' in initialization

Using ITK from upstream one can apply the following patch:

--- insighttoolkit-3.20.1.orig/Code/IO/itkTIFFImageIO.cxx
+++ insighttoolkit-3.20.1/Code/IO/itkTIFFImageIO.cxx
@@ -29,6 +29,7 @@
 #include <sys/stat.h>
 
 #include "itk_tiff.h"
+#include <tiff_dir.h>
 
 namespace itk
 {
@@ -1866,7 +1867,11 @@ bool TIFFImageIO::CanFindTIFFTag( unsign
     }
 
   ttag_t tag = t; // 32bits integer
+#if defined(TIFFLIB_VERSION) && TIFFLIB_VERSION >= 20120218
+  const TIFFField *fld = TIFFFieldWithTag( m_InternalImage->m_Image, tag );
+#else
   const TIFFFieldInfo *fld = TIFFFieldWithTag( m_InternalImage->m_Image, tag );
+#endif
   if( fld == NULL )
     {
     return false;
@@ -1884,7 +1889,11 @@ void *TIFFImageIO::ReadRawByteFromTag( u
     }
   ttag_t tag = t;
   void *raw_data = NULL;
+#if defined(TIFFLIB_VERSION) && TIFFLIB_VERSION >= 20120218
+  const TIFFField *fld = TIFFFieldWithTag( m_InternalImage->m_Image, tag );
+#else
   const TIFFFieldInfo *fld = TIFFFieldWithTag( m_InternalImage->m_Image, tag );
+#endif
   if( fld == NULL )
     {
     itkExceptionMacro( << "fld is NULL" );


However it still fails with:

itkTIFFImageIO.cxx:1904:12: error: invalid use of incomplete type 'const TIFFField {aka const struct _TIFFField}'


Upstream solve this issue by using the following trick:

$ cat ./bin/Modules/ThirdParty/TIFF/src/itk_tiff.h
....
# include "itktiff/tif_dir.h"

However this tif_dir.h is not installed as part of the usual libtiff5-dev packaging, since tif_dir.h is a private header
-- System Information:
Debian Release: 6.0.1
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable'), (200, 'testing'), (100, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash





More information about the Debian-med-packaging mailing list