Thread: problems compiling on solaris

problems compiling on solaris

From
Alan Stange
Date:
Hello all,

I'm trying to compile pg7.4.1 on Solaris using the Sun compilers.   All
works fine except that I get this error in tuptoaster.c:

cc -Xa -fast -I../../../../src/include -I/usr/local/ren/prod/include/
-c -o tuptoaster.o tuptoaster.c
cc: Warning: -xarch=native has been explicitly specified, or implicitly
specified by a macro option, -xarch=native on this architecture implies
-xarch=v8plusb which generates code that does not run on pre UltraSPARC
III processors
"tuptoaster.c", line 831: member can not have variably modified type: data
cc: acomp failed for tuptoaster.c
gmake: *** [tuptoaster.o] Error 2


What am I missing?  This happens when simply doing a
CC=cc ./configure; gmake

Thanks!

-- Alan

Re: problems compiling on solaris

From
Tom Lane
Date:
Alan Stange <stange@rentec.com> writes:
> I'm trying to compile pg7.4.1 on Solaris using the Sun compilers.   All
> works fine except that I get this error in tuptoaster.c:

> "tuptoaster.c", line 831: member can not have variably modified type: data
> cc: acomp failed for tuptoaster.c

That's bizarre.  It's pointing at this declaration:

    struct
    {
        struct varlena hdr;
        char        data[TOAST_MAX_CHUNK_SIZE];
    }            chunk_data;

The only thing I can think of is that your compiler must be too stupid
to reduce the TOAST_MAX_CHUNK_SIZE expression to a compile-time
constant.  I'd report that to Sun as a compiler bug --- this code has
been like this for a good long time, and no one has ever reported a
compiler unable to deal with it before.

A short-term workaround for you could be to compute TOAST_MAX_CHUNK_SIZE
by hand and change its #define in src/include/access/tuptoaster.h
to be a simple constant.

            regards, tom lane