[GRASS5] r.mapcalc compile error on Solaris

I've been doing a few test builds on different platforms (IRIX, Cygwin, Solaris and MacOSX) to try and get 5.3 ready for a 5.3.1 release in a few
days, then we can have a week or so of testing and get 5.4.0 out quite soon. Things are going well and the shared library build is now working on MacOSX and Solaris, and r.terraflow can be compiled with the Alternate Build system (which will be the default for 5.3.1 onwards).

However I'm having a problem with src/raster/r.mapcalc3 (and src.contrib/GMSL/r3.mapcalc, although that isn't used any more so doesn't matter) and yacc/lex that I don't have a clue about:

Using GNU bison 1.875d:

[pkelly@jebediah]/home/pkelly/grass/gbld(53): ./gmake53 src/raster/r.mapcalc3
make: Entering directory `/home/pkelly/grass/grass/src/raster/r.mapcalc3'
mkdir -p /home/pkelly/grass/gbld/src/raster/r.mapcalc3
make -f makefile
make[1]: Entering directory `/home/pkelly/grass/grass/src/raster/r.mapcalc3'
bison -y -b /home/pkelly/grass/gbld/src/raster/r.mapcalc3/y -d mapcalc.y
make[1]: *** [/home/pkelly/grass/gbld/src/raster/r.mapcalc3/y.tab.c] Broken Pipe
make[1]: Leaving directory `/home/pkelly/grass/grass/src/raster/r.mapcalc3'
make: *** [dir] Error 2
make: Leaving directory `/home/pkelly/grass/grass/src/raster/r.mapcalc3'
[pkelly@jebediah]/home/pkelly/grass/gbld(54):

Using the default yacc in Solaris 8:

[pkelly@jebediah]/home/pkelly/grass/gbld(60): ./gmake53 src/raster/r.mapcalc3
make: Entering directory `/home/pkelly/grass/grass/src/raster/r.mapcalc3'
mkdir -p /home/pkelly/grass/gbld/src/raster/r.mapcalc3
make -f makefile
make[1]: Entering directory `/home/pkelly/grass/grass/src/raster/r.mapcalc3'
/usr/ccs/bin/yacc -b /home/pkelly/grass/gbld/src/raster/r.mapcalc3/y -d mapcalc.y
gcc -I/home/pkelly/grass/gbld/src/raster/r.mapcalc3 -I/home/pkelly/grass/grass/src/raster/r.mapcalc3 -I/home/pkelly/grass/grass/src/include -I/home/pkelly/grass/gbld/src/include -O2 -fPIC -c -o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/y.tab.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/y.tab.c
lex -t mapcalc.l > /home/pkelly/grass/gbld/src/raster/r.mapcalc3/lex.yy.c
"mapcalc.l":line 126: Warning: Non-portable Character Class
gcc -I/home/pkelly/grass/gbld/src/raster/r.mapcalc3 -I/home/pkelly/grass/grass/src/raster/r.mapcalc3 -I/home/pkelly/grass/grass/src/include -I/home/pkelly/grass/gbld/src/include -O2 -fPIC -c -o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/lex.yy.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/lex.yy.c
/home/pkelly/grass/gbld/src/raster/r.mapcalc3/lex.yy.c: In function `get_input_string':
/home/pkelly/grass/gbld/src/raster/r.mapcalc3/lex.yy.c:112: error: `YY_NULL' undeclared (first use in this function)
/home/pkelly/grass/gbld/src/raster/r.mapcalc3/lex.yy.c:112: error: (Each undeclared identifier is reported only once
/home/pkelly/grass/gbld/src/raster/r.mapcalc3/lex.yy.c:112: error: for each function it appears in.)
/home/pkelly/grass/gbld/src/raster/r.mapcalc3/lex.yy.c: In function `get_input_stream':
/home/pkelly/grass/gbld/src/raster/r.mapcalc3/lex.yy.c:124: error: `YY_NULL' undeclared (first use in this function)
make[1]: *** [/home/pkelly/grass/gbld/src/raster/r.mapcalc3/lex.yy.o] Error 1
make[1]: Leaving directory `/home/pkelly/grass/grass/src/raster/r.mapcalc3'
make: *** [dir] Error 2
make: Leaving directory `/home/pkelly/grass/grass/src/raster/r.mapcalc3'
[pkelly@jebediah]/home/pkelly/grass/gbld(61):

If anybody has an idea it would be nice to get this fixed before the release.

Paul

Paul Kelly wrote:

I've been doing a few test builds on different platforms (IRIX, Cygwin,
Solaris and MacOSX) to try and get 5.3 ready for a 5.3.1 release in a few
days, then we can have a week or so of testing and get 5.4.0 out quite
soon. Things are going well and the shared library build is now working on
MacOSX and Solaris, and r.terraflow can be compiled with the Alternate
Build system (which will be the default for 5.3.1 onwards).

