[winGRASS] r.[in|out].gdal

Glynn Clements glynn.clements at virgin.net
Tue Mar 12 21:02:07 EST 2002


Glynn Clements wrote:

> > > Does anybody have a handle on why gdal is not working on wingrass? Is it a
> > > "throw your hands up in the air, we have no idea what's going on" or a "we
> > > know what's wrong, but it's going to take ## hours to fix it and there are
> > > other things to work in first" kind of problem?
> > > 
> > > I have a large number of 256 colour tiffs to bring in to grass, which
> > > r.in.tiff doesn't understand. If a fix for r.in.gdal is expected relatively
> > > soon, (<month) I'll wait, otherwise I'll dive into converting the images to
> > > 24bit outside of grass first (and hope I have enough diskspace ;-)
> > 
> > the gdal library currently does not compile on my cygwin setup. That is
> > all i can say right now and i have no time to check why. 
> > You options are: Try to fix it yourself (and share with us), beg someone
> > to fix it for you or wait (no timeframe). Or you convert them first to
> > 24bit, as you propose.
> 
> I almost got GDAL to compile by changing the definition of LD_SHARED
> (in GDALmake.opt) to use "gcc" rather than calling "ld" directly.
> 
> After that, the only remaining failures were related to some symbols
> in libtiff which start with a double underscore (i.e. the C-level name
> starts with an underscore); these are used by frmts/gtiff/libgeotiff/xtiff.c.

The double underscore is a coincidence. The actual problem is that
GDAL uses some "private" TIFF functions which aren't exported by
Cygwin's TIFF DLL (/bin/cygtiff3.dll).

Basically, frmts/o/xtiff.o imports the following _TIFF* functions:

	_TIFFFieldWithTag
	_TIFFMergeFieldInfo
	_TIFFfree
	_TIFFmalloc
	_TIFFmemset
	_TIFFprintAsciiTag
	_TIFFsetDoubleArray
	_TIFFsetShortArray
	_TIFFsetString

The only _TIFF* functions which cygtiff3.dll exports are:

	_TIFFrealloc
	_TIFFmemset
	_TIFFmemcpy
	_TIFFmemcmp
	_TIFFmalloc
	_TIFFfree

[Note: this is exactly the set of _TIFF* functions which are declared
in tiffio.h]

This results in "undefined reference" errors for:

	_TIFFprintAsciiTag
	_TIFFsetShortArray
	_TIFFsetDoubleArray
	_TIFFsetDoubleArray
	_TIFFsetString
	_TIFFFieldWithTag
	_TIFFFieldWithTag
	_TIFFMergeFieldInfo

This problem goes away if you use the TIFF library included with GDAL,
but you also have to use GDAL's JPEG library, as GDAL's TIFF library
won't work with Cygwin's JPEG library. IOW,

	./configure --with-libtiff=internal --with-jpeg=internal

You still need to modify some configuration files, as the shared
library won't work, and the static library doesn't have dependency
information (so you have to add e.g. -lcpl -logr).

I eventually got r.in.gdal to compile and link without errors, and
"r.in.gdal help" works, but it segfaults if I try to import data.

-- 
Glynn Clements <glynn.clements at virgin.net>



More information about the grass-windows mailing list