[GRASS-dev] compilation of grass on AIX 7.1

Glynn Clements glynn at gclements.plus.com
Fri Mar 22 17:47:56 PDT 2013

Markus Neteler wrote:

> >> /afs/cluster/myuser/private/software/grass-7.0.svn/lib/db/sqlp> make
> >> sqlp.yy.c:1: error: expected identifier or '(' before numeric constant
> >
> > You'll need to post your sqlp.yy.c file; it's generated by yacc/bison,

Oops; *.yy.c is generated by lex/flex, not bison.

> > so there's no guarantee that yours is the same as anyone else's.
> OK - file attached: gcc_sqlp.yy.c.gz

Line 1:

	0: (Warning) Unknown option s

Grass.make hard-codes:

	# lexical analyzer and default options
	LFLAGS      = -s

GNU flex has a -s switch:

       -s, --nodefault
	      suppress default rule to ECHO unmatched text

but that's not specified by POSIX:


We should remove that flag.

But we should also fix the lex files:

	sqlp.l:209: warning, -s option given but default rule can be matched
	mapcalc.l:216: warning, -s option given but default rule can be matched

This indicates that there are certain character sequences which don't
match any token. Without -s, flex will add a rule to echo unmatched
characters to stdout, which is undesirable.

r55504 removes the -s from LFLAGS and adds error rules to sqlp.l and

> > It's possible that AIX' yacc generates code which requires xlc.
> After distclean I have reconfigured and recompiled with xlc but this leads to:

> "sqlp.yy.c", line 1.1: 1506-046 (S) Syntax error.

Yep; the generated file won't work with any C compiler. This is partly
the fault of AIX' lex for writing the error message to stdout (which
is where the generated C source code is written when -t is used).

> However, the resulting files are identical:
> diff -u gcc_sqlp.yy.c aix_sqlp.yy.c
> -> no difference

lex doesn't know which C compiler you will be using.

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-dev mailing list