[GRASS-dev] compilation of grass on AIX 7.1

Glynn Clements glynn at gclements.plus.com
Thu Mar 28 23:18:43 PDT 2013


Ivan Barka wrote:

> Thanks. So with fresh download, ommiting the first test error in
> lib/vector/diglib, I have next errors:
> 
> in lib/rst/interp_float:

> point2d.c:54:43: error: expected identifier or '(' before numeric constant

Line 54 is:

    double rfsta2, errmax, h, xx, yy, r2, hz, zz, err, xmm, ymm, r;

Column 43 is "hz", which AIX probably defines as a macro whose value
is (or starts with) a numberic literal.

As I said before:

> A "fix" would be for someone to care about AIX enough to figure out
> which compiler switches are required to disable the non-standard
> declarations.

AIX is notorious for namespace pollution, i.e. adding non-standard
definitions to the standard C and Unix headers, often resulting in
perfectly valid source code failing to compile due to name conflicts.

There are two possible "solutions" to this: either figure out how to
disable the non-standard definitions, or rewrite GRASS (and every
other third-party package you wish to compile) to include workarounds
for each such name as you encounter it.

For the first one, start by trying:

	make distclean
	CFLAGS='-ansi -D_POSIX_C_SOURCE=200809L -Dinline=' ./configure ...

-ansi causes gcc to define __STRICT_ANSI__, which should cause the
headers defined by ANSI/ISO C to contain only the declarations
specified in that standard.

-D_POSIX_C_SOURCE=200809L enables declarations which are specified by
POSIX-2008.

-Dinline= removes the "inline" qualifier on certain functions
("inline" was added in C99; it isn't part of C89 which is selected by
-ansi).

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list