[GRASS5] Almost there...

Glynn Clements glynn.clements at virgin.net
Fri Jan 31 22:00:05 EST 2003

Jeff D. Hamann wrote:

> I'm stuck on the following error (ignorance is such a drag and I've been
> scouring the Gmakefile trying to get this resolved to no avail since there
> doesn't seem to be a consistent way to generate a Gmakefile.

> gcc -O -o v.example OBJ.i686-pc-cygwin/main.o OBJ.i686-pc-cygwin/interface.o
> OBJ.i686-pc-cygwin/open_vect_in.o OBJ.i686-pc-cygwin/open_vect_out.o
> OBJ.i686-pc-cygwin/process.o       -lgis   -lvect -ldig2 -ldig_atts -lgis   
> -lvect -ldig2 -ldig_atts
> /usr/lib/gcc-lib/i686-pc-cygwin/3.2/../../../../i686-pc-cygwin/bin/ld:
> cannot find -lgis

There should be some -L switches there; at least one for the directory
containing the GRASS libraries.

> Here's the Gmakefile I've "stolen" from the web as well
> (http://www.geog.le.ac.uk/jwo/teaching/c_prog/14vector/index.html)

It appears to be somewhat out of date.


1. You don't need $(VASK) unless you're actually using that

2. You probably do need $(XDRLIB).


Don't set this variable. If you really need any extra compile flags,
set EXTRA_CFLAGS instead.

> $(PROG): ${OBJ} ${LIBES}
>   ${CC} $(COMPILE_FLAGS) -o $@ ${OBJ} ${LIBES} ${LIBES}

1. This is a link command, and should use $(LDFLAGS), not

$(BIN_CMD)/$(PGM): main.o  $(DEPLIBS)
	$(CC) $(LDFLAGS) -o $@ main.o $(LIBES) $(MATHLIB) $(XDRLIB)

2. Don't use $(LIBES) as a dependency; it will typically consist of -l
switches rather than pathnames. Each GRASS library has two variables
e.g. libgis has $(GISLIB) and $(DEPGISLIB); the latter is of a
suitable form for use as a dependency.

The best approach is to start with a Gmakefile from a similar module,
preferably one which uses the same libraries, and ideally one which is
under active development (so that the Gmakefile is more likely to be

Glynn Clements <glynn.clements at virgin.net>

More information about the grass-dev mailing list