Skip site navigation (1) Skip section navigation (2)

Re: Frustrating issue with PGXS

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Eddie Stanley <eddiewould(at)paradise(dot)net(dot)nz>
Cc: PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>, mux(at)elvis(dot)mu(dot)org
Subject: Re: Frustrating issue with PGXS
Date: 2007-06-25 18:35:17
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
Dear Eddie,

> MODULES = example
> PGXS := $(shell ~/install_dir/bin/pg_config --pgxs)

This is indeed not the intented use of pgxs: it breaks a desirable 
property of the makefile that is should be "generic" wrt postgresql, that 
is not particular to an installation.

You are really expected to rely on the path, although the definition you 
wrote is indeed tempting, although doomed to failure. From the 
documentation, one finds:

33.9.7. Extension Building Infrastructure


PGXS := $(shell pg_config --pgxs)
include $(PGXS)

The last two lines should always be the same. Earlier in the file, you 
assign variables or add custom make rules.


The extension is compiled and installed for the PostgreSQL installation 
that corresponds to the first pg_config command found in your path.

There could be a clearer comment about the path assumption in "" 
and how to change the path easily from the shell?  The "should be the 
same" could be changed for "MUST always be the same..." with some 
additional comments.

> Could this have been avoided if the had
> PG_CONFIG = $(prefix)/bin/pg_config ?

That would not work, because "pg_config" is needed to know what the prefix 
(or rather bindir) is, as Tom pointed out. I think this is also because 
the "installation" may be moved around, so it is not necessarily the 
configure-time prefix which is used with some package systems.

His suggestion about using a PG_CONFIG macro in the initial makefile, 
which may be redefined if required, would also provide an alternative way 
supplying the right pg_config, at the price of one additional line. Mm.
I think a doc improvement is at least welcome.


In response to

pgsql-hackers by date

Next:From: Fabien COELHODate: 2007-06-25 18:46:35
Subject: Re: Frustrating issue with PGXS
Previous:From: Tom LaneDate: 2007-06-25 18:03:06
Subject: Re: Frustrating issue with PGXS

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group