[GRASS5] Help with zlib.h

Glynn Clements glynn.clements at virgin.net
Tue Apr 16 14:42:42 EDT 2002


VENKATARAMANAN RAJAGOPALAN wrote:

> I was trying to compile a simple program from
> http://www.geog.le.ac.uk/jwo/teaching/c_prog/12interface/index.html
> and the compiler prints that the following things were missing:
> inflateInit_, inflate,inflateEnd, deflateInit_,deflate,deflateEnd.  I am
> trying to compile it with the latest version(stable) of GRASS.
> 
> can someone help me rectify this???

If you call any of the functions which read or write raster layers,
you need to add ${XDRLIB} to the compilation command. This variable
contains any linker switches which are required to obtain:

a) the zlib decompression functions, and
b) the XDR functions.

a) normally comprises "-lz", possibly with a "-L" switch if the
library isn't in a "standard" directory.

b) may be empty (e.g. on Linux/GNU systems, where the XDR functions
are part of libc), or it may reference the "sun", "nsl" or "rpclib"
libraries.

Also, $(MATHLIB) should not be listed as a dependency. In the case of
the example, it shouldn't be included in the definition of LIBES, but
listed separately in the compilation command, i.e.

LIBES = $(GISLIB) $(VASKLIB)

...

$(PROG): $(OBJ) $(LIBES)
	$(CC) $(COMPILER_FLAGS) -o $@ $(OBJ) $(LIBES) $(CURSES) $(XDRLIB) $(MATHLIB)

Note: The Vask library also requires curses. The use of $(VASK) as a
shorthand for both of $(VASKLIB) $(CURSES) has been discontinued in
recent versions.

Only libraries which are part of GRASS should be listed as
dependencies.

[Actually, the situation has changed slightly in the most recent CVS
version; if you update from CVS, or obtain a CVS snapshot, look at an
existing Gmakefile for an example, or ask for details.]

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



More information about the grass-dev mailing list