Re: pgxs question - linking c-functions to external libraries

From: Alan Nilsson <anilsson(at)apple(dot)com>
To: PostgreSQL General Discussion Forum <pgsql-general(at)postgresql(dot)org>
Cc: Rad Cirskis <rad(dot)cirskis(at)endace(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>
Subject: Re: pgxs question - linking c-functions to external libraries
Date: 2014-12-12 20:59:20
Message-ID: 3513A941-1027-4825-8E91-F0AEC4C3843D@apple.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

> On Jun 19, 2013, at 6:57 AM, Peter Eisentraut <peter_e(at)gmx(dot)net> wrote:
>
> On 6/6/13 11:49 PM, Rad Cirskis wrote:
>> Hi John,
>> have you managed to get it to link with external shared libs?
>
> Sure, many extensions to that. Do something like
>
> SHLIB_LINK += -lfoo
>
> in your Makefile.
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2014-12-12 21:06:49 Re: pgxs question - linking c-functions to external libraries
Previous Message Marc Mamin 2014-12-12 19:25:13 Re: Removing duplicate records from a bulk upload (rationale behind selecting a method)