Perl Module::Build test run cannot find dynamically loaded module

151 views Asked by At

I am building a Perl module using Module::Build. The Build.PL file is below:

use strict ;
use warnings ;

use Module::Build;
my $build = Module::Build->new
(
    module_name => 'Company::LDAP::SyncAttr',
    license     => 'perl',
    installdirs  => 'vendor',
    install_path => {
                      'bin'    => '/usr/bin',
                      'script' => '/usr/bin'
                    },
) ;

$build->create_build_script ;

The module itself is here:

# SyncAttr.pm
package Company::LDAP::SyncAttr;
use Authen::Krb5;
1;

I have a test file in t/test.t that looks like this:

# test.t
use Company::LDAP::SyncAttr;

When I run ./Build test I get this error:

t/test.t .. Can't load '/usr/lib/x86_64-linux-gnu/perl5/5.20/auto/Authen/Krb5/Krb5.so' for module Authen::Krb5: /usr/lib/x86_64-linux-gnu/perl5/5.20/auto/Authen/Krb5/Krb5.so: 
undefined symbol: krb5_free_krbhst at /usr/lib/x86_64-linux-gnu/perl/5.20/DynaLoader.pm line 187.
 at /tmp/gg/blib/lib/Company/LDAP/SyncAttr.pm line 3.
Compilation failed in require at /tmp/gg/blib/lib/Company/LDAP/SyncAttr.pm line 3.

If I run the test.t file directly, I get no such error:

perl -Ilib/ t/test.t

What do I have to do to get ./Build test to not error out?

UPDATE: The problem lies with Module::Build. There is a routine do_tests in the Module::Build::Base module that forces the environment variable PERL_DL_NONLAZY to 1. If I change that line to set PERL_DL_NONLAZY to 0, then the tests all pass. The module Module::Build::Base does not provide an option to not set PERL_DL_NONLAZY, so I have submitted a bug report asking them add such an option. In the meantime, I will just have to skip running ./Build test.

0

There are 0 answers