Обсуждение: Re: [HACKERS] Fix linking of OpenLDAP libraries
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
"Albe Laurenz" <all@adv.magwien.gv.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
On Fri, Sep 08, 2006 at 03:20:00PM -0400, Tom Lane wrote: > "Albe Laurenz" <all@adv.magwien.gv.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@svana.org> http://svana.org/kleptog/ > From each according to his ability. To each according to his ability to litigate.
Вложения
"Albe Laurenz" <all@adv.magwien.gv.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
tgl@sss.pgh.pa.us (Tom Lane) wrote: > "Albe Laurenz" <all@adv.magwien.gv.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