Thread: Re: [PATCHES] Fix linking of OpenLDAP libraries

Re: [PATCHES] Fix linking of OpenLDAP libraries

From
"Albe Laurenz"
Date:
Tom Lane wrote:
>> Here is a new patch that replaces the previous one; it adds two
>> macros LDAP_LIBS_FE and LDAP_LIBS_BE for frontend and backend,
>> respectively.
>
>> I did not only add them to the Makefile for interfaces/libpq,
>> but also everywhere something is linked against libpq in case
>> somebody links static.
>
> Applied, but without that last part.  It builds OK for me on Darwin,
> which is moderately picky about that sort of thing, but someone should
> try AIX.

It builds fine on AIX 5.3 as long as you tell it to link with
libpq.so. Static builds against libpq.a will fail.

Should -lldap or -lldap_r be added to pg_config --libs?
If yes, which of them?

Yours,
Laurenz Albe

Re: [PATCHES] Fix linking of OpenLDAP libraries

From
Martijn van Oosterhout
Date:
On Mon, Sep 11, 2006 at 12:13:29PM +0200, Albe Laurenz wrote:
> > Applied, but without that last part.  It builds OK for me on Darwin,
> > which is moderately picky about that sort of thing, but someone should
> > try AIX.
>
> It builds fine on AIX 5.3 as long as you tell it to link with
> libpq.so. Static builds against libpq.a will fail.
>
> Should -lldap or -lldap_r be added to pg_config --libs?
> If yes, which of them?

Static links are going to require it on every platform, not just AIX.
The question do we want to ask is how easy do we want to make static
linking, because the same treatment will have to apply to -lssl,
-lcrypto, -lkrb5, -lk5crypto and quite possibly others. Do we really
want to go there?

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Re: [PATCHES] Fix linking of OpenLDAP libraries

From
Tom Lane
Date:
"Albe Laurenz" <all@adv.magwien.gv.at> writes:
> Tom Lane wrote:
>> Applied, but without that last part.  It builds OK for me on Darwin,
>> which is moderately picky about that sort of thing, but someone should
>> try AIX.

> It builds fine on AIX 5.3 as long as you tell it to link with
> libpq.so. Static builds against libpq.a will fail.

Hm.  We have been assuming that AIX's problem is that dynamic libraries
don't remember their dependencies properly, but maybe the real issue is
that it prefers static over dynamic libraries?  If so, what we ought to
be doing is adding the prefer-dynamic-libraries switch to the default
LDFLAGS on that platform.

> Should -lldap or -lldap_r be added to pg_config --libs?

You have a mistaken idea of the purpose of pg_config --libs.  It exists
to record what LIBS was at build time, not more, not less.  It is
certainly not intended as a guide to how to link libpq.

            regards, tom lane

Re: [PATCHES] Fix linking of OpenLDAP libraries

From
Tom Lane
Date:
Martijn van Oosterhout <kleptog@svana.org> writes:
> Static links are going to require it on every platform, not just AIX.
> The question do we want to ask is how easy do we want to make static
> linking, because the same treatment will have to apply to -lssl,
> -lcrypto, -lkrb5, -lk5crypto and quite possibly others. Do we really
> want to go there?

Well, we already have a solution for static linking within the PG build
environment, the question is do we wish to export it.  Given the lack of
complaints to date, I think not.  Do we really want to encourage anyone
to statically link libraries that don't belong to their project?  It's
not only the build-time dependency hell, it's the difficulty of
installing library updates.  There's a reason why dynamic link is the
default on all modern platforms.

            regards, tom lane