Re: Problem with server/utils/snapmgr.h

From: Chris Browne <cbbrowne(at)acm(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Problem with server/utils/snapmgr.h
Date: 2008-04-22 15:01:38
Message-ID: 60tzhulyr1.fsf@dba2.int.libertyrms.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

alvherre(at)commandprompt(dot)com (Alvaro Herrera) writes:

> Chris Browne wrote:
>
>> If I use:
>> AC_CHECK_HEADER(utils/snapmgr.h, HAVE_SNAPMGR=1)
>>
>> this turns out to fail. Apparently autoconf wants to compile the
>> #include file to validate that it's an OK #include file.
>>
>> GCC barfs on it, thus:
>>
>> cbbrowne(at)dba2:~/Slony-I/CMD/slony1-HEAD> gcc -I/opt/OXRS/dbs/pgsql84-beta/include/server /opt/OXRS/dbs/pgsql84-beta/include/server/utils/snapmgr.h
>> In file included from /opt/OXRS/dbs/pgsql84-beta/include/server/storage/itemptr.h:17,
>> from /opt/OXRS/dbs/pgsql84-beta/include/server/access/htup.h:17,
>> from /opt/OXRS/dbs/pgsql84-beta/include/server/utils/snapshot.h:16,
>> from /opt/OXRS/dbs/pgsql84-beta/include/server/utils/tqual.h:18,
>> from /opt/OXRS/dbs/pgsql84-beta/include/server/utils/snapmgr.h:16:
>
>
> Hmm. It works for me if I forcefully include postgres.h:
>
> gcc -I/pgsql/install/00head/include/server -include postgres.h /pgsql/install/00head/include/server/utils/snapmgr.h
>
> Our header file rule says that a header must include any header it needs
> to compile, but never include postgres.h, which must be the first
> include in all the .c files.
>
> So I'm not sure the fix for this.
>
> What does Slony-I need snapmgr.h for, anyway? This code is in a state
> of a flux right now -- there are pending patches which are likely to
> change the horizon a bit. Perhaps it does not make sense for Slony to
> adjust to a state that's expected to be short-lived.

Well, one of the Sun guys observed this...
http://www.slony.info/bugzilla/show_bug.cgi?id=46

And I was trying to build against CVS HEAD (for both projects ;-)) and
observed it:

cbbrowne(at)dba2:CMD/slony1-HEAD/src/backend> make
gcc -g -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -I../.. -fpic -I/opt/OXRS/dbs/pgsql84-beta/include/ -I/opt/OXRS/dbs/pgsql84-beta/include/server/ -c -o slony1_funcs.o slony1_funcs.c
slony1_funcs.c: In function '_Slony_I_createEvent':
slony1_funcs.c:142: error: 'SerializableSnapshot' undeclared (first use in this function)
slony1_funcs.c:142: error: (Each undeclared identifier is reported only once
slony1_funcs.c:142: error: for each function it appears in.)

The definition for SerializableSnapshot has moved from
server/utils/tqual.h to server/utils/snapmgr.h

I agree that the code seems in flux; it seems quite likely that there
will be further changes between now and release of 8.4. That being
said, it's useful to observe these problems *early*, and have
workarounds, so that we can validate that Slony-I is generally
compatible with 8.4 throughout its development cycle.

As a workaround, for now, I'll see if Tom's counsel on this works out
well; I expect so.

The point of the exercise wasn't so much to ask "How do I work around
this?" as it was to point out that there's *something* up with the
header file, in that the autoconf AC_CHECK_HEADER function barfs on
it.

*THAT* (the fact that AC_CHECK_HEADER breaks) appears to be a bad
thing, irrespective of any Slony-I issues.
--
let name="cbbrowne" and tld="linuxdatabases.info" in name ^ "@" ^ tld;;
http://linuxdatabases.info/info/x.html
Signs of a Klingon Programmer - 1. "Defensive programming? Never!
Klingon programs are always on the offense. Yes, offensive programming
is what we do best."

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-04-22 15:04:38 Re: get rid of psql welcome message
Previous Message Alvaro Herrera 2008-04-22 14:21:28 Re: CommitFest Wiki page annoyance