Comment 2 for bug 90812

Revision history for this message
Roberto Maurizzi (r-maurizzi) wrote :

In slapd back_perl backend if I "use" a module I get "unresolved symbol" errors.

I'm using slapd-2.2.26-5ubuntu3.1 on Edgy.

Everything works if I don't use modules. For example if in my module i "use DBI", running "slapd -d 0" I get:

slapd: symbol lookup error: /usr/lib/perl5/auto/DBI/DBI.so: undefined symbol: Perl_Tstack_sp_ptr

if I instead "use POSIX" as in the SampleLDAP.pm module given in the openldap sources, i get:

Error Can't load '/usr/lib/perl/5.8/auto/POSIX/POSIX.so' for module POSIX: /usr/lib/perl/5.8/auto/POSIX/POSIX.so: undefined symbol: PL_sig_name at /usr/lib/perl/5.8/XSLoader.pm line 70.
 at /usr/lib/perl/5.8/POSIX.pm line 26

Searching for documentation, I've found this article http://www.samag.com/documents/s=9370/sam0505g/0505g.htm that stresses the importance that both openldap and perl are compiled with the same compiler version and options.

Am I missing something obvious, or there's been a misalignment in the releases of slapd and perl packages?

To reproduce the error:
define a perl backend "db" adding the following lines to the end of /etc/ldap/slapd.conf:

module_load back_perl
database perl
suffix "dc=perl,dc=example,dc=com"
perlModulePath /etc/perl/SampleLDAP.pm
perlModule SampleLDAP

Create a file with the following lines in /etc/perl/SampleLDAP.pm

package SampleLDAP;
use POSIX;
sub new
{
        my $class = shift;
        my $this = {};
        bless $this, $class;
        print STDERR "Posix Var " . BUFSIZ . " and " . FILENAME_MAX . "\n";
        return $this;
}
sub init
{
        print STDERR "Here in init\n";
        return 0;
}
1;

Now you should start slapd:

sudo slapd

You'll get:

Error Can't load '/usr/lib/perl/5.8/auto/POSIX/POSIX.so' for module POSIX: /usr/lib/perl/5.8/auto/POSIX/POSIX.so: undefined symbol: PL_sig_name at /usr/lib/perl/5.8/XSLoader.pm line 70.
  at /usr/lib/perl/5.8/POSIX.pm line 26
 Compilation failed in require at /etc/perl/SampleLDAP.pm line 2.
 BEGIN failed--compilation aborted at /etc/perl/SampleLDAP.pm line 2.
 Compilation failed in require at (eval 2) line 1.
 BEGIN failed--compilation aborted at (eval 2) line 1.

Using /etc/init.d/slapd start does NOT print the message because the output of start-stop-daemon is put in a $reason variable that's not printed, logged or evaluated (script bug?) but if you add echo $reason to the script you get the same error.

Changing the "use"d module changes the situation only slightly, for example substituting "use POSIX" with "use DBI" you get:

slapd: symbol lookup error: /usr/lib/perl5/auto/DBI/DBI.so: undefined symbol: Perl_Tstack_sp_ptr

I'd more than willing to perform more tests if you can suggest some.

Ciao,
    Roberto Maurizzi