Skip to content

Install script does not use pg_config's LIBDIR for runtime linking #1356

Open
@gtzampanakis

Description

@gtzampanakis

The install script does not pass pg_config's LDFLAGS to the linker. In my case pg_config outputs the following LDFLAGS:

LDFLAGS = -L/usr/lib64/llvm5.0/lib -L/usr/lib64 -Wl,--as-needed -Wl,-rpath,'/usr/pgsql-12/lib',--enable-new-dtags

But the psycopg2 install script ignores everything that doesn't start with "-L", therefore it ignores the rpath configuration. Then, when psycopg2 is loaded by a uwsgi executable that has its own rpath the process exits with a "missing name" error because the fact that the executable has its own rpath prevents it from loading the psycopg2 library even though ldconfig has run and has properly configured the system.

To work around this I do

LDFLAGS='-L/usr/lib64/llvm5.0/lib -L/usr/lib64 -Wl,--as-needed -Wl,-rpath,/usr/pgsql-12/lib,--enable-new-dtags' pip install psycopg2

and then psycopg2 seems to work fine.

Please consider loading pg_config's LDFLAGS and passing them to the linker without user intervention.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions