[GRASS5] Problem compiling 5.1

Glynn Clements glynn.clements at virgin.net
Wed Mar 13 21:43:25 EST 2002


Aleksey Naumov wrote:

> I have a problem compiling grass5.1. As directed in INSTALL, I configure it 
> with grass5.0 head branch:
> 
> CFLAGS="-g -Wall" ./configure --with-grass50=/home/Geo/GRASS/grass
> 
> Then run 'make'. Here's the error:
> 
> make[3]: Entering directory `/home/Geo/GRASS/grass51/display/d.mon/cmd'
> make[3]: *** No rule to make target `-lpq', needed by 
> `/home/Geo/GRASS/grass51/dist.i686-pc-linux-gnu/etc/bin/cmd/d.mon'.  Stop.
> make[3]: Leaving directory `/home/Geo/GRASS/grass51/display/d.mon/cmd'
> make[2]: *** [subdirs] Error 1
> make[2]: Leaving directory `/home/Geo/GRASS/grass51/display/d.mon'
> make[1]: *** [subdirs] Error 1
> make[1]: Leaving directory `/home/Geo/GRASS/grass51/display'
> make: *** [default] Error 1
> 
> I guess '-lpq' must be the linking flag for Postgres library 'libpq', as 
> defined in Platform.make:
> #PostgreSQL:
> PQINCPATH           =  -I/usr/local/pgsql/include
> PQLIBPATH           =  -L/usr/local/pgsql/lib
> PQLIB               = -lpq
> 
> but looking thru the Makefiles I don't see how 'd.mon' is dependent upon 
> '-lpq', where is this specified?
> I must be missing something in the Makefile logic or layout.

d.mon/cmd/Makefile has:

	LIBES     = $(DISPLAYLIB) $(RASTERLIB) $(VECTLIB) $(DBMILIB) $(GISLIB)

	include $(MODULE_TOPDIR)/include/Make/Module.make

Module.make has:

	include $(MODULE_TOPDIR)/include/Make/Platform.make
	include $(MODULE_TOPDIR)/include/Make/Grass.make

	...

	$(BIN_CMD)/$(PGM): $(ARCH_CMD_OBJS) $(LIBES) 
		$(CC) $(LDFLAGS) -o $@ $(ARCH_CMD_OBJS) $(LIBES) $(MATHLIB) $(XDRLIB)
		@test -e $(BIN)/$(PGM) || ln $(ETC)/front.end $(BIN)/$(PGM)

IOW, the program has $(LIBES) as dependencies.

Grass.make has:

	VECTLIB     = $(VECTRLIB) $(DIG2LIB) $(SHAPELIB) $(PQLIB) $(BTREELIB)

$(PQLIB) comes from Platform.make, which is the new name for the
(configure-generated) "head" file.

So, $(VECTLIB) is only suitable for use in a rule's commands, not in
its dependencies.

The $(BIN_CMD)/$(PGM) rule in Module.make needs to be re-written, with
$(LIBES) replaced by two separate variables: one for GRASS libraries
(dependencies, specified using pathnames) and one for external
libraries (not dependencies, specified using -L/-l switches).

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



More information about the grass-dev mailing list