Missing libpq.so.X when postgresql installed on non-standard location

Issue #146 resolved
Edho Arief
created an issue

When postgresql is installed on non-standard location (say, /opt/PostgreSQL/9.2), the compile finished without error but raises error when used:

libpq.so.5: cannot open shared object file: No such file or directory (LoadError)

One of the solution I tested to work is by adding

$LDFLAGS << " -Wl,-R%s" % [ `"#{pgconfig}" --libdir`.chomp ]

to the extconf.rb in addition to -I and -L in pgconfig test.

I'm not sure if it's the correct fix (and whether it works with non gcc/linux system).

Comments (7)

  1. Michael Granger repo owner
    • changed status to open

    Yeah, I'll have to experiment with that to see how portable it is.

    Of course, in the meantime, you can also use one of the various runtime ways of modifying your LD_LIBRARY_PATH too.

  2. Lars Kanis

    What I do for non standard locations is something like this:

    env PATH=/usr/local/pgsql-8.3/bin/:$PATH LD_LIBRARY_PATH=/usr/local/pgsql-8.3/lib gem inst pg (..or whatever command should use the nonstd installation)

    (... with /usr/local/pgsql-* compiled from postgresql.git, but it should work with deb/rpm-installed equally)

  3. Michael Granger repo owner

    Under MacOS X 10.8 with a Homebrew PostgreSQL, this makes the compile fail with:

    ld: unknown option: -R/usr/local/Cellar/postgresql/9.2.2/lib

    but maybe there's a more-portable way to do the same thing?

  4. Log in to comment