Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n97Ej-0004pX-H7 for pgsql-bugs@arkaria.postgresql.org; Sun, 16 Jan 2022 15:14:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n97Ei-0003ed-Co for pgsql-bugs@arkaria.postgresql.org; Sun, 16 Jan 2022 15:14:28 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n97Ei-0003eU-4R for pgsql-bugs@lists.postgresql.org; Sun, 16 Jan 2022 15:14:28 +0000 Received: from aldebaran.he1ix.org ([2a01:4f8:173:803:0:a1de:ba:a]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n97Eg-0007om-WC for pgsql-bugs@lists.postgresql.org; Sun, 16 Jan 2022 15:14:27 +0000 Received: from [188.194.28.182] (helo=[192.168.1.160]) by aldebaran.he1ix.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1n97Ea-00HEaK-1J; Sun, 16 Jan 2022 16:14:20 +0100 To: Tom Lane , Julien Rouhaud Cc: pgsql-bugs@lists.postgresql.org References: <17365-c58cbf9d0c29586a@postgresql.org> <20220113122310.ay24ciikcu257nkp@jrouhaud> <3152885.1642087696@sss.pgh.pa.us> From: Mario Emmenlauer Message-ID: <58a26524-401b-c0d1-cd4a-293fa09c4915@emmenlauer.de> Date: Sun, 16 Jan 2022 16:14:19 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <3152885.1642087696@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 188.194.28.182 X-SA-Exim-Mail-From: mario@emmenlauer.de X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on aldebaran.he1ix.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, NICE_REPLY_A,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.4 Subject: Re: BUG #17365: Error: redefinition of 'stat' in win32_port.h when including postgres.h X-SA-Exim-Version: 4.2.1 (built Sat, 08 Feb 2020 21:53:50 +0000) X-SA-Exim-Scanned: Yes (on aldebaran.he1ix.org) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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