views:

122

answers:

1

I maintain a software stack consisting of Perl and Cyrus IMAP among other things.

Perl seems to be working fine and Cyrus cyradm (a perl script) works fine too. However, sieveshell will not execute and reason for asking for help here.

When I run sieveshell, I get the follow output:

Can't load '/usr/local/pozix/perl-5.10.0/lib/site_perl/5.10.0/i686-linux-thread-multi/auto/Cyrus/SIEVE/managesieve/managesieve.so' for module Cyrus::SIEVE::managesieve: /usr/local/pozix/perl-5.10.0/lib/site_perl/5.10.0/i686-linux-thread-multi/auto/Cyrus/SIEVE/managesieve/managesieve.so: undefined symbol: PQfinish at /usr/local/pozix/perl-5.10.0/lib/5.10.0/i686-linux-thread-multi/DynaLoader.pm line 203. at ./sieveshell line 45 Compilation failed in require at ./sieveshell line 45. BEGIN failed--compilation aborted at ./sieveshell line 45.

PQfinish is part of the PostgreSQL libraries. If I run ldd on managesieve.so, the PGSQL libs are not linked in however, there are no missing libraries either. If I run ldd on libsasl2 library listed, it looks OK too and it does use PGSQL but it is apparently not part of the library linked to managesieve.so. Moreover, libsasl2 is working fine when used by other software.

Here is ldd managesieve.so

linux-gate.so.1 =>  (0xffffe000)
libdb-4.4.so => /lib/libdb-4.4.so (0xb7f8a000)
libsasl2.so.2 => /usr/local/pozix/cyrus-sasl/lib/libsasl2.so.2 (0xb7f74000)
libssl.so.0 => /usr/lib/libssl.so.0 (0xb7f33000)
libcrypto.so.0 => /usr/lib/libcrypto.so.0 (0xb7df6000)
libc.so.6 => /lib/libc.so.6 (0xb7caa000)
libpthread.so.0 => /lib/libpthread.so.0 (0xb7c92000)
libdl.so.2 => /lib/libdl.so.2 (0xb7c8e000)
libresolv.so.2 => /lib/libresolv.so.2 (0xb7c7b000)
/lib/ld-linux.so.2 (0xb80aa000)

ldd usr/local/pozix/cyrus-sasl/lib/libsasl2.so.2

linux-gate.so.1 =>  (0xffffe000)
libdl.so.2 => /lib/libdl.so.2 (0xb7f0a000)
libresolv.so.2 => /lib/libresolv.so.2 (0xb7ef7000)
libc.so.6 => /lib/libc.so.6 (0xb7dab000)
/lib/ld-linux.so.2 (0xb7f34000)

There are no compilation errors during the building of Cyrus IMAP either. I suspect this could be a path problem but not sure where to look or debug the path output or where to go next on this.

Tried googling for this and got a couple hits but they either had no solution or didn't work for me. I suspect the Perl AUTOLOAD is confused in some way. DBD::Pg appears to be working as well; using version 2.15.1.

Any suggestions on where to go next? Any Perl gurus out there?

SOLVED!

./configure builds the Makefiles in each sub-directory. The managesieve.so library is created with a call from Perl... I.E. Perl Makefile.PL resulting in a Makefile. Andrew's advise helped immensely in tracking this down. In the Makefile there are the following lines:

EXTRALIBS = -ldb-4.4 -L/usr/local/pozix/cyrus-sasl/lib -lsasl2 -lssl -lcrypto 
LDLOADLIBS = -ldb-4.4 -L/usr/local/pozix/cyrus-sasl/lib -lsasl2 -lssl -lcrypto

Which I updated to read:

EXTRALIBS = -ldb-4.4 -L/usr/local/pozix/cyrus-sasl/lib -L/usr/local/pozix/pgsql/lib -lsasl2 -lssl -lcrypto -lpq

LDLOADLIBS = -ldb-4.4 -L/usr/local/pozix/cyrus-sasl/lib -L/usr/local/pozix/pgsql/lib -lsasl2 -lssl -lcrypto -lpq

And this solved it!

A: 

Sounds like you need to re-compile the sieve shared library and include the -lPGSql (or whatever). Is there a configure script that you need to add a '--with-postgres' to? If not, you may have to manually edit the Makefile (or Makefile.PL, or Build.PL).

Andrew Barnett
Eric M
What I can't tell is this: If I were to edit a Makefile, which one? The SASL2 or managesieve ones? I don't see where PQfinish is referenced or where libpq.so is linked in. PQfinish is part of libpq.so as evident from strings libpq.so | grep PQfinish gives:PQfinishPQfinishThanks!
Eric M
Check the Makefile generated by the configure script, and see if the **--with-pgsql** put the correct libraries in not only the **-L** but the **-l** as well. Then make sure your library path includes libpq.so.And instead of **strings libpq.so**, try using **nm** instead (see its man page). You never know with **strings** if you're seeing PQfinish as an imported symbol, instead of an exported one.One other thing to check it to be sure you don't have multiple different versions of libpq.so. You may need to alter the library path to get the right one.
Andrew Barnett
As a test I added the following lines to my Build script: export CPPFLAGS="-I/path_to/pgsql/include" export LDFLAGS="-L/path_to/pgsql/lib"I get same error. Incidentally, during the build I do see -I and -L passed with the correct path to PGSQL's include and lib directories. Build's configure script, as mentioned above, includes: --with-pgsql=$POZIX_ROOT/pgsql Which seems to be working since the path is picked up in -L and -ICyrus IMAP has many make files, I looked at the Makefine in root and in the managesieve dir - no settings for lpgsql
Eric M