However I'm having a problem with src/raster/r.mapcalc3 (and
src.contrib/GMSL/r3.mapcalc, although that isn't used any more so doesn't
matter) and yacc/lex that I don't have a clue about:

Using GNU bison 1.875d:

[pkelly@jebediah]/home/pkelly/grass/gbld(53): ./gmake53 src/raster/r.mapcalc3
make: Entering directory `/home/pkelly/grass/grass/src/raster/r.mapcalc3'
mkdir -p /home/pkelly/grass/gbld/src/raster/r.mapcalc3
make -f makefile
make[1]: Entering directory `/home/pkelly/grass/grass/src/raster/r.mapcalc3'
bison -y -b /home/pkelly/grass/gbld/src/raster/r.mapcalc3/y -d mapcalc.y
make[1]: *** [/home/pkelly/grass/gbld/src/raster/r.mapcalc3/y.tab.c] Broken Pipe

No idea. Can you run the command via strace or gdb to obtain more
information?

lex -t mapcalc.l > /home/pkelly/grass/gbld/src/raster/r.mapcalc3/lex.yy.c
"mapcalc.l":line 126: Warning: Non-portable Character Class

No idea here; does the lex documentation explain this message?

gcc -I/home/pkelly/grass/gbld/src/raster/r.mapcalc3 -I/home/pkelly/grass/grass/src/raster/r.mapcalc3 -I/home/pkelly/grass/grass/src/include -I/home/pkelly/grass/gbld/src/include -O2 -fPIC -c -o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/lex.yy.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/lex.yy.c
/home/pkelly/grass/gbld/src/raster/r.mapcalc3/lex.yy.c: In function `get_input_string':
/home/pkelly/grass/gbld/src/raster/r.mapcalc3/lex.yy.c:112: error: `YY_NULL' undeclared (first use in this function)

This might be a flex extension; try adding:

  #ifndef YY_NULL
  #define YY_NULL 0
  #endif

