Thread: psycopg2 doesn't use LDFLAGS from pg_config

psycopg2 doesn't use LDFLAGS from pg_config

From
Audrius Kažukauskas
Date:
Hi,

I'd like to ask for a reason why psycopg2 doesn't use LDFLAGS from
pg_config?  Recently I upgraded to PostgreSQL 9.3.0 on a Slackware
system.  The build script's author decided to move Pg libraries to a
non-standard place (/usr/lib/postgresql/$VERSION/lib), so that multiple
versions of Pg could be installed.  Now, psycopg2 builds correctly after
this change, but it fails to find libpq.so at import time:

  ImportError: libpq.so.5: cannot open shared object file: No such file
  or directory

The fix is to build psycopg2 with LDFLAGS="$(pg_config --ldflags)".

Are there any reasons for not using --ldflags value in setup.py?  If no,
would it be hard to add?

--
Audrius Kažukauskas
http://neutrino.lt/

Attachment

Re: psycopg2 doesn't use LDFLAGS from pg_config

From
Peter Eisentraut
Date:
On 9/30/13 1:56 PM, Audrius Kažukauskas wrote:
> Are there any reasons for not using --ldflags value in setup.py?

pg_config --ldflags is not intended for this purpose.

The operating system really should not put libraries into places where
they cannot be found by default.