[GRASS5] configure question: GD lib versions

Glynn Clements glynn.clements at virgin.net
Mon Mar 4 21:06:33 EST 2002


Markus Neteler wrote:

> on my machine are both GD1.8 and 2.x present. For compatibility
> reasons the 1.8 version must stay, it is in /usr/lib/
> The libgd.so.2 is in /usr/local/lib (both the gd.h accordingly).

I have basically the same setup; GD-1.3 in /usr/{include,lib},
GD-2.0.1 in /usr/local/{include,lib}:

-rw-r--r--    1 root     root         5404 Feb  3  2000 /usr/include/gd.h
-rw-r--r--    1 root     root          421 Feb  3  2000 /usr/include/gdfontg.h
-rw-r--r--    1 root     root          419 Feb  3  2000 /usr/include/gdfontl.h
-rw-r--r--    1 root     root          382 Feb  3  2000 /usr/include/gdfontmb.h
-rw-r--r--    1 root     root          383 Feb  3  2000 /usr/include/gdfonts.h
-rw-r--r--    1 root     root          415 Feb  3  2000 /usr/include/gdfontt.h
lrwxrwxrwx    1 root     root           12 Jan 26  2001 /usr/lib/libgd.so -> libgd.so.1.2
lrwxrwxrwx    1 root     root           12 Jan 26  2001 /usr/lib/libgd.so.1 -> libgd.so.1.2
-rwxr-xr-x    1 root     root       156353 Feb  3  2000 /usr/lib/libgd.so.1.2
-rw-r--r--    1 root     root        19226 Oct 15 19:56 /usr/local/include/gd.h
-rw-r--r--    1 root     root          917 Oct 15 19:56 /usr/local/include/gd_io.h
-rw-r--r--    1 root     root         2673 Oct 15 19:56 /usr/local/include/gdcache.h
-rw-r--r--    1 root     root          490 Oct 15 19:56 /usr/local/include/gdfontg.h
-rw-r--r--    1 root     root          488 Oct 15 19:56 /usr/local/include/gdfontl.h
-rw-r--r--    1 root     root          451 Oct 15 19:56 /usr/local/include/gdfontmb.h
-rw-r--r--    1 root     root          452 Oct 15 19:56 /usr/local/include/gdfonts.h
-rw-r--r--    1 root     root          484 Oct 15 19:56 /usr/local/include/gdfontt.h
lrwxrwxrwx    1 root     root           29 Oct 15 19:56 /usr/local/lib/libgd.so -> /usr/local/lib/libgd.so.2.0.0
lrwxrwxrwx    1 root     root           29 Oct 15 19:56 /usr/local/lib/libgd.so.2 -> /usr/local/lib/libgd.so.2.0.0
-rwxr-xr-x    1 root     root       452267 Oct 21 19:55 /usr/local/lib/libgd.so.2.0.0

[In spite of the library versions, the GD package versions really are
1.3 and 2.0.1 respectively.]

> Now the question: How can I convince configure/PNGdriver to pick up
> the libgd.so.2? Of course I tried the related parameter, but probably
> due to the LD_LIBRARY_PATH order the PNG driver (ldd tested) finally 
> takes the gd1.8.

./configure ...  \
	--with-gd-includes=/usr/local/include \
	--with-gd-libs=/usr/local/lib

works fine for me.

For completeness, the exact configure command which I use is:

./configure --prefix=/opt --bindir=/usr/local/bin \
	--with-gdal --with-blas --with-lapack --with-motif --with-freetype \
	--with-dbm-includes=/usr/include/gdbm \
	--with-freetype-includes=/usr/X11R6/include/freetype2 \
	--with-freetype-libs=/usr/X11R6/lib \
	--with-postgres-includes=/usr/include/pgsql \
	--with-gd-includes=/usr/local/include \
	--with-gd-libs=/usr/local/lib


Note: LD_LIBRARY_PATH won't affect which version is used; the two
libraries will have different sonames (libgd.so.1 vs libgd.so.2).

$ ldd /opt/grass5/driver/PNG 
	libgd.so.2 => /usr/local/lib/libgd.so.2 (0x4001b000)
	libXpm.so.4 => /usr/X11R6/lib/libXpm.so.4 (0x40057000)
	libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x40065000)
	libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x4006f000)
	libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x40087000)
	libfreetype.so.6 => /usr/X11R6/lib/libfreetype.so.6 (0x40146000)
	libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x40182000)
	libpng.so.2 => /usr/lib/libpng.so.2 (0x401a1000)
	libm.so.6 => /lib/libm.so.6 (0x401cb000)
	libc.so.6 => /lib/libc.so.6 (0x401e8000)
	libdl.so.2 => /lib/libdl.so.2 (0x402de000)
	libz.so.1 => /usr/lib/libz.so.1 (0x402e2000)
	/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

> I solved it by hacking libgd.so.2 directly into the head.i686* file,
> but that's not really the best. On the other hand I could not
> directly specify the libgd.so.2 as configure parameter (probably
> autoconf doesn't allow for this as only directories are allowed here).
> 
> Maybe I am overseeing a trick to specify libgd.so.2 to avoid manual
> editing the head file? Or is my problem just too specific?

The directory switches should suffice. You aren't explicitly
specifying /usr/include or /usr/lib with any switches, right?

What do you get in the configure output, and in config.log?

For me, it doesn't detect the GD library until the 16th (i.e. final)
attempt[1] (it attempts the 16 possible combinations of X11 (for Xpm),
freetype, JPEG and PNG in order to obtain a successful link).

[1] In my case, I intentionally didn't add any dependency information
when building GD, to ensure that configure would work without it.

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



More information about the grass-dev mailing list