to the top of mapcalc.l (anywhere between the %{ and get_input_string()).

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

On Mon, 11 Oct 2004, Glynn Clements wrote:

[...]
More comments on the other bits when I've time to look at them... (could also have been a problem using Solaris lex with GNU bison)

gcc -I/home/pkelly/grass/gbld/src/raster/r.mapcalc3 -I/home/pkelly/grass/grass/src/raster/r.mapcalc3 -I/home/pkelly/grass/grass/src/include -I/home/pkelly/grass/gbld/src/include -O2 -fPIC -c -o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/lex.yy.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/lex.yy.c
/home/pkelly/grass/gbld/src/raster/r.mapcalc3/lex.yy.c: In function `get_input_string':
/home/pkelly/grass/gbld/src/raster/r.mapcalc3/lex.yy.c:112: error: `YY_NULL' undeclared (first use in this function)

This might be a flex extension; try adding:

  #ifndef YY_NULL
  #define YY_NULL 0
  #endif

to the top of mapcalc.l (anywhere between the %{ and get_input_string()).

Yes that worked. Got a lot further. Next error:

make: Entering directory `/home/pkelly/grass/grass/src/raster/r.mapcalc3'
mkdir -p /home/pkelly/grass/gbld/src/raster/r.mapcalc3
make -f makefile
make[1]: Entering directory `/home/pkelly/grass/grass/src/raster/r.mapcalc3'
gcc -L/home/pkelly/grass/gbld/src/libes -s -Wl,-R,/home/pkelly/grass/gbld/src/libes -o /home/pkelly/grass/gbld/dist.sparc-sun-solaris2.8/etc/bin/cmd/r.mapcalc /home/pkelly/grass/gbld/src/raster/r.mapcalc3/y.tab.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/lex.yy.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/evaluate.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/expression.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/function.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/check.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/main.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xabs.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xadd.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xand.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xatan.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xcos.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xdiv.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xdouble.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xeq.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xeval.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xexp.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xfloat.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xge.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xgraph.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xgt.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xif.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xint.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xisnull.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xle.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xlog.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xlt.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xmax.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xmedian.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xmin.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xmod.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xmode.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xmul.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xne.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xneg.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xnot.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xnull.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xor.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xpow.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xrand.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xround.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xrowcol.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xsin.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xsqrt.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xsub.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xtan.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/map.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xcoor.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xres.o -lgrass_gis -lsocket -lgrass_btree -lgrass_rowio -lm -lnsl -lz Undefined first referenced
  symbol in file
yyterminate /home/pkelly/grass/gbld/src/raster/r.mapcalc3/lex.yy.o
ld: fatal: Symbol referencing errors. No output written to /home/pkelly/grass/gbld/dist.sparc-sun-solaris2.8/etc/bin/cmd/r.mapcalc
collect2: ld returned 1 exit status
make[1]: *** [/home/pkelly/grass/gbld/dist.sparc-sun-solaris2.8/etc/bin/cmd/r.mapcalc] Error 1
make[1]: Leaving directory `/home/pkelly/grass/grass/src/raster/r.mapcalc3'
make: *** [dir] Error 2
make: Leaving directory `/home/pkelly/grass/grass/src/raster/r.mapcalc3'

Paul Kelly wrote:

>> gcc -I/home/pkelly/grass/gbld/src/raster/r.mapcalc3 -I/home/pkelly/grass/grass/src/raster/r.mapcalc3 -I/home/pkelly/grass/grass/src/include -I/home/pkelly/grass/gbld/src/include -O2 -fPIC -c -o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/lex.yy.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/lex.yy.c
>> /home/pkelly/grass/gbld/src/raster/r.mapcalc3/lex.yy.c: In function `get_input_string':
>> /home/pkelly/grass/gbld/src/raster/r.mapcalc3/lex.yy.c:112: error: `YY_NULL' undeclared (first use in this function)
>
> This might be a flex extension; try adding:
>
> #ifndef YY_NULL
> #define YY_NULL 0
> #endif
>
> to the top of mapcalc.l (anywhere between the %{ and get_input_string()).

Yes that worked. Got a lot further. Next error:

make: Entering directory `/home/pkelly/grass/grass/src/raster/r.mapcalc3'
mkdir -p /home/pkelly/grass/gbld/src/raster/r.mapcalc3
make -f makefile
make[1]: Entering directory `/home/pkelly/grass/grass/src/raster/r.mapcalc3'
gcc -L/home/pkelly/grass/gbld/src/libes -s -Wl,-R,/home/pkelly/grass/gbld/src/libes -o /home/pkelly/grass/gbld/dist.sparc-sun-solaris2.8/etc/bin/cmd/r.mapcalc /home/pkelly/grass/gbld/src/raster/r.mapcalc3/y.tab.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/lex.yy.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/evaluate.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/expression.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/function.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/check.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/main.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xabs.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xadd.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xand.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xatan.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xcos.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xdiv.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xdouble.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xeq.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xeval.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xexp.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xfloat.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xge.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xgraph.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xgt.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xif.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xint.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xisnull.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xle.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xlog.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xlt.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xmax.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xmedian.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xmin.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xmod.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xmode.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xmul.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xne.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xneg.o /ho

me/pkelly/grass/gbld/src/raster/r.mapcalc3/xnot.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xnull.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xor.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xpow.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xrand.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xround.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xrowcol.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xsin.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xsqrt.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xsub.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xtan.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/map.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xcoor.o /home/pkelly/grass/gbld/src/raster/r.mapcalc3/xres.o -lgrass_gis -lsocket -lgrass_btree -lgrass_rowio -lm -lnsl -lz

Undefined first referenced
  symbol in file
yyterminate /home/pkelly/grass/gbld/src/raster/r.mapcalc3/lex.yy.o

OK; that's a macro, defined as:

  #ifndef yyterminate
  #define yyterminate() return YY_NULL
  #endif

At least the flex manpage says that yyterminate() isn't in AT&T lex or
the POSIX specification; it doesn't mention YY_NULL.

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

On Mon, 11 Oct 2004, Glynn Clements wrote:

  symbol in file
yyterminate /home/pkelly/grass/gbld/src/raster/r.mapcalc3/lex.yy.o

OK; that's a macro, defined as:

  #ifndef yyterminate
  #define yyterminate() return YY_NULL
  #endif

Yes it all works fine now. Changes committed to CVS and I also disabled building the old r3.mapcalc by removing it from src.contrib/GMSL/g3d/src3d/raster/Gmakefile

Paul

Will this affect the name of the module that is compiled in the end? If so,
let me know so that I can change the entries in tcltkgrass that refer to
this.

Michael

On 10/12/04 9:29 AM, "Paul Kelly" <paul-grass@stjohnspoint.co.uk> wrote:

On Mon, 11 Oct 2004, Glynn Clements wrote:

  symbol in file
yyterminate
/home/pkelly/grass/gbld/src/raster/r.mapcalc3/lex.yy.o

OK; that's a macro, defined as:

#ifndef yyterminate
#define yyterminate() return YY_NULL
#endif

Yes it all works fine now. Changes committed to CVS and I also disabled
building the old r3.mapcalc by removing it from
src.contrib/GMSL/g3d/src3d/raster/Gmakefile

Paul

______________________________
Michael Barton, Professor of Anthropology
School of Human Diversity and Social Change
Arizona State University
Tempe, AZ 85287-2402
USA

voice: 480-965-6262; fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

Michael Barton wrote:

> Yes it all works fine now. Changes committed to CVS and I also disabled
> building the old r3.mapcalc by removing it from
> src.contrib/GMSL/g3d/src3d/raster/Gmakefile

Will this affect the name of the module that is compiled in the end?

No. It's still called r3.mapcalc.

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