Libtool and Support for Shared Libraries (2)

Dilyan Palauzov Dilyan.Palauzov at aegee.org
Mon May 28 15:33:08 EDT 2012


Hello,



----- Message from Greg Banks <gnb at fastmail.fm> ---------
    Date: Fri, 25 May 2012 13:17:05 +1000
    From: Greg Banks <gnb at fastmail.fm>
Subject: Re: Libtool and Support for Shared Libraries (2)
      To: Дилян Палаузов <dilyan.palauzov at aegee.org>,  
cyrus-devel at lists.andrew.cmu.edu


> On Tue, May 22, 2012, at 01:47 PM, Дилян Палаузов wrote:
>> Hello,
>>
>> > commit "Makefile.am: move the defintion of COM_ERR_LIB here"
>> >
>> > I don't think there's any point having COM_ERR_LIB and COM_ERR_LIBS,
>> > just one should do, but we can tweak that later.
>>
>> libimap and libsieve have to depend on libcom_err.a whenever the bundled
>> libcom_err.a is used, so that the bundled libcom_err.a is build before
>> libimap and libsieve are linked.
>
> Sure, I see why you did it.
>
>>  Any ideas how to achieve this, that
>> are different from what I did?
>
> Use  a single variable, which is set by in the configure script and
> appended to in one branch of the conditional (the other branch being
> empty).

I did now so.

>
>> > commit "convert lib/libcyrus_min.a to libtool archive"
>> > commit "convert lib/libcyrus.a to libtool archive"
>> >
>> > Looks good, except that the Perl build is broken.  I get this:
>> >
>> > make[2]: Entering directory `/home/gnb/software/cyrus/imapd/perl/imap'
>> > make[2]: *** No rule to make target `-lcyrus', needed by `subdirs'.
>> > Stop.
>> > make[2]: *** Waiting for unfinished jobs....info
>> >
>> > I've been wrestling with this most of the day but libtool + MakeMaker =
>> > one enormous headache :(
>>
>> I moved "-lcyrus -lcyrus_min" in Makefile.PL.in from MYEXTLIB to
>> OTHERLDFLAGS, so that the target subdirs does not depend anymore on
>> "-lcyrus -lcyrus_min".  Please try with the uploaded fix.  (I can
>> understand why you got this error, but I do not get it.)
>
> Ok, that builds and installs now :)  One more problem: the installed
> IMAP.so and managesieve.so depend on the Cyrus libraries but do not have
> a runtime library path which will find them in the case where --prefix
> != /usr.  The libtool-linked executables installed into bindir do have
> that.
>
> gnb at gnb-desktop 2010 readelf -d ../inst/usr/cyrus/bin/imapd
>
> Dynamic section at offset 0x36be0 contains 35 entries:
>   Tag        Type                         Name/Value
>  0x0000000000000001 (NEEDED)             Shared library:
>  [libcyrus_imap.so.0]  <---
>  0x0000000000000001 (NEEDED)             Shared library: [libcyrus.so.0]
>  0x0000000000000001 (NEEDED)             Shared library:
>  [libcyrus_min.so.0]
>  0x0000000000000001 (NEEDED)             Shared library: [libwrap.so.0]
>  0x0000000000000001 (NEEDED)             Shared library: [libnsl.so.1]
>  0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
>  0x0000000000000001 (NEEDED)             Shared library: [libdb-4.8.so]
>  0x0000000000000001 (NEEDED)             Shared library: [libpcre.so.3]
>  0x0000000000000001 (NEEDED)             Shared library:
>  [libpcreposix.so.3]
>  0x0000000000000001 (NEEDED)             Shared library: [libz.so.1]
>  0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
>  0x0000000000000001 (NEEDED)             Shared library:
>  [libcom_err.so.2]
>  0x0000000000000001 (NEEDED)             Shared library: [libsasl2.so.2]
>  0x0000000000000001 (NEEDED)             Shared library:
>  [libssl.so.0.9.8]
>  0x0000000000000001 (NEEDED)             Shared library:
>  [libcrypto.so.0.9.8]
>  0x000000000000000f (RPATH)              Library rpath: [/usr/cyrus/lib]
>    <----
>  0x000000000000000c (INIT)               0x406d30
>  0x000000000000000d (FINI)               0x42fc68
>
> but not
>
> gnb at gnb-desktop 2009 readelf -d
> ../inst/./usr/cyrus/lib/perl/5.10.1/auto/Cyrus/IMAP/IMAP.so
>
> Dynamic section at offset 0x8da0 contains 28 entries:
>   Tag        Type                         Name/Value
>  0x0000000000000001 (NEEDED)             Shared library: [libcyrus.so.0]
>  0x0000000000000001 (NEEDED)             Shared library:
>  [libcyrus_min.so.0]
>  0x0000000000000001 (NEEDED)             Shared library: [libdb-4.8.so]
>  0x0000000000000001 (NEEDED)             Shared library: [libsasl2.so.2]
>  0x0000000000000001 (NEEDED)             Shared library:
>  [libssl.so.0.9.8]
>  0x0000000000000001 (NEEDED)             Shared library:
>  [libcrypto.so.0.9.8]
>  0x0000000000000001 (NEEDED)             Shared library: [libuuid.so.1]
>  0x0000000000000001 (NEEDED)             Shared library: [libz.so.1]
>  0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
>  0x000000000000000c (INIT)               0x1b88
>  0x000000000000000d (FINI)               0x8098

On my system managesieve.so and IMAP.so contain Library rpath.

>
>> > Also, is there a way of getting rid of these warnings:
>> >
>> >    /bin/bash ./libtool   --mode=install /usr/bin/install -c imtest/imtest
>> >    '/home/gnb/software/cyrus/inst/usr/cyrus/bin'
>> > libtool: install: warning: `lib/libcyrus.la' has not been installed in
>> > `/usr/cyrus/lib'
>> > libtool: install: warning: `lib/libcyrus_min.la' has not been installed
>> > in `/usr/cyrus/lib'
>> >
>> > because there's quite a lot of them and they're confusing the script I
>> > use to find compile time warnings.
>>
>> Pass --prefix to ./configure .
>
> I am.
>
> + ./configure --prefix=/usr/cyrus --with-cyrus-prefix=/usr/cyrus
> --enable-maintainer-mode --enable-idled --enable-nntp --enable-murder
> --enable-replication --enable-unit-tests --without-snmp

I mean, pass --prefix to ./configure in such a way, that DESTDIR gets  
useless (./configure --prefix=/home/gnb/software/cyrus/inst/usr/cyrus) .

>
>> The resulting binaries have to be aware
>> where the shared libraries are (when the shared libraries are not on
>> standard locations) and probably using make install DESTDIR= with
>> libtool is either wrong or implemented/handled wrong in Automake/libtool.
>
> Well, that sucks.

Why do not you use ./configure --prefix=$(DESTDIR), so that make  
install DESTDIR=somewhere is not necessary?  To my understanding  
installing in DESTDIR is used to create packages, not to run programs  
from there, so under this condition programmes and libraries installed  
in DESTDIR do not have to create (relative) paths to other libraries  
in DESTDIR, but to the place, where the libraries are supposed to be  
after installation (without DESTDIR).

Greetings
   Dilian



More information about the Cyrus-devel mailing list