I recently had need to do the same thing and I am having no luck. Admittedly, I am not too keen on the postgres build setup and have not debugged this extensively, but rather hoped there was an easy answer up front. That said….
I am trying to link libuuid into a custom extension, here is my make file (building PG 9.3.5 on CentOS 6.5 (GCC 4.4.7) fwiw):
MODULES = aitpowerpg
EXTENSION = aitpowerpg
DATA = aitpowerpg--1.0.sql
SHLIB_LINK += -luuid
ifdef USE_PGXS
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/aitpowerpg
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk
endif
The line SHLIB_LINK += -luuid has no effect. All of postgres builds & runs ok, this custom module builds fine but won’t load due to missing symbols which makes sense since ldd shows that libuuid is not linked in.
If I make clean, make, then just execute the last gcc invocation to link the extension then manually tack -luuid at the end, all is good.
Is there something simple I’m missing?
thanks
alan