PGXS fails to byte-compile pgsql-ogr-fdw

From: Christoph Berg <myon(at)debian(dot)org>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: PGXS fails to byte-compile pgsql-ogr-fdw
Date: 2018-05-28 07:44:32
Message-ID: 20180528074432.GB22299@msg.df7cb.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 - note the 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Yuriy Zhuravlev 2018-05-28 08:02:42 Re: Is a modern build system acceptable for older platforms
Previous Message Pierre Ducroquet 2018-05-28 07:42:32 Re: Is a modern build system acceptable for older platforms