[GRASS5] Darwin Pre2: PNGDriver

On Sunday, October 14, 2001, at 12:41 AM, Glynn Clements wrote:

Can you please let me know when I can check it out?

It's ready; if I say "about to commit", it will probably be done
within a few minutes of the email being sent.

Hello,

Thanks Glynn, for graciously pointing that out to me.

Will I have to re-build everything and start out with a "make
distclean", or will I be able to just run configure and then build the
PNGDriver?

It should suffice to run configure then build PNGdriver.

Thank you! I checked-out all of the config files and ran configure again and it was apparently successful:

checking whether to use PNG... yes
checking for location of PNG includes...
checking for png.h... yes
checking for location of PNG library...
checking for png_read_image in -lpng... yes
checking whether to use GD... yes
checking for location of GD includes...
checking for gd.h... yes
checking for location of GD library...
checking for gdImagePng in -lgd... no
checking for gdImagePng in -lgd... yes
checking for gdImagePng in -lgd... (cached) yes
checking for gdImageGif in -lgd... no

Built then when I go to build the PNGDriver I run into trouble with undefined symbols:

gcc -o /usr/src/grass/dist.powerpc-apple-darwin1.4/driver/PNG OBJ.powerpc-apple-darwin1.4/Can_do.o OBJ.powerpc-apple-darwin1.4/Color.o OBJ.powerpc-apple-darwin1.4/Draw_line.o OBJ.powerpc-apple-
darwin1.4/Get_w_box.o OBJ.powerpc-apple-darwin1.4/Get_w_line.o OBJ.powerpc-apple-darwin1.4/Get_w_pnt.o OBJ.powerpc-apple-
darwin1.4/Graph_Clse.o OBJ.powerpc-apple-darwin1.4/Graph_Set.o OBJ.powerpc-apple-darwin1.4/Panel.o OBJ.powerpc-apple-
darwin1.4/Polygn_abs.o OBJ.powerpc-apple-darwin1.4/Reset_clr.o /usr/src/grass/src/display/devices/lib/LIB.powerpc-apple-
darwin1.4/driverlib.a /usr/src/grass/src/libes/LIB.powerpc-apple-
darwin1.4/libgis.a -lz -L/usr/local/pgsql -L/usr/local/lib
/usr/bin/ld: Undefined symbols:
_gdImageLine
_gdImageDestroy
_gdImagePng
_gdImageColorAllocate
_gdImageColorTransparent
_gdImageCreate
_gdImageFilledPolygon
_gdImageColorClosest
make: *** [/usr/src/grass/dist.powerpc-apple-darwin1.4/driver/PNG] Error 1

Now, I grep'ed for gdImagePng and gdImageLine:

[localhost:/usr/src/grass] root# grep gdImagePng /usr/local/include/*
/usr/local/include/gd.h:void gdImagePng(gdImagePtr im, FILE *out);
/usr/local/include/gd.h:void gdImagePngCtx(gdImagePtr im, gdIOCtx *out);
/usr/local/include/gd.h:void gdImagePngToSink(gdImagePtr im, gdSinkPtr out);
/usr/local/include/gd.h:void* gdImagePngPtr(gdImagePtr im, int *size);

[localhost:/usr/src/grass] root# grep gdImageLine src/display/devices/PNGdriver/*
src/display/devices/PNGdriver/Draw_line.c: gdImageLine(im, cur_x, cur_y, x, y, currentColor);

And it seems like something is adding the underscores to the symbols, messing things up. Unfortunately, I have no idea why.

Can anyone offer a hint?

BTW: What does the PNGDriver do? Is it optional?

Thanks,

Jeshua Lacock http://OpenOSX.com
Programmer/Owner http://SierraMaps.com
Phone: (760) 935-4736 http://3dTopoMaps.com

On Mon, Oct 15, 2001 at 02:56:36AM -0700, jeshua wrote:
[...]

BTW: What does the PNGDriver do? Is it optional?

Just a comment here: PNGDriver is a nice replacement for
CELL driver. The CELL driver writes into the location, while
the PNGdriver directly generates PNG files. However,
it is also limited to 8bit (what a pity!).

Best regards

Markus

jeshua wrote:

>> Will I have to re-build everything and start out with a "make
>> distclean", or will I be able to just run configure and then build the
>> PNGDriver?
>
> It should suffice to run configure then build PNGdriver.

Thank you! I checked-out all of the config files and ran configure
again and it was apparently successful:

checking whether to use PNG... yes
checking for location of PNG includes...
checking for png.h... yes
checking for location of PNG library...
checking for png_read_image in -lpng... yes
checking whether to use GD... yes
checking for location of GD includes...
checking for gd.h... yes
checking for location of GD library...
checking for gdImagePng in -lgd... no
checking for gdImagePng in -lgd... yes
checking for gdImagePng in -lgd... (cached) yes
checking for gdImageGif in -lgd... no

Built then when I go to build the PNGDriver I run into trouble with
undefined symbols:

gcc -o /usr/src/grass/dist.powerpc-apple-darwin1.4/driver/PNG
OBJ.powerpc-apple-darwin1.4/Can_do.o OBJ.powerpc-apple-darwin1.4/Color.o
OBJ.powerpc-apple-darwin1.4/Draw_line.o OBJ.powerpc-apple-
darwin1.4/Get_w_box.o OBJ.powerpc-apple-darwin1.4/Get_w_line.o
OBJ.powerpc-apple-darwin1.4/Get_w_pnt.o OBJ.powerpc-apple-
darwin1.4/Graph_Clse.o OBJ.powerpc-apple-darwin1.4/Graph_Set.o
OBJ.powerpc-apple-darwin1.4/Panel.o OBJ.powerpc-apple-
darwin1.4/Polygn_abs.o OBJ.powerpc-apple-darwin1.4/Reset_clr.o
/usr/src/grass/src/display/devices/lib/LIB.powerpc-apple-
darwin1.4/driverlib.a /usr/src/grass/src/libes/LIB.powerpc-apple-
darwin1.4/libgis.a -lz -L/usr/local/pgsql -L/usr/local/lib

Er, there's no "-lgd" in there.

I suspect that gmake5 is using the old make.rules file; try:

  cd /usr/src/grass
  rm -rf src/display/devices/PNGdriver/OBJ.powerpc-apple-darwin1.4
  gmake5 src/display/devices/PNGdriver

And it seems like something is adding the underscores to the symbols,
messing things up. Unfortunately, I have no idea why.

I think that this is just the OS convention; some OSes add underscores
to the beginning of symbols.

BTW: What does the PNGDriver do?

It allows you to direct the output of d.* commands to a PNG (or GIF)
image instead of a window.

Is it optional?

Yes.

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

Markus Neteler wrote:

> BTW: What does the PNGDriver do? Is it optional?

Just a comment here: PNGDriver is a nice replacement for
CELL driver. The CELL driver writes into the location, while
the PNGdriver directly generates PNG files. However,
it is also limited to 8bit (what a pity!).

I'll look into the possibility of using GD-2.0 (currently beta).

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

On Mon, Oct 15, 2001 at 02:16:39PM +0100, Glynn Clements wrote:

jeshua wrote:

> >> Will I have to re-build everything and start out with a "make
> >> distclean", or will I be able to just run configure and then build the
> >> PNGDriver?
> >
> > It should suffice to run configure then build PNGdriver.
>
> Thank you! I checked-out all of the config files and ran configure
> again and it was apparently successful:
>
> checking whether to use PNG... yes
> checking for location of PNG includes...
> checking for png.h... yes
> checking for location of PNG library...
> checking for png_read_image in -lpng... yes
> checking whether to use GD... yes
> checking for location of GD includes...
> checking for gd.h... yes
> checking for location of GD library...
> checking for gdImagePng in -lgd... no
> checking for gdImagePng in -lgd... yes
> checking for gdImagePng in -lgd... (cached) yes
> checking for gdImageGif in -lgd... no
>
> Built then when I go to build the PNGDriver I run into trouble with
> undefined symbols:
>
> gcc -o /usr/src/grass/dist.powerpc-apple-darwin1.4/driver/PNG
> OBJ.powerpc-apple-darwin1.4/Can_do.o OBJ.powerpc-apple-darwin1.4/Color.o
> OBJ.powerpc-apple-darwin1.4/Draw_line.o OBJ.powerpc-apple-
> darwin1.4/Get_w_box.o OBJ.powerpc-apple-darwin1.4/Get_w_line.o
> OBJ.powerpc-apple-darwin1.4/Get_w_pnt.o OBJ.powerpc-apple-
> darwin1.4/Graph_Clse.o OBJ.powerpc-apple-darwin1.4/Graph_Set.o
> OBJ.powerpc-apple-darwin1.4/Panel.o OBJ.powerpc-apple-
> darwin1.4/Polygn_abs.o OBJ.powerpc-apple-darwin1.4/Reset_clr.o
> /usr/src/grass/src/display/devices/lib/LIB.powerpc-apple-
> darwin1.4/driverlib.a /usr/src/grass/src/libes/LIB.powerpc-apple-
> darwin1.4/libgis.a -lz -L/usr/local/pgsql -L/usr/local/lib

Er, there's no "-lgd" in there.

I suspect that gmake5 is using the old make.rules file; try:

  cd /usr/src/grass
  rm -rf src/display/devices/PNGdriver/OBJ.powerpc-apple-darwin1.4
  gmake5 src/display/devices/PNGdriver

Another way to do this is
make pre-compile

Markus

Glynn Clements wrote:

> > BTW: What does the PNGDriver do? Is it optional?
>
> Just a comment here: PNGDriver is a nice replacement for
> CELL driver. The CELL driver writes into the location, while
> the PNGdriver directly generates PNG files. However,
> it is also limited to 8bit (what a pity!).

I'll look into the possibility of using GD-2.0 (currently beta).

OK; PNGdriver should support true-colour images if built with GD-2.0,
provided that the environment variable GRASS_TRUECOLOR is set to the
value TRUE (the literal string).

The structure of the colour-handling code has changed quite a bit, so
the possibility of incompatibility or other problems exists. OTOH,
PNGdriver now behaves more like XDRIVER.

NB: the configure tests for the GD library have grown exponentially;
GD now has four optional dependencies (PNG, JPEG, freetype and Xpm),
resulting in 16 possible combinations (by default, libgd.so.2 doesn't
have any dependency information, so configure has to check them all).

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