Re: OS X library path issues for libpq (ver 8.3)

From: "Dave Page" <dpage(at)pgadmin(dot)org>
To: "Darren Weber" <darren(dot)weber(dot)lists(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: OS X library path issues for libpq (ver 8.3)
Date: 2008-09-09 07:46:57
Message-ID: 937d27e10809090046v64f7a2c0g264305b6634ed710@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Sep 9, 2008 at 2:02 AM, Darren Weber
<darren(dot)weber(dot)lists(at)gmail(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Magnus Hagander 2008-09-09 08:01:44 Re: Install Postgres on a SAN volume?
Previous Message Tomasz Ostrowski 2008-09-09 07:30:23 Re: 8.3 on FreeBSD 6.3, sudden performance degradations