Re: OS X library path issues for libpq (ver 8.3) - Mailing list pgsql-general

From Dave Page
Subject Re: OS X library path issues for libpq (ver 8.3)
Date
Msg-id 937d27e10809090046v64f7a2c0g264305b6634ed710@mail.gmail.com
Whole thread Raw
In response to OS X library path issues for libpq (ver 8.3)  ("Darren Weber" <darren.weber.lists@gmail.com>)
Responses Re: OS X library path issues for libpq (ver 8.3)  ("Benjamin Reed" <rangerrick@gmail.com>)
Re: OS X library path issues for libpq (ver 8.3)  ("Darren Weber" <darren.weber.lists@gmail.com>)
List pgsql-general
On Tue, Sep 9, 2008 at 2:02 AM, Darren Weber
<darren.weber.lists@gmail.com> wrote:
> I'm new to using PostgreSQL on mac OS X.  I used a binary installer
> for PostgreSQL 8.3 on mac OS X 10.5, which installs into
>
> /Library/PostgreSQL/[version]/....
>
> I'm building a lot of software that links to libpq and most of the
> builds fail or the run-time fails, because it cannot find the
> PostgreSQL libraries by default.  It seems the dynamic link loader
> doesn't search this path by default to locate dynamic libraries, like
> libpq.5.dylib.
>
> Can you fix this issue for the binary installer?

Hmm, it seems this is a side-effect of not rewriting the shared
library paths at installation time. Because the library ID is just the
filename, the linker doesn't write the full path to the binaries you
compile.

We changed from the old behaviour after it became apparent that the
utilities we needed to rewrite the paths are on available on machines
with XCode installed.

I would suggest doing one of the following:

sudo ln -s /Library/PostgreSQL/8.3/lib/libpq.5.dylib /usr/lib/libpq.5.dylib

which will put a symlink to the library in /usr/lib, where the dynamic
loader will find it, or:

export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:/Library/PostgreSQL/8.3/lib"

which will tell the dynamic linker to look in the PG lib directory. A
third possible fix would be to use install_name_tool to rewrite the
shared library path in the executable you've built.

I'll look at a solution for the installer - it'll probably have to be
the symlink unless anyone else has a better idea...

--
Dave Page
EnterpriseDB UK:   http://www.enterprisedb.com

pgsql-general by date:

Previous
From: Tomasz Ostrowski
Date:
Subject: Re: 8.3 on FreeBSD 6.3, sudden performance degradations
Next
From: Magnus Hagander
Date:
Subject: Re: Install Postgres on a SAN volume?