Thread: PGXS fails to byte-compile pgsql-ogr-fdw

PGXS fails to byte-compile pgsql-ogr-fdw

From
Christoph Berg
Date:
pgsql-ogr-fdw fails to build against PG 11beta1 with JIT enabled. I
just reported this as https://github.com/pramsey/pgsql-ogr-fdw/issues/153,
but I think the problem might actually be in the PGXS Makefile - it
assumes that all objects have a .c file to build the .bc from.

---8<---

pgsql-ogr-fdw fails to build with PG 11beta1 when JIT is enabled, i.e. PostgreSQL was configured --with-llvm:

/usr/include/gdal/cpl_config.h:284:9: warning: 'PACKAGE_VERSION' macro redefined [-Wmacro-redefined]
#define PACKAGE_VERSION ""
        ^
/usr/include/postgresql/11/server/pg_config.h:788:9: note: previous definition is here
#define PACKAGE_VERSION "11beta1"
        ^
5 warnings generated.
/usr/bin/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2  -I/usr/include/gdal -I. -I/<<PKGBUILDDIR>>
-I/usr/include/postgresql/11/server-I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE
-I/usr/include/libxml2 -I/usr/include/mit-krb5 -flto=thin -emit-llvm -c -o ogr_fdw_common.bc
/<<PKGBUILDDIR>>/ogr_fdw_common.c
make[2]: *** No rule to make target 'stringbuffer_pg.bc', needed by 'all'.  Stop.

The reason it is failing is because of this Makefile rule, which builds pg_stringbuffer_pg.o from pg_stringbuffer.c -
notethe missing _pg part:
 

OBJS = ogr_fdw.o ogr_fdw_deparse.o ogr_fdw_common.o stringbuffer_pg.o

stringbuffer_pg.o: stringbuffer.c stringbuffer.h
        $(CC) $(CFLAGS) -D USE_PG_MEM -c -o $@ $<

This might as well be a PGXS bug - I'll open a thread on pgsql-hacker for discussion.

---8<---

Another bug might be that PGXS doesn't try to inherit any preprocessor
flags from the C compilation - the "-D USE_PG_MEM" part will be lost.

Christoph


Re: PGXS fails to byte-compile pgsql-ogr-fdw

From
Laurenz Albe
Date:
Christoph Berg wrote:
> pgsql-ogr-fdw fails to build against PG 11beta1 with JIT enabled. I
> just reported this as https://github.com/pramsey/pgsql-ogr-fdw/issues/153,
> but I think the problem might actually be in the PGXS Makefile - it
> assumes that all objects have a .c file to build the .bc from.

I have been bitten by that when building PostGIS.

A simple patch could fix it, but I agree that it would be better
to not build them.

Yours,
Laurenz Albe


Re: PGXS fails to byte-compile pgsql-ogr-fdw

From
Andres Freund
Date:
Hi,

On 2018-05-28 09:44:32 +0200, Christoph Berg wrote:
> pgsql-ogr-fdw fails to build against PG 11beta1 with JIT enabled. I
> just reported this as https://github.com/pramsey/pgsql-ogr-fdw/issues/153,
> but I think the problem might actually be in the PGXS Makefile - it
> assumes that all objects have a .c file to build the .bc from.

Not really see an alternative to that? What are you proposing?


> Another bug might be that PGXS doesn't try to inherit any preprocessor
> flags from the C compilation - the "-D USE_PG_MEM" part will be lost.

How could it? That seems to be a problem in the specific makefile, it
should adapt the proper variables rather than passing -D itself.

Greetings,

Andres Freund