[GRASS-dev] wingrass: problems with some Makefiles

Glynn Clements glynn at gclements.plus.com
Thu Oct 18 01:55:08 EDT 2007

Moritz Lennert wrote:

> Hello,
> It took me awhile to respond to this, as I had the feeling that I did
> something wrong reinstalling mingw/msys since I was getting more
> compilation errors than before.
> However, after double-checking with Benjamin's notes (thanks!), whether my
> installation was the problem. I currently use mingw 5.1.3 and
> MSYS-1.0.11-2004.04.30-1, flex-2.5.33-MSYS-1.0.11, bison-2.3-MSYS-1.0.11,
> make-3.81-MSYS-1.0.11-1, reinstalled from scratch.
> See attached error.log for all the errors. I erased the log of the
> "normal" errors (i.* commands, and database drivers which fail because of
> the failure of sqlp).

Regarding r.mapcalc:

: /c/grasssrc/grass6/raster/r.mapcalc
: gcc -I/c/grasssrc/grass6/dist.i686-pc-mingw32/include -I/c/grasslibs/include -g -O2  -I/c/grasslibs/include      -DPACKAGE=\""grassmods"\"  -I/c/grasssrc/grass6/dist.i686-pc-mingw32/include \
: 		-o OBJ.i686-pc-mingw32/lex.yy.o -c lex.yy.c

Is this snipped, or is it a re-compilation? Because there should be
calls to bison and flex at the beginning:

: make -C r.mapcalc || echo /usr/local/src/grass/cvs/raster/r.mapcalc >> /usr/local/src/grass/cvs/error.log
: make[2]: Entering directory `/usr/local/src/grass/cvs/raster/r.mapcalc'
: bison -y -b y -d mapcalc.y
: test -d OBJ.i686-pc-linux-gnu || mkdir -p OBJ.i686-pc-linux-gnu
: gcc -I/usr/local/src/grass/cvs/dist.i686-pc-linux-gnu/include  -g -Wall -Wno-parentheses -Wno-format-zero-length        -DPACKAGE=\""grassmods"\"  -I/usr/local/src/grass/cvs/dist.i686-pc-linux-gnu/include \
: 		-o OBJ.i686-pc-linux-gnu/y.tab.o -c y.tab.c
: flex -t mapcalc.l > lex.yy.c
: gcc -I/usr/local/src/grass/cvs/dist.i686-pc-linux-gnu/include  -g -Wall -Wno-parentheses -Wno-format-zero-length        -DPACKAGE=\""grassmods"\"  -I/usr/local/src/grass/cvs/dist.i686-pc-linux-gnu/include \
: 		-o OBJ.i686-pc-linux-gnu/lex.yy.o -c lex.yy.c

The errors:

: gcc -L/c/grasssrc/grass6/dist.i686-pc-mingw32/lib -Wl,--export-dynamic,--enable-runtime-pseudo-reloc  -L/c/grasslibs/lib  -L/c/Programme/PostgreSQL/8.2/lib  -o /c/grasssrc/grass6/dist.i686-pc-mingw32/bin/r.mapcalc.exe OBJ.i686-pc-mingw32/y.tab.o OBJ.i686-pc-mingw32/lex.yy.o OBJ.i686-pc-mingw32/column_shift.o OBJ.i686-pc-mingw32/evaluate.o OBJ.i686-pc-mingw32/expression.o OBJ.i686-pc-mingw32/function.o OBJ.i686-pc-mingw32/check.o OBJ.i686-pc-mingw32/main.o OBJ.i686-pc-mingw32/xabs.o OBJ.i686-pc-mingw32/xadd.o OBJ.i686-pc-mingw32/xand.o OBJ.i686-pc-mingw32/xand2.o OBJ.i686-pc-mingw32/xacos.o OBJ.i686-pc-mingw32/xasin.o OBJ.i686-pc-mingw32/xatan.o OBJ.i686-pc-mingw32/xbitand.o OBJ.i686-pc-mingw32/xbitnot.o OBJ.i686-pc-mingw32/xbitor.o OBJ.i686-pc-mingw32/xbitxor.o OBJ.i686-pc-mingw32/xcos.o OBJ.i686-pc-mingw32/xdiv.o OBJ.i686-pc-mingw32/xdouble.o OBJ.i686-pc-mingw32/xeq.o OBJ.i686-pc-mingw32/xeval.o OBJ.i686-pc-mingw32/xexp.o OBJ.i686-pc-mingw32/xfloat.o OBJ.i686-pc-mingw32/xge.o OBJ.i686-pc-mingw32/xgraph.o OBJ.i686-pc-mingw32/xgt.o OBJ.i686-pc-mingw32/xif.o OBJ.i686-pc-mingw32/xint.o OBJ.i686-pc-mingw32/xisnull.o OBJ.i686-pc-mingw32/xle.o OBJ.i686-pc-mingw32/xlog.o OBJ.i686-pc-mingw32/xlt.o OBJ.i686-pc-mingw32/xmax.o OBJ.i686-pc-mingw32/xmedian.o OBJ.i686-pc-mingw32/xmin.o OBJ.i686-pc-mingw32/xmod.o OBJ.i686-pc-mingw32/xmode.o OBJ.i686-pc-mingw32/xmul.o OBJ.i686-pc-mingw32/xne.o OBJ.i686-pc-mingw32/xneg.o OBJ.i686-pc-mingw32/xnot.o OBJ.i686-pc-mingw32/xnull.o OBJ.i686-pc-mingw32/xor.o OBJ.i686-pc-mingw32/xor2.o OBJ.i686-pc-mingw32/xpow.o OBJ.i686-pc-mingw32/xrand.o OBJ.i686-pc-mingw32/xround.o OBJ.i686-pc-mingw32/xrowcol.o OBJ.i686-pc-mingw32/xshiftl.o OBJ.i686-pc-mingw32/xshiftr.o OBJ.i686-pc-mingw32/xshiftru.o OBJ.i686-pc-mingw32/xsin.o OBJ.i686-pc-mingw32/xsqrt.o OBJ.i686-pc-mingw32/xsub.o OBJ.i686-pc-mingw32/xtan.o OBJ.i686-pc-mingw32/map.o OBJ.i686-pc-mingw32/xcoor.o OBJ.i686-pc-mingw32/xres.o ../../lib/gis/OBJ.i686-pc-mingw32/fmode.o -lgrass_gis -lgrass_datetime -lxdr -liberty -lws2_32    -lz     -lgrass_b
tree -lgrass_rowio     -lxdr -liberty -lws2_32    -lz 
: OBJ.i686-pc-mingw32/y.tab.o: In function `yyparse':c:/grasssrc/grass6/raster/r.mapcalc/y.tab.c:1440: undefined reference to `yylex'
: OBJ.i686-pc-mingw32/y.tab.o: In function `parse_string':c:/grasssrc/grass6/raster/r.mapcalc/mapcalc.y:269: undefined reference to `initialize_scanner_string'
: OBJ.i686-pc-mingw32/y.tab.o: In function `parse_stream':c:/grasssrc/grass6/raster/r.mapcalc/mapcalc.y:277: undefined reference to `initialize_scanner_stream'

