AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2002.10.11 07:39 "2 GB limit ?", by Frithjof Barner
2002.10.11 13:30 "Re: 2 GB limit ?", by Frank Warmerdam
2002.10.11 14:42 "Re: 2 GB limit ?", by Andrey Kiselev
2002.10.12 16:06 "AW: 2 GB limit ?", by Frithjof Barner

2002.10.11 13:30 "Re: 2 GB limit ?", by Frank Warmerdam

Is there a 2GB limit in tiff-v3.5.7 version 20011128? My linux ext2 file system supports larger files but I am not able to write an RGB TIFF greater than 2 GB.

cassini:> ./a.out
TIFF test, version 20011128
TIFFAppendToStrip: test_tiff.tif: Write error at scanline 682.
Can't write raw strip
cassini:> dd if=/dev/zero of=test_tiff.bin bs=1048576 count=3000
3000+0 records in
3000+0 records out
cassini:> ls -la test*
-rw-r--r--    1 barner   users    3145728000 Oct  9 16:40 test_tiff.bin
-rw-r--r--    1 barner   users    2147483647 Oct  9 16:32 test_tiff.tif

The code for a.out is below. Is there a limit or do I make something wrong? Are there any work arounds?

Frithjof,

As it currently stands you need to set the USE_64BIT_API in tiffconf.h so that tif_unix.c will use lseek64() and fstat64() with the intention of allowing 64 bit file access, and thus access to TIFF files of up to 4GB. The configure script currently never sets this.

I am not sure if this is sufficient for 64bit file access on Linux. In another project I believe I actually use fopen64() as well. However, I don't have 64 bit support on my slightly antique linux workstation so I can't easily test it.

I would encourage you to file a bug report on this in bugzilla. In the meantime you should be able to fiddle with tif_unix.c to get it working in 64 bit mode. libtiff 3.5.7 is careful to use unsigned long for file offsets so that support for files up to 4GB can be implemented. The limitation now is just the io layer implementation.

Best regards,

---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent