Re: Mac OS X 10.6 - libpq.dylib vs. libpq.a and PQisthreadsafe()

From: David McKeone <david(at)artsman(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Mac OS X 10.6 - libpq.dylib vs. libpq.a and PQisthreadsafe()
Date: 2011-10-17 17:08:04
Message-ID: 58CE7D7C-15FB-4D1C-B9A6-F2410FCB5A20@artsman.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2011-10-17, at 4:23 PM, Tom Lane wrote:
>
> Hm, is there a libpq dylib in /usr/lib? If so, maybe it's capturing the
> reference? "otool -L main" would be informative about which dylib is
> actually getting called, I think. If it's not what you expected, the
> lack of a -L switch in your link command is probably the reason.
>
> regards, tom lane

Here is the output for otool -L for both.

Static libpq.a

main:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11)

Dynamic libpq.5.4.dylib using -lpq

main:
libpq.5.dylib (compatibility version 5.0.0, current version 5.4.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11)

Dynamic libpq.5.4.dylib using the command from the previous email (This one is interesting because /usr/local/pgsql doesn't exist on this machine)

main:
/usr/local/pgsql/lib/libpq.5.dylib (compatibility version 5.0.0, current version 5.4.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11)

I did have a libpq.5.dylib in /usr/lib and it turns out that that was the problem. So it looks like, even though I was specifying the library, it just picked the one at /usr/lib version anyway. (I obviously have much more to learn about how the linker works on OS X)

The solution was to move the Enterprise DB libpq.5.4.dylib into /usr/lib (and create associated symlinks) and it worked correctly after that.

Thanks for pointing me in the right direction.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Viktor Rosenfeld 2011-10-17 18:29:24 Use true and false when bulk-exporting boolean data
Previous Message Lincoln Yeoh 2011-10-17 17:03:54 Re: 9.1 got really fast ;)