[GRASS5] problem grass library gis.a

Glynn Clements glynn.clements at virgin.net
Wed Jul 2 10:02:39 EDT 2003


N.J. Hardebol wrote:

> But the gis-library should work .. I guess
> However when I compile my routine the following problem arises related to
> the gis.a library:
> 
> nico at laptop:~/strength_map/strengthmap_prog/strengthmap_prog> make
> g++ -o  TEST main.o g2d.o yld.o /usr/local/grass5/lib/*.a
> /usr/local/grass5/lib/libgis.a(flate.o)(.text+0x393): In function
> `G_zlib_compress':
> /home/nico/grass5.0.2/src/libes/gis/flate.c:353: undefined reference to
> `deflateInit_'
> /usr/local/grass5/lib/libgis.a(flate.o)(.text+0x3a8):/home/nico/grass5.0.2/s
> rc/libes/gis/flate.c:363: undefined reference to `deflate'
> /usr/local/grass5/lib/libgis.a(flate.o)(.text+0x3c8):/home/nico/grass5.0.2/s
> rc/libes/gis/flate.c:370: undefined reference to `deflateEnd'
> /usr/local/grass5/lib/libgis.a(flate.o)(.text+0x420):/home/nico/grass5.0.2/s
> rc/libes/gis/flate.c:375: undefined reference to `deflateEnd'
> etc...

These are ZLIB functions (gzip compression). You need to add -lz to
the link command; this is normally done via $(XDRLIB). However, while
you are referencing that variable, you don't appear to be defining it
anywhere (the GRASS makefiles are dynamically generated by
concatenating several fragments, including src/CMD/head/head.<arch>
and the directory's Gmakefile).

> I've downloaded a template routine (r.example) to check if I've done
> something wrong but same problem comes back.
> Does anyone have a solution?

Typically you would add your code to the GRASS source tree, along with
a Gmakefile; that way, all of the relevant make variables will be
defined. However, the GRASS build mechanism currently doesn't handle
C++ (at least, not in 5.0.2; the CVS HEAD version has some C++
support, but it isn't guaranteed; it probably won't work if your C++
compiler is significantly different to your C compiler, although
gcc/g++ will probably work).

> G3D - library. While gis.h and gis.a can be found in /usr/local/grass5/
> include & lib, the g3d.h and g3d.a(?) are not.

"make install" doesn't install the GRASS libraries or headers (except
for libgis and libdatetime), or any of the makefile fragments, so you
can't build "stand alone" GRASS modules (i.e. you can't build them
outside of the GRASS source tree).

> I was confronted with some problems while compiling g3d (grass5.0.2) -
> gmake5:
> make[3]: Entering directory
> `/home/nico/software/grass5.0.2/src.contrib/GMSL/g3d/src3d/raster/r3.showdsp
> f.openGL'
> gcc -I/home/nico/software/grass5.0.2/src/include -g -O2   -I/home/nico/softw
> are/grass5.0.2/src/libes/dspf -I/home/nico/software/grass5.0.2/src/libes/ogs
> f   -I/usr/X11R6/include   -c debugf.c -o OBJ.i686-pc-linux-gnu/debugf.o
> debugf.c:44:20: macro "va_start" requires 2 arguments, but only 1 given
> debugf.c: In function `debugf':
> debugf.c:44: error: `va_start' undeclared (first use in this function)

I believe that has already been fixed in the CVS HEAD version (i.e. 
the debug code has been removed). Either remove the references to
debugf.c and debugf.o from the Gmakefile, or remove the "#define DEBUG"
line from debugf.c.

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




More information about the grass-dev mailing list