[GRASSLIST:5021] Re: error compiling PNGdriver

Glynn Clements glynn.clements at virgin.net
Thu Nov 21 03:21:13 EST 2002

John Gillette wrote:

> sparc-sun-solaris2.7
> grass5.0.0
> I compiled gd2.0.7 (using the included ./config) to install libgd.so.2.0.0
> in a local directory (/scratch/local/lib).
> I reran ./config for grass and recompiled.  PNG driver chokes
> on linking. At step:
> gcc -L/scratch/grass500/grass-5.0.0/src/libes/LIB.sparc-sun-solaris2.7  -o /scratch/grass500/grass-5.0.0/dist.sparc-sun-solaris2.7/driver/PNG <list of .o files> -ldriver -lgis -lnsl    -lz  -lsocket  -lnsl -L/scratch/local/lib -lgd
> ld: warning: file libucb.so.1: required by /usr/local/lib/libpng.so.2, not found

No idea about this one. If libpng needs libucb, but you don't have it,
then that library is of no use to you. OTOH, if you have libucb, but
it's in a non-standard directory, you need to add that directory to
the --with-gd-libs= switch (you can supply multiple directories,
separated by spaces, but you need to use quotes).

> Undefined symbol sin, cos in libdriver.a(Text2.o)  
>  (symbol belongs to implicit dependency /usr/lib/libm.so.1)
> ld: fatal: Symbol referencing errors. ... 
> *** Error code 1
> Can someone help me compile this?  libucb,libm?

GD needs libm (the math library), but configure doesn't appear to
check for it[1].

Possible solutions include:

1. Rebuilding libgd to include dependency information; for 2.0.3, add
"-lm" (similarly for other libraries) to the definition of
LINK_SHARED_HEAD in the GD Makefile. E.g. I have:

LINK_SHARED_HEAD=ld -shared -soname libgd.so.2 -lpng -lz -ljpeg -lfreetype -lm

I'll have to look at 2.0.7.

2. Edit src/CMD/head/head.sparc-sun-solaris2.7, and add "-lm" to the
definition of GDLIB, e.g.

GDLIB               = -lgd -lm

[1] Currently, configure checks for four additional libraries (Xpm,
FreeType, JPEG, PNG), resulting in 16 permutations; I need to add
libm, which will result in 32 permutations (and running "autoconf"
will probably take longer than actually compiling GRASS; damn).

> Also, is it possible to compile the PNGdriver such that the gd lib is 
> included in the driver such that I can erase the gd lib and include files
> when I am done? (statically linked?)

If you only have a static GD library, then that will be used. There
isn't any way to link a specific library statically while linking the
others dynamically.

Glynn Clements <glynn.clements at virgin.net>

More information about the grass-user mailing list