Re: [HACKERS] Fix linking of OpenLDAP libraries

Lists: pgsql-hackerspgsql-patches
From: "Albe Laurenz" <all(at)adv(dot)magwien(dot)gv(dot)at>
To: <pgsql-patches(at)postgresql(dot)org>, "Tom Lane *EXTERN*" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] Fix linking of OpenLDAP libraries
Date: 2006-09-07 15:17:40
Message-ID: 52EF20B2E3209443BC37736D00C3C1380A4019FE@EXADV1.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:
>> I have realized that my modifications in configure.in and
>> src/interfaces/libpq/Makefile to link libpq against
>> OpenLDAP are buggy.
>>
>> Here is a proposed patch to fix it.

[...]

>> # The backend doesn't need everything that's in LIBS, however
>> ! LIBS := $(filter-out -lz -lreadline -ledit -ltermcap
>> -lncurses -lcurses -lldap_r $(PTHREAD_LIBS), $(LIBS))
>
> This seems pretty risky. What if PTHREAD_LIBS contains -L switches?
> They'd get removed even if needed for other libraries.
>
> It would probably be safer not to put LDAP into LIBS at all,
> but invent two new macros for configure to set, say LDAP_LIBS
> and LDAP_LIBS_R, and add these to the link lines in the backend
> and libpq respectively.

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.
I don't know if that's necessary, or if static builds are
supported - if not, the changes to those Makefiles should
perhaps not be applied.

Tested on Linux, AIX and Windows.

Yours,
Laurenz Albe

Attachment Content-Type Size
ldaplink2.patch application/octet-stream 10.2 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Albe Laurenz" <all(at)adv(dot)magwien(dot)gv(dot)at>
Cc: pgsql-patches(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] Fix linking of OpenLDAP libraries
Date: 2006-09-08 19:20:00
Message-ID: 22134.1157743200@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

"Albe Laurenz" <all(at)adv(dot)magwien(dot)gv(dot)at> writes:
> 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.

I intensely dislike that part of the patch, but will work on applying
the rest.

If we do need to start mentioning all of libpq's dependencies everywhere
it's linked, I think it's time for a generic solution to that, instead
of hacking each such place over again every time a new dependency pops up.
But at the moment I'm unconvinced that we need to do it.

regards, tom lane


From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Albe Laurenz <all(at)adv(dot)magwien(dot)gv(dot)at>, pgsql-patches(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] Fix linking of OpenLDAP libraries
Date: 2006-09-08 19:47:46
Message-ID: 20060908194746.GM5479@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

On Fri, Sep 08, 2006 at 03:20:00PM -0400, Tom Lane wrote:
> "Albe Laurenz" <all(at)adv(dot)magwien(dot)gv(dot)at> writes:
> > 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.

> If we do need to start mentioning all of libpq's dependencies everywhere
> it's linked, I think it's time for a generic solution to that, instead
> of hacking each such place over again every time a new dependency pops up.

The business of having to include every single dependancy when linking
static is quite irritating. It has almost reached the point where
people are just giving up static linking because it's too much of a
pain.

However, if we do want to support it, the way you do it is by extending
pg_config to do something like:

pg_config --dynamic-lick => returns -lpq
pg_config --static-link => returns -lpq <plus other libs>

That way only people who actually want static linking need be bothered.

Have a ncie day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgresql(dot)org, "Albe Laurenz" <all(at)adv(dot)magwien(dot)gv(dot)at>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] Fix linking of OpenLDAP libraries
Date: 2006-09-09 03:18:07
Message-ID: 26665.1157771887@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

"Albe Laurenz" <all(at)adv(dot)magwien(dot)gv(dot)at> writes:
> 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.

regards, tom lane


From: Christopher Browne <cbbrowne(at)acm(dot)org>
To: pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] Fix linking of OpenLDAP libraries
Date: 2006-09-09 10:25:34
Message-ID: 87u03hxroh.fsf@wolfe.cbbrowne.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

tgl(at)sss(dot)pgh(dot)pa(dot)us (Tom Lane) wrote:
> "Albe Laurenz" <all(at)adv(dot)magwien(dot)gv(dot)at> writes:
>> 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.

I'd like to, but that has to take second place to Slony-I activity
next week; I'll see about putting that on my ToDo list. (After SSL,
readline...)
--
output = ("cbbrowne" "@" "gmail.com")
http://linuxdatabases.info/info/emacs.html
Send messages calling for fonts not available to the recipient(s).
This can (in the case of Zmail) totally disable the user's machine and
mail system for up to a whole day in some circumstances.
-- from the Symbolics Guidelines for Sending Mail