pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mario Emmenlauer <mario@emmenlauer.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: Julien Rouhaud <rjuju123@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17365: Error: redefinition of 'stat' in win32_port.h when including postgres.h
Date: Sun, 16 Jan 2022 16:14:19 +0100
Message-ID: <58a26524-401b-c0d1-cd4a-293fa09c4915@emmenlauer.de> (raw)
In-Reply-To: <3152885.1642087696@sss.pgh.pa.us>
References: <17365-c58cbf9d0c29586a@postgresql.org>
	<20220113122310.ay24ciikcu257nkp@jrouhaud>
	<3152885.1642087696@sss.pgh.pa.us>

On 13.01.22 16:28, Tom Lane wrote:
> In particular, what I gather from the above is that postgres.h is
> probably not the first #include in BDAPGResult.cc.  There are some
> portability tricks we play that are dependent on not having read any
> system header files before the inclusion of postgres[_fe].h, and
> what this failure looks like to me is that you've broken one of
> those tricks.  If you do insist on including one of those headers,
> place it first.

Yes, `postgres.h` not the first include in the file. Actually I can
not include it before `locale` on Linux, otherwise I get the following
error:

In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/locale:41:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/locale_facets_nonio.h:2010:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/x86_64-linux-gnu/c++/10/bits/messages_members.h:36:
/usr/include/libintl.h:61:14: error: expected ')'

The header `locale` is a dependency of my string handler, that in turn
includes quite a lot of other headers.

For PostgreSQL 13.x and earlier I could include `postgres.h` last, and
it worked on all platforms.

I can try and isolate my PostgreSQL calls and wrap them in some more
"pure" code, to avoid other includes. Or is there anything else I can
try?

All the best,

    Mario Emmenlauer





view thread (7+ messages)  latest in thread

Message-ID: <58a26524-401b-c0d1-cd4a-293fa09c4915@emmenlauer.de>
Permalink:  ../58a26524-401b-c0d1-cd4a-293fa09c4915@emmenlauer.de/
Also on:    postgresql.org/message-id/58a26524-401b-c0d1-cd4a-293fa09c4915@emmenlauer.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: mario@emmenlauer.de, tgl@sss.pgh.pa.us, rjuju123@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #17365: Error: redefinition of 'stat' in win32_port.h when including postgres.h
  In-Reply-To: <58a26524-401b-c0d1-cd4a-293fa09c4915@emmenlauer.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox