diotalevi has asked for the wisdom of the Perl Monks concerning the following question:

When run `make test` with perl 5.005_03 with a Makefile.PL generated makefile I find that perl can't load the B module. When I run the same test manually (perl -Mblib t/03b.t) it loads and works correctly. The Makefile.PL was generated by perl 5.8.2 but is otherwise unremarkable. Here is the Makefile.PL, the error and t/03b.t. The test code was the minimal case and not my actual tests (see t/01basic.t and t/02self.t for the actual (yet still failing tests)).

From super search I tried running `make test` as `LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/perl5.005_3/lib/perl5/5.00503/i586-linux/auto/B make test`. On attempting `LD_PRELOAD=$LD_PRELOAD:~/perl5.005_3/lib/perl5/5.00503/i586-linux/auto/B/B.so make test` I received the error make: relocation error: /home/josh/perl5.005_3/lib/perl5/5.00503/i586-linux/auto/B/B.so: undefined symbol: PL_main_root. I talked to theorbtwo in the chatterbox and he suggested I make sure the right binary is being run. It is. When I examine %ENV it correctly reflects my environment (it shows LD_LIBRARY when I set it and doesn't when I don't). There are no LD_anything values in my environment.

What should I do next? My perl install is fresh and B loads normally when Test::Harness isn't involved. I did install List::Util using CPAN.pm prior to running these tests.

The failing test code:

#BEGIN { warn "TEST: \$^X: \"$^X\" \$0: \"$0\" \$]: \"$]\" \@INC: \"@I +NC\"\n"; # for ( sort keys %ENV ) { # warn "ENV $_=$ENV{$_}\n"; #} } use Test; BEGIN { plan tests => 1 }; use B; ok(1);

The error from `make test`.

PERL_DL_NONLAZY=1 /home/josh/perl5.005_3/bin/perl -Iblib/arch -Iblib/l +ib -I/home/josh/perl5.005_3/lib/perl5/5.00503/i586-linux -I/home/josh +/perl5.005_3/lib/perl5/5.00503 -e 'use Test::Harness qw(&runtests $ve +rbose); $verbose=0; runtests @ARGV;' t/*.t t/03b...............Can't load '/home/josh/perl5.005_3/lib/perl5/5.005 +03/i586-linux/auto/B/B.so' for module B: /home/josh/perl5.005_3/lib/p +erl5/5.00503/i586-linux/auto/B/B.so: undefined symbol: Perl_byterun a +t /home/josh/perl5.005_3/lib/perl5/5.00503/i586-linux/DynaLoader.pm l +ine 169. at t/03b.t line 3 BEGIN failed--compilation aborted at t/03b.t line 3. dubious Test returned status 2 (wstat 512, 0x200) DIED. FAILED test 1 Failed 1/1 tests, 0.00% okay Failed Test Status Wstat Total Fail Failed List of failed ---------------------------------------------------------------------- +--------- t/03b.t 2 512 1 1 100.00% 1 Failed 1/1 test scripts, 0.00% okay. 1/1 subtests failed, 0.00% okay. make: *** [test_dynamic] Error 2

The Makefile.PL

use ExtUtils::MakeMaker; WriteMakefile( 'NAME' => 'B::Source', 'VERSION_FROM' => 'lib/B/Source.pm', # finds $VERSION 'PREREQ_PM' => { List::Util => 0, B => 0 }, ($] >= 5.005 ? (ABSTRACT_FROM => 'lib/B/Source.pm', AUTHOR => 'A. U. Thor <a.u.thor@a.galaxy.far.far.away>') : +()), );

Replies are listed 'Best First'.
Re: Test::Harness from 5.005_03 prevents Dynaloader from finding B.so
by Anonymous Monk on Dec 15, 2003 at 21:00 UTC
    The oracle speaks:
    1
    # There seems to be a problem with an undeclared `Perl_byterun'; # the problem disappears if we do `lazy dynaloading': BEGIN { delete $ENV{PERL_DL_NONLAZY}; }
    2
      Exactly so.