Re: BUG #16920: Can't compile PostGIS with MingW64 against PostgreSQL 14 head

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: "Regina Obe" <lr@pcorp.us>
Cc: pgsql-bugs@lists.postgresql.org
Date: 2021-03-11T16:37:11Z
Lists: pgsql-bugs
"Regina Obe" <lr@pcorp.us> 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 <libxml/tree.h>
> #include <libxml/parser.h>
> #include <libxml/xpath.h>
> #include <libxml/xpathInternals.h>

> #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 <sys/stat.h> 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



Commits

  1. Work around issues in MinGW-64's setjmp/longjmp support.