Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

How to avoid having to remove PERL_DL_NONLAZY=1 from Makefile?

by diotalevi (Canon)
on Mar 31, 2005 at 14:39 UTC ( [id://443835]=perlquestion: print w/replies, xml ) Need Help??

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

While writing Data::Postponed, I discovered that Test::Harness runs everything with the environment variable PERL_DL_NONLAZY=1 and that B will not load on 5.005.04 (and I assume other < 5.6.x) when that is set. It seems like I have to edit my Makefile to remove the references to PERL_DL_NONLAZY. This seems like a terrible hack on my part and I'd like to know what I have to do in order that B may be loaded with this variable set. I'd also like to know what I have to do to avoid editing my Makefile or would like some advice on a better way to edit it than this brute force approach.

My Makefile.PL work around and notes on the "bug".

if ( $] <= 5.6 ) { # I observed that 5.005.04 couldn't load B while PERL_DL_NONLAZY # was turned on. This is the default from Test::Harness. Since # this would normally cause all the tests to fail, I'm manually # editing the Makefile to remove the flag. # PERL_DL_NONLAZY=1 perl -MB -e1 # Can't load # '/home/josh/perl5.005_04/lib/5.00504/i686-linux/auto/B/B.so' for # module B: # /home/josh/perl5.005_04/lib/5.00504/i686-linux/auto/B/B.so: # undefined symbol: Perl_byterun at # /home/josh/perl5.005_04/lib/5.00504/i686-linux/DynaLoader.pm # line 169. # at -e line 0 # BEGIN failed--compilation aborted. open MAKE, "< Makefile" or die "Couldn't open Makefile for reading +: $!"; @make = <MAKE>; close MAKE or die "Couldn't close Makefile after reading: $!"; s/PERL_DL_NONLAZY=1// for @make; open MAKE, "> Makefile" or die "Couldn't open Makefile for writing +: $!"; print MAKE @make or die "Couldn't write to Makefile: $!";; close MAKE or die "Couldn't close Makefile and flush buffer: $!"; }

Replies are listed 'Best First'.
Re: How to avoid having to remove PERL_DL_NONLAZY=1 from Makefile?
by tlm (Prior) on Mar 31, 2005 at 14:52 UTC

    PERL_DL_NONLAZY is set by the methods test_via_harness and test_via_script of ExtUtils::MM_Unix; I'd override those methods; perldoc ExtUtils::MM_Unix has a brief mumble on this.

    Update: typo fixed.

    the lowliest monk

      So how do I override those methods? I tried calling $self->SUPER::test_via_harness( @_ ) and the object I've received isn't ISA ExtUtils anything.

      Writing Makefile for Data::Postponed Can't locate object method "test_via_harness" via package "main" at Ma +kefile.PL line 25. # Looks like your test died before it could output anything. sub MY::test_via_harness { my $self = shift; local $_ = $self->SUPER::test_via_harness( @_ ); s/PERL_DL_NONLAZY=1//g; return $_; }

        Try this:

        use ExtUtils::MakeMaker; package MY; sub test_via_harness { my($self, $perl, $tests) = @_; local $_ = $self->SUPER::test_via_harness($perl, $tests); s/PERL_DL_NONLAZY=1//g; return $_; } sub test_via_script { my($self, $perl, $tests) = @_; local $_ = $self->SUPER::test_via_script($perl, $tests); s/PERL_DL_NONLAZY=1//g; return $_; } package main; # rest of your Makefile.PL

        the lowliest monk

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://443835]
Approved by sweetblood
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (8)
As of 2024-04-19 09:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found