Libtool and Support for Shared Libraries (3)

Greg Banks gnb at fastmail.fm
Wed Jun 6 01:13:09 EDT 2012



On Tue, Jun 5, 2012, at 12:49 PM, Дилян Палаузов wrote:
> Hello,
> 
> now libcyrus and libcyrus_min are compiled once as shared libraries, 
> once under perl/ as non-static convenience libraries,
>    perl/imap/IMAP.so and perl/sieve/managesieve/managesieve.so link 
> statically with the non-static convenience libraries,
>    so that IMAP.so and managesieve.so do need neither libcyrus and 
> libcyrus_min at run time nor the RPATH with those libraries at tun time.
> 
> I hope this is the end with the shared libraries, before they can be
> merged.
> 

Sigh...this still doesn't work.

I built your latest dev/libtool branch, and got these errors during the
config step

config.status: executing perl/annotator/Makefile commands
Writing Makefile for Cyrus::Annotator::Daemon
config.status: executing perl/imap/Makefile commands
Unrecognized argument in LIBS ignored: '../../perl/.libs/libcyrus.a'  
<---
Unrecognized argument in LIBS ignored: '../../perl/.libs/libcyrus_min.a'
  <---
Writing Makefile for Cyrus::IMAP
config.status: executing perl/sieve/managesieve/Makefile commands
Unrecognized argument in LIBS ignored: '../../../perl/.libs/libcyrus.a' 
 <---
Unrecognized argument in LIBS ignored:
'../../../perl/.libs/libcyrus_min.a'   <---
Writing Makefile for Cyrus::SIEVE::managesieve

Make then went on to build, link, and install an IMAP.so and a
managesieve.so.  However the link step was

rm -f blib/arch/auto/Cyrus/IMAP/IMAP.so
cc  -shared -O2 -g -L/usr/local/lib -fstack-protector IMAP.o  -o
blib/arch/auto/Cyrus/IMAP/IMAP.so
           -ldb-4.8 -lsasl2 -lssl -lcrypto -luuid -lz   \

note the complete lack of libcyrus.a.  So of course the resulting .so's
are missing all the symbols they need from libcyrus:

gnb at gnb-desktop 2818 nm
usr/cyrus/lib/perl/5.10.1/auto/Cyrus/IMAP/IMAP.so 
...
                 U imapurl_fromURL
                 U imapurl_toURL
                 U imclient_addcallback
                 U imclient_authenticate
                 U imclient_clearflags
                 U imclient_close
                 U imclient_connect
                 U imclient_getselectinfo
                 U imclient_processoneevent
                 U imclient_send
                 U imclient_servername
                 U imclient_setflags
                 U imclient_starttls
...

gnb at gnb-desktop 2820 nm
usr/cyrus/lib/perl/5.10.1/auto/Cyrus/SIEVE/managesieve/managesieve.so
...
                 U prot_flush
                 U prot_free
                 U prot_getc
                 U prot_new
                 U prot_printf
                 U prot_setsasl
                 U prot_ungetc
                 U prot_write
...
                 U ucase
...
                 U xmalloc
                 U xstrdup
                 U xstrdupnull

This builds but will fail at Perl module load time.

I tried using this syntax instead

    'LIBS'      => [ "-L at top_builddir@/perl/.libs -lcyrus -lcyrus_min
    ...

which changes the warning at configure time to

config.status: executing perl/annotator/Makefile commands
Checking if your kit is complete...
Looks good
Writing Makefile for Cyrus::Annotator::Daemon
config.status: executing perl/imap/Makefile commands
Checking if your kit is complete...
Looks good
Note (probably harmless): No library found for -lcyrus
Note (probably harmless): No library found for -lcyrus_min
Writing Makefile for Cyrus::IMAP
config.status: executing perl/sieve/managesieve/Makefile commands
Checking if your kit is complete...
Looks good
Note (probably harmless): No library found for -lcyrus
Note (probably harmless): No library found for -lcyrus_min

but the same end effect.

After some experimentation I found that using the LDFROM variable does
the trick, like this

    'LDFROM'   => "\$(OBJECT) @top_builddir@/perl/.libs/libcyrus.a
    @top_builddir@/perl/.libs/libcyrus_min.a"

and all is well.

I've pushed this fix to the dev/libtool branch.  If it works on your
environment, I see no further obstacles to merging.

-- 
Greg.


More information about the Cyrus-devel mailing list