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 1lKOJH-0001T9-O7 for pgsql-bugs@arkaria.postgresql.org; Thu, 11 Mar 2021 16:37:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lKOJG-00081F-GI for pgsql-bugs@arkaria.postgresql.org; Thu, 11 Mar 2021 16:37:14 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lKOJG-000818-A9 for pgsql-bugs@lists.postgresql.org; Thu, 11 Mar 2021 16:37:14 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lKOJE-0007Id-2a for pgsql-bugs@lists.postgresql.org; Thu, 11 Mar 2021 16:37:13 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 12BGbBJN2294905; Thu, 11 Mar 2021 11:37:11 -0500 From: Tom Lane To: "Regina Obe" cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16920: Can't compile PostGIS with MingW64 against PostgreSQL 14 head In-reply-to: <000501d71691$c616a200$5243e600$@pcorp.us> References: <16920-2332590daf58407c@postgresql.org> <2291040.1615474929@sss.pgh.pa.us> <000501d71691$c616a200$5243e600$@pcorp.us> Comments: In-reply-to "Regina Obe" message dated "Thu, 11 Mar 2021 11:15:36 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2294903.1615480631.1@sss.pgh.pa.us> Date: Thu, 11 Mar 2021 11:37:11 -0500 Message-ID: <2294904.1615480631@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "Regina Obe" writes: > From: Tom Lane [mailto:tgl@sss.pgh.pa.us] >> Hmm, our mingw64 buildfarm animals aren't detecting any particular >> problem here. Is PostGIS doing anything unusual with injecting special >> symbols via -D switches? Or maybe including something else before >> postgres.h? The symptoms look like a header-inclusion-order problem ... > The order in one of the problem files looks like this: > Starting: > https://git.osgeo.org/gitea/postgis/postgis/src/branch/master/postgis/lwgeom > _in_gml.c#L50 > #include > #include > #include > #include > #include "postgres.h" > #include "executor/spi.h" > #include "utils/builtins.h" > #include "../postgis_config.h" > #include "lwgeom_pg.h" > #include "liblwgeom.h" > #include "lwgeom_transform.h" Our usual recommendation is to include postgres.h before all else; is there a really good reason to be pulling in libxml headers before that? Having seen this, I now guess that your issue is happening because one of those headers has already included before win32_port.h tries to do so. That makes our attempt to relabel the system's "struct stat" as "struct microsoft_native_stat" not work. In general, the portability hacks that postgres.h does for some platforms aren't reliable if any system headers have already been pulled in. regards, tom lane