Обсуждение: Re: [PATCHES] Fix linking of OpenLDAP libraries

Поиск
Список
Период
Сортировка

Re: [PATCHES] Fix linking of OpenLDAP libraries

От
"Albe Laurenz"
Дата:
Tom Lane wrote:
>> In our case, we have libpq.a and libpq.so in the same directory,
>> so unless you link with -brtl you will get a static link
>> (because libpq.a is a static library).
>
> I wonder whether we ought to suppress building (or at least
installing)
> our .a libraries at all on AIX.  Adding -btrl to LDFLAGS would help
> within the context of our own build, but external clients that link
> to libpq without saying that are going to get undesirable results.
>
> I think there's a reasonable argument that by installing a .a file
that
> isn't a shared library, we are violating the platform's conventions.

The natural way in AIX would be:
- Create libpq.so
- Create libpq.a by 'rm -f libpq.a; ar -rc libpq.a libpq.so'
- Install only libpq.a

For a static build on AIX, you have to specify all the libraries and
give the linker -bstatic and -bI:/lib/syscalls.exp

>> Should -brtl be added to src/template/aix?
>
> Sounds that way, but that'll only help for psql and other stuff built
> within our build.  Could you try this against CVS tip:
>
> * add -brtl to LDFLAGS in the template
> * Remove the AIX-specific hack on $(libpq) at lines 349-354 of
>   src/Makefile.global.in
> * see if it configures and builds

I have done that (see the attached patch) and it works fine.
I don't have the native AIX C compiler, so I could only test
it with gcc.

I have taken the liberty to modify the static link line
in Makefile.global.in to contain the LDAP libraries, I hope
that's appropriate.

Yours,
Laurenz Albe

Вложения

AIX shared libraries (was Re: [PATCHES] Fix linking of OpenLDAP libraries)

От
Tom Lane
Дата:
"Albe Laurenz" <all@adv.magwien.gv.at> writes:
> Tom Lane wrote:
>> I think there's a reasonable argument that by installing a .a file that
>> isn't a shared library, we are violating the platform's conventions.

> The natural way in AIX would be:
> - Create libpq.so
> - Create libpq.a by 'rm -f libpq.a; ar -rc libpq.a libpq.so'
> - Install only libpq.a

Hm.  This seems possible with some moderate hacking on Makefile.shlib
(certainly it'd be no more invasive than the existing Windows-specific
platform variants).  However, looking at what's already in
Makefile.shlib for AIX makes me doubt the above claim a bit, because
AFAICS libpq.so is produced from libpq.a on that platform.  Is it
possible that the rules have changed across AIX versions, and that the
code in there now is needful for older versions?

Another issue with installing only .a is that there's no provision
for versioning in .a library names ... what happens to someone who
needs two generations of libpq on his machine?
        regards, tom lane