PGXS fails to byte-compile pgsql-ogr-fdw - Mailing list pgsql-hackers

From Christoph Berg
Subject PGXS fails to byte-compile pgsql-ogr-fdw
Date
Msg-id 20180528074432.GB22299@msg.df7cb.de
Whole thread Raw
Responses Re: PGXS fails to byte-compile pgsql-ogr-fdw  (Laurenz Albe <laurenz.albe@cybertec.at>)
Re: PGXS fails to byte-compile pgsql-ogr-fdw  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
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


pgsql-hackers by date:

Previous
From: Pierre Ducroquet
Date:
Subject: Re: Is a modern build system acceptable for older platforms
Next
From: Yuriy Zhuravlev
Date:
Subject: Re: Is a modern build system acceptable for older platforms