Thread: err, XLOG/UW711/cc/Doesn't compile.

err, XLOG/UW711/cc/Doesn't compile.

From
Larry Rosenman
Date:
Configured as: 

CC=cc CXX=CC ./configure  --prefix=/home/ler/pg-test --enable-syslog --with-CXX --with-perl --enable-multibyte
--with-includes=/usr/local/include--with-libs=/usr/local/lib
 

I get:

gmake -C doc all
gmake[1]: Entering directory `/home/ler/pg-dev/pgsql/doc'
gmake[1]: Nothing to be done for `all'.
gmake[1]: Leaving directory `/home/ler/pg-dev/pgsql/doc'
gmake -C src all
gmake[1]: Entering directory `/home/ler/pg-dev/pgsql/src'
gmake -C backend all
gmake[2]: Entering directory `/home/ler/pg-dev/pgsql/src/backend'
gmake -C parser parse.h
gmake[3]: Entering directory `/home/ler/pg-dev/pgsql/src/backend/parser'
bison -y -d  gram.y
mv y.tab.c ./gram.c
mv y.tab.h ./parse.h
gmake[3]: Leaving directory `/home/ler/pg-dev/pgsql/src/backend/parser'
prereqdir=`cd parser/ && pwd` && \ cd ../../src/include/parser/ && rm -f parse.h && \ ln -s $prereqdir/parse.h .
gmake -C utils fmgroids.h
gmake[3]: Entering directory `/home/ler/pg-dev/pgsql/src/backend/utils'
CPP='cc -E' AWK='gawk' /bin/sh Gen_fmgrtab.sh ../../../src/include/catalog/pg_proc.h
gmake[3]: Leaving directory `/home/ler/pg-dev/pgsql/src/backend/utils'
cd ../../src/include/utils/ && rm -f fmgroids.h && \   ln -s ../../../src/backend/utils/fmgroids.h .
gmake -C access all
gmake[3]: Entering directory `/home/ler/pg-dev/pgsql/src/backend/access'
gmake -C common SUBSYS.o
gmake[4]: Entering directory `/home/ler/pg-dev/pgsql/src/backend/access/common'
cc -O -K inline -DXLOG -I/usr/local/include -I../../../../src/include  -c -o heaptuple.o heaptuple.c
cc -O -K inline -DXLOG -I/usr/local/include -I../../../../src/include  -c -o indextuple.o indextuple.c
cc -O -K inline -DXLOG -I/usr/local/include -I../../../../src/include  -c -o indexvalid.o indexvalid.c
cc -O -K inline -DXLOG -I/usr/local/include -I../../../../src/include  -c -o printtup.o printtup.c
cc -O -K inline -DXLOG -I/usr/local/include -I../../../../src/include  -c -o scankey.o scankey.c
cc -O -K inline -DXLOG -I/usr/local/include -I../../../../src/include  -c -o tupdesc.o tupdesc.c
/bin/ld -r -o SUBSYS.o heaptuple.o indextuple.o indexvalid.o printtup.o scankey.o tupdesc.o  
gmake[4]: Leaving directory `/home/ler/pg-dev/pgsql/src/backend/access/common'
gmake -C gist SUBSYS.o
gmake[4]: Entering directory `/home/ler/pg-dev/pgsql/src/backend/access/gist'
cc -O -K inline -DXLOG -I/usr/local/include -I../../../../src/include  -c -o gist.o gist.c
cc -O -K inline -DXLOG -I/usr/local/include -I../../../../src/include  -c -o gistget.o gistget.c
cc -O -K inline -DXLOG -I/usr/local/include -I../../../../src/include  -c -o gistscan.o gistscan.c
cc -O -K inline -DXLOG -I/usr/local/include -I../../../../src/include  -c -o giststrat.o giststrat.c
/bin/ld -r -o SUBSYS.o gist.o gistget.o gistscan.o giststrat.o
gmake[4]: Leaving directory `/home/ler/pg-dev/pgsql/src/backend/access/gist'
gmake -C hash SUBSYS.o
gmake[4]: Entering directory `/home/ler/pg-dev/pgsql/src/backend/access/hash'
cc -O -K inline -DXLOG -I/usr/local/include -I../../../../src/include  -c -o hash.o hash.c
cc -O -K inline -DXLOG -I/usr/local/include -I../../../../src/include  -c -o hashfunc.o hashfunc.c
cc -O -K inline -DXLOG -I/usr/local/include -I../../../../src/include  -c -o hashinsert.o hashinsert.c
cc -O -K inline -DXLOG -I/usr/local/include -I../../../../src/include  -c -o hashovfl.o hashovfl.c
cc -O -K inline -DXLOG -I/usr/local/include -I../../../../src/include  -c -o hashpage.o hashpage.c
cc -O -K inline -DXLOG -I/usr/local/include -I../../../../src/include  -c -o hashscan.o hashscan.c
cc -O -K inline -DXLOG -I/usr/local/include -I../../../../src/include  -c -o hashsearch.o hashsearch.c
cc -O -K inline -DXLOG -I/usr/local/include -I../../../../src/include  -c -o hashstrat.o hashstrat.c
cc -O -K inline -DXLOG -I/usr/local/include -I../../../../src/include  -c -o hashutil.o hashutil.c
/bin/ld -r -o SUBSYS.o hash.o hashfunc.o hashinsert.o hashovfl.o hashpage.o hashscan.o hashsearch.o hashstrat.o
hashutil.o
gmake[4]: Leaving directory `/home/ler/pg-dev/pgsql/src/backend/access/hash'
gmake -C heap SUBSYS.o
gmake[4]: Entering directory `/home/ler/pg-dev/pgsql/src/backend/access/heap'
cc -O -K inline -DXLOG -I/usr/local/include -I../../../../src/include  -c -o heapam.o heapam.c
UX:acomp: ERROR: "heapam.c", line 1396: invalid cast expression
UX:acomp: ERROR: "heapam.c", line 1504: invalid cast expression
UX:acomp: ERROR: "heapam.c", line 1700: invalid cast expression
UX:acomp: ERROR: "heapam.c", line 1703: invalid cast expression
UX:acomp: ERROR: "heapam.c", line 2105: invalid cast expression
UX:acomp: ERROR: "heapam.c", line 2129: invalid cast expression
UX:acomp: ERROR: "heapam.c", line 2143: invalid cast expression
UX:acomp: ERROR: "heapam.c", line 2190: invalid cast expression
UX:acomp: ERROR: "heapam.c", line 2213: invalid cast expression
UX:acomp: ERROR: "heapam.c", line 2233: invalid cast expression
UX:acomp: ERROR: "heapam.c", line 2310: invalid cast expression
UX:acomp: ERROR: "heapam.c", line 2338: invalid cast expression
UX:acomp: ERROR: "heapam.c", line 2363: invalid cast expression
UX:acomp: ERROR: "heapam.c", line 2409: invalid cast expression
UX:acomp: ERROR: "heapam.c", line 2432: invalid cast expression
UX:acomp: ERROR: "heapam.c", line 2472: invalid cast expression
gmake[4]: *** [heapam.o] Error 1
gmake[4]: Leaving directory `/home/ler/pg-dev/pgsql/src/backend/access/heap'
gmake[3]: *** [heap-recursive] Error 2
gmake[3]: Leaving directory `/home/ler/pg-dev/pgsql/src/backend/access'
gmake[2]: *** [access-recursive] Error 2
gmake[2]: Leaving directory `/home/ler/pg-dev/pgsql/src/backend'
gmake[1]: *** [all] Error 2
gmake[1]: Leaving directory `/home/ler/pg-dev/pgsql/src'
gmake: *** [all] Error 2

Not Good....
-- 
Larry Rosenman                      http://www.lerctr.org/~ler
Phone: +1 972-414-9812 (voice) Internet: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749


Re: err, XLOG/UW711/cc/Doesn't compile.

From
Larry Rosenman
Date:
* Larry Rosenman <ler@lerctr.org> [001120 09:05]:
[snip]
more info.  It seems to not like the following from
src/include/buffer/bufpage.h (line 305):
#define PageSetLSN(page, lsn) \       (((PageHeader) (page))->pd_lsn = (XLogRecPtr) (lsn))

I'm not sure what it's trying to do... 

LER

-- 
Larry Rosenman                      http://www.lerctr.org/~ler
Phone: +1 972-414-9812 (voice) Internet: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749


RE: err, XLOG/UW711/cc/Doesn't compile.

From
"Mikheev, Vadim"
Date:
> more info.  It seems to not like the following from
> src/include/buffer/bufpage.h (line 305):
> #define PageSetLSN(page, lsn) \
>         (((PageHeader) (page))->pd_lsn = (XLogRecPtr) (lsn))
> 
> I'm not sure what it's trying to do... 

Just assign values to 8 bytes structure in pageheader.
Did you make distclean?

Vadim


Re: err, XLOG/UW711/cc/Doesn't compile.

From
"'Larry Rosenman'"
Date:
* Mikheev, Vadim <vmikheev@SECTORBASE.COM> [001120 12:00]:
> > more info.  It seems to not like the following from
> > src/include/buffer/bufpage.h (line 305):
> > #define PageSetLSN(page, lsn) \
> >         (((PageHeader) (page))->pd_lsn = (XLogRecPtr) (lsn))
> > 
> > I'm not sure what it's trying to do... 
> 
> Just assign values to 8 bytes structure in pageheader.
> Did you make distclean?
yes, gmake maintainer-clean.
> 
> Vadim
-- 
Larry Rosenman                      http://www.lerctr.org/~ler
Phone: +1 972-414-9812 (voice) Internet: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749


RE: err, XLOG/UW711/cc/Doesn't compile.

From
Peter Eisentraut
Date:
Mikheev, Vadim writes:

> > more info.  It seems to not like the following from
> > src/include/buffer/bufpage.h (line 305):
> > #define PageSetLSN(page, lsn) \
> >         (((PageHeader) (page))->pd_lsn = (XLogRecPtr) (lsn))
> > 
> > I'm not sure what it's trying to do... 
> 
> Just assign values to 8 bytes structure in pageheader.

It's because XLogRecPtr is a struct.  You can't assign structs with
'='.  Gotta use memcpy, etc.

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/



RE: err, XLOG/UW711/cc/Doesn't compile.

From
Peter Eisentraut
Date:
I wrote:

> Mikheev, Vadim writes:
> 
> > > more info.  It seems to not like the following from
> > > src/include/buffer/bufpage.h (line 305):
> > > #define PageSetLSN(page, lsn) \
> > >         (((PageHeader) (page))->pd_lsn = (XLogRecPtr) (lsn))
> > > 
> > > I'm not sure what it's trying to do... 
> > 
> > Just assign values to 8 bytes structure in pageheader.
> 
> It's because XLogRecPtr is a struct.  You can't assign structs with
> '='.  Gotta use memcpy, etc.

Correction:  It's because the compiler won't let you cast to a
struct.  Assigning seems to compile okay.

This code fails to compile:

| typedef struct foo { int a; int b; } foo;
| 
| main() {
|   foo x;
|   (foo) x;
| }

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/



Re: err, XLOG/UW711/cc/Doesn't compile.

From
Tom Lane
Date:
Peter Eisentraut <peter_e@gmx.net> writes:
> It's because XLogRecPtr is a struct.  You can't assign structs with
> '='.  Gotta use memcpy, etc.

Struct assignment is a required feature since ANSI C, and I'm pretty
sure we use it in other places already.  I doubt that's the explanation
for Larry's problem.
        regards, tom lane


RE: err, XLOG/UW711/cc/Doesn't compile.

From
"Mikheev, Vadim"
Date:
> > > more info.  It seems to not like the following from
> > > src/include/buffer/bufpage.h (line 305):
> > > #define PageSetLSN(page, lsn) \
> > >         (((PageHeader) (page))->pd_lsn = (XLogRecPtr) (lsn))
> > > 
> > > I'm not sure what it's trying to do... 
> > 
> > Just assign values to 8 bytes structure in pageheader.
> 
> It's because XLogRecPtr is a struct.  You can't assign structs with
> '='.  Gotta use memcpy, etc.

I had no problems with this on Solaris & Linux. Also I think that
there are another places in code where it worked so far.
Anyway, there are just two members in this struct - Larry, could
you try make this assignment by members and let us know ?

Vadim


RE: err, XLOG/UW711/cc/Doesn't compile.

From
"Mikheev, Vadim"
Date:
> > It's because XLogRecPtr is a struct.  You can't assign structs with
> > '='.  Gotta use memcpy, etc.
> 
> Correction:  It's because the compiler won't let you cast to a
> struct.  Assigning seems to compile okay.

Oh, ok - seems we can just get rid of casting there.

Vadim


Re: err, XLOG/UW711/cc/Doesn't compile.

From
"'Larry Rosenman'"
Date:
* Mikheev, Vadim <vmikheev@SECTORBASE.COM> [001120 13:26]:
> > > > more info.  It seems to not like the following from
> > > > src/include/buffer/bufpage.h (line 305):
> > > > #define PageSetLSN(page, lsn) \
> > > >         (((PageHeader) (page))->pd_lsn = (XLogRecPtr) (lsn))
> > > > 
> > > > I'm not sure what it's trying to do... 
> > > 
> > > Just assign values to 8 bytes structure in pageheader.
> > 
> > It's because XLogRecPtr is a struct.  You can't assign structs with
> > '='.  Gotta use memcpy, etc.
> 
> I had no problems with this on Solaris & Linux. Also I think that
> there are another places in code where it worked so far.
> Anyway, there are just two members in this struct - Larry, could
> you try make this assignment by members and let us know ?
I bet you used GCC on all those platforms...  cc on UnixWare is
a C99 compiler.... 

I'll see if I can find the right pieces.  This is evidently
*NON*-Portable in it's current form. 
> 
> Vadim
-- 
Larry Rosenman                      http://www.lerctr.org/~ler
Phone: +1 972-414-9812 (voice) Internet: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749


Re: err, XLOG/UW711/cc/Doesn't compile.

From
"'Larry Rosenman'"
Date:
* Mikheev, Vadim <vmikheev@SECTORBASE.COM> [001120 13:29]:
> > > It's because XLogRecPtr is a struct.  You can't assign structs with
> > > '='.  Gotta use memcpy, etc.
> > 
> > Correction:  It's because the compiler won't let you cast to a
> > struct.  Assigning seems to compile okay.
> 
> Oh, ok - seems we can just get rid of casting there.
Yup, removing the cast fixes that problem, and then we run into 
Don Baccus' issue with ecpg's yacc file. 


> 
> Vadim
-- 
Larry Rosenman                      http://www.lerctr.org/~ler
Phone: +1 972-414-9812 (voice) Internet: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749