all point to lex.yy.o (and presumably lex.yy.c) being bogus. As
lex.yy.c is generated by redirection, it will still be created (but
will be empty or contain garbage) if flex fails.

> > Try "make -p -C display/d.frame".
> log attached.

I think that this should fix the d.frame case:

--- display/d.frame/Makefile	29 Sep 2007 15:11:27 -0000	1.12
+++ display/d.frame/Makefile	18 Oct 2007 05:31:02 -0000
@@ -12,7 +12,7 @@
 	$(ETC)/frame.select \
 	$(ETC)/frame.dumper \
 	$(ETC)/frame.list \
-	$(BIN)/$(PGM) \
+	$(BIN)/$(PGM)$(EXE) \
 $(ETC)/frame.create: $(OBJDIR)/create.o $(DEPLIBS)
@@ -27,5 +27,5 @@
 $(ETC)/frame.list: $(OBJDIR)/list.o $(DEPLIBS)
 	$(CC) $(LDFLAGS) -o $@ $(OBJDIR)/list.o $(LIBES) $(MATHLIB) $(XDRLIB)
-$(BIN)/$(PGM): $(OBJDIR)/frame.o $(DEPLIBS)
+$(BIN)/$(PGM)$(EXE): $(OBJDIR)/frame.o $(DEPLIBS)
 	$(CC) $(LDFLAGS) -o $@ $(OBJDIR)/frame.o $(LIBES) $(MATHLIB) $(XDRLIB)

> >> It seems to have some difficulty separating v.voronoi and v.delaunoy
> >> builds...
> >
> > Try moving the lines:
> >
> > 	VORONOI = v.voronoi$(EXE)
> > 	DELAUNAY = v.delaunay$(EXE)
> >
> >
> > to after Module.make is included. I think that it's not getting the .exe
> > extension, so it's try to use the default compilation rule (which uses
> > all .o files) rather than those at the bottom of the Makefile.
> I did that and no difference (see error.log).

	for prog in v.voronoi.exe v.delaunay.exe ; do make htmlcmd PGM=$prog ; done
	make[1]: Entering directory `/c/grasssrc/grass6/vector/v.voronoi'
	make /c/grasssrc/grass6/dist.i686-pc-mingw32/docs/html/v.voronoi.exe.html HTMLSRC=/c/grasssrc/grass6/dist.i686-pc-mingw32/bin/v.voronoi.exe.exe


The PROGRAMS variable is supposed to contain the "base" names without
the .exe suffix (the HTML file should be e.g. v.voronoi.html, not
v.voronoi.exe.html). Try this:

--- vector/v.voronoi/Makefile	22 Sep 2006 16:30:51 -0000	1.7
+++ vector/v.voronoi/Makefile	18 Oct 2007 05:36:08 -0000
@@ -1,8 +1,8 @@
-VORONOI = v.voronoi$(EXE)
-DELAUNAY = v.delaunay$(EXE)
+VORONOI = v.voronoi
+DELAUNAY = v.delaunay
@@ -25,11 +25,11 @@
 DELAUNAY_ARCH_OBJS := $(foreach obj,$(DELAUNAY_OBJS),$(OBJDIR)/$(obj))
-default: $(BIN)/$(DELAUNAY) $(BIN)/$(VORONOI) htmlmulti
+default: $(BIN)/$(DELAUNAY)$(EXE) $(BIN)/$(VORONOI)$(EXE) htmlmulti

> A bit frustrated here, having gone from a perfectly functioning
> compilation to something that leaves me with an unusable GRASS in windows.

Previously, a target was really just a label to identify a particular
rule. It often didn't actually matter if the name of the target didn't
match the name of the file being built (in the worst case, you would
just get unnecessary re-compilation, as the target would never exist).

One of the consequences of the recent changes is that the name of the
target normally has to match the name of the file which is built.

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-dev mailing list