[GRASS5] Darwin Pre2: PNGDriver

Glynn Clements glynn.clements at virgin.net
Sat Oct 13 07:45:48 EDT 2001

jeshua wrote:

> I'm back and I have successfully built 100% of the modules (hooray!); 
> until I attempt the above step (compile PNGDriver) on Darwin 1.4 (Mac OS 
> X 10.1), at which point I get:
> [localhost:display/devices/PNGdriver] root# gcc -O2 
> -I/usr/src/grass/src/include -I/usr/local/include -I../lib -I/sw/include 
> -c Color.c -o OBJ.powerpc-apple-darwin1.4/Color.o
> png.h:23: Neither PNG nor GIF supported
> cpp-precomp: warning: errors during smart preprocessing, retrying in 
> basic mode
> Any ideas?
> I suppose it is related to the failed "gdImageGif"  and "gdImagePng"  
> config section:


> checking for location of PNG includes... /usr/local/include
> checking for png.h... yes
> checking for location of PNG library... /usr/local/lib
> checking for png_read_png in -lpng... no
> configure: warning: *** Unable to locate PNG library.

Here's the problem.

In the current version, this would be a fatal error; you would have to
use "configure --without-png" before you could build.

BTW, this should cause r.in.png and r.out.png to fail also.

> checking for location of GD includes... /usr/local/include
> checking for gd.h... yes
> checking for location of GD library... /usr/local/lib
> checking for gdImageCreate in -lgd... yes

I would guess that libgd is a static library.

When linking against a static library, normally the only object files
which are linked are those required to satisfy outstanding
dependencies. For this test, gdImageCreate is the only outstanding
dependency, and the object file which contains it probably doesn't use
any functions from libpng.

> checking for gdImageGif... no
> checking for gdImagePng... no

However, this function *will* require libpng, so the check fails.

In looking into this, it's clear that the existing GD tests are bogus;
just because gdImageCreate can be used with a particular set of
libraries, that doesn't mean that gdImagePng can.

Also, I noticed that I configure.in was erroneously defining
HAVE_GDIMAGEGIF in both cases; HAVE_GDIMAGEPNG would never have been
defined (I'm surprised that no-one has reported this).

However, neither of these relate to your failure; more on that below.

> Note that I have built and installed GD successfully with PNG support 
> and without GIF support (GIF is no longer supported by GD for obvious 
> reasons).
> To successfully build the PNG modules I had to hard-code libpng.a in as 
> in:

That's to be expected if configure doesn't find it.

> Here is the related config.log:

> configure:4710: checking for png_read_png in -lpng
> configure:4729: gcc -o conftest -O2    conftest.c -lpng -lz   1>&5
> /usr/bin/ld: Undefined symbols:
> _png_read_png

OK; apparently this is function is optional (it only exists if libpng
was compiled with PNG_INFO_IMAGE_SUPPORTED defined. I'll check for
png_read_image (which is actually used by r.in.png) instead.

I'm about to commit a new version of configure[.in] which fixes all of
the aforementioned problems.

Glynn Clements <glynn.clements at virgin.net>

More information about the grass-dev mailing list