AWare Systems, , Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
June 2008

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date


The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems

New Datamatrix section

Valid HTML 4.01!


2008.06.06 21:47 "Mac OS X universal binary PowerPC endian issues", by Ryan Schmidt
2008.06.07 02:39 "Re: Mac OS X universal binary PowerPC endian issues", by Bob Friesenhahn

2008.06.06 21:47 "Mac OS X universal binary PowerPC endian issues", by Ryan Schmidt

Hello. I use MacPorts [1] to install tiff 3.8.2. There is no problem  
when building for only the native architecture. But a ticket was  
filed in the MacPorts issue tracker [2] for a problem when a  
universal binary of tiff is built using the usual Apple-recommended  
procedure [3] (configure and build once using "-arch i386 -arch  
ppc"). The problem is that the configure-time macros tiff uses to  
determine the endianness always detect Intel endianness in this case,  
so the PowerPC binaries don't function correctly:

$ tiffinfo file.tiff
file.tiff: Not a TIFF file, bad version number 10752 (0x2a00).

There was a discussion about this problem on this list in October  
2007 [4] with various fixes suggested but it appears nothing came of  
it as I've also tested version 4.0.0beta2 released in May 2008 and it  
still has the problem, though the error is different:

$ tiffinfo file.tiff
tif_open.c:112: failed assertion `n.a16==1'
Abort trap

I committed a fix for this bug to the MacPorts repository [5] which  
works by patching the headers after ./configure is run to change the  
endianness definitions based on the __BIG_ENDIAN__ constant, as per  
instructions posted by Dominik Leonhardt [6]. Now it seems to work  
correctly (3.8.2):

$ tiffinfo file.tiff
TIFF Directory at offset 0x36e8 (14056)
   Image Width: 136 Image Length: 231
   Bits/Sample: 8
   Sample Format: unsigned integer
   Compression Scheme: LZW
   Photometric Interpretation: RGB color
   Orientation: row 0 top, col 0 lhs
   Samples/Pixel: 3
   Rows/Strip: 321
   Planar Configuration: single image plane
   ICC Profile: <present>, 0 bytes
   Predictor: horizontal differencing 2 (0x2)

Output with 4.0.0beta2 and our patch is the same except for this line:

   ICC Profile: <present>, 1320 bytes

Our patch works for MacPorts, but I'm sure you'd want a cleaner fix  
for inclusion in your sources (e.g. one which doesn't involve  
patching after running configure). Also, there was a concern in the  
prior thread that the __BIG_ENDIAN__ constant would not exist on some  
other platforms. If that's so, then the use of __BIG_ENDIAN__ could  
be restricted to Mac OS X only, and other platforms could continue to  
use your configure-time checks. An example of this was posted to the  
list in another thread in October 2007 [7], using the __APPLE__  
constant to check for Mac OS X.

Finally, a concern was voiced in our ticket that tiff's "make check"  
didn't catch this problem.