You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Steve Hay <st...@uk.radan.com> on 2003/09/11 18:28:38 UTC

[PATCH mp2] Change order of libraries in MODPERL_LIB macro

Hi,

I've been having trouble building (the latest CVS) mp2 with perl 5.8.1 
(@21148) -- see this thread on p5p if you want the gory details:

    
http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2003-09/msg00701.html

The answer seems to be to ensure that mod_perl.so appears before 
mod_perl.lib in the MODPLER_LIB macro in 
src/modules/perl/Makefile.modperl.  The attached patch to 
lib/Apache/Build.pm (against CVS) achieves this by simply sorting the 
keys of the %libs hash (which are 'dso', 'shared', 'static').

Is this an appropriate way to do it, or too much like a happy coincidence?

- Steve

Re: [PATCH mp2] Change order of libraries in MODPERL_LIB macro

Posted by Stas Bekman <st...@stason.org>.
Steve Hay wrote:

> Yep - I agree.  Your second patch (below) works fine for me.

Thanks Steve, committed

>> Index: lib/Apache/Build.pm
>> ===================================================================
>> RCS file: /home/cvs/modperl-2.0/lib/Apache/Build.pm,v
>> retrieving revision 1.145
>> diff -u -r1.145 Build.pm
>> --- lib/Apache/Build.pm 6 Sep 2003 01:10:18 -0000       1.145
>> +++ lib/Apache/Build.pm 12 Sep 2003 17:00:07 -0000
>> @@ -1280,7 +1280,11 @@
>>
>>      my @libs;
>>      for my $type (map { uc } keys %libs) {
>> -        push @libs, $self->{"MODPERL_LIB_$type"} if 
>> $self->{"MP_USE_$type"};
>> +        next unless $self->{"MP_USE_$type"};
>> +        # on win32 mod_perl.lib must come after mod_perl.so
>> +        $type eq 'STATIC'
>> +            ? push    @libs, $self->{"MODPERL_LIB_$type"}
>> +            : unshift @libs, $self->{"MODPERL_LIB_$type"};
>>      }
>>
>>      print $fh $self->canon_make_attr('lib', "@libs");
> 
> 
> 


-- 


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [PATCH mp2] Change order of libraries in MODPERL_LIB macro

Posted by Steve Hay <st...@uk.radan.com>.
Stas Bekman wrote:

> Steve Hay wrote:
>
>> Hi,
>>
>> I've been having trouble building (the latest CVS) mp2 with perl 
>> 5.8.1 (@21148) -- see this thread on p5p if you want the gory details:
>>
>>    
>> http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2003-09/msg00701.html 
>>
>>
>> The answer seems to be to ensure that mod_perl.so appears before 
>> mod_perl.lib in the MODPLER_LIB macro in 
>> src/modules/perl/Makefile.modperl.
>
>
>
> or did you want to make sure that mod_perl.lib would be the very last 
> one?
> most likely this is the case since now we have: $libs{shared} = 
> $libs{dso}; 

Yep - I agree.  Your second patch (below) works fine for me.

- Steve

>
>
> Index: lib/Apache/Build.pm
> ===================================================================
> RCS file: /home/cvs/modperl-2.0/lib/Apache/Build.pm,v
> retrieving revision 1.145
> diff -u -r1.145 Build.pm
> --- lib/Apache/Build.pm 6 Sep 2003 01:10:18 -0000       1.145
> +++ lib/Apache/Build.pm 12 Sep 2003 17:00:07 -0000
> @@ -1280,7 +1280,11 @@
>
>      my @libs;
>      for my $type (map { uc } keys %libs) {
> -        push @libs, $self->{"MODPERL_LIB_$type"} if 
> $self->{"MP_USE_$type"};
> +        next unless $self->{"MP_USE_$type"};
> +        # on win32 mod_perl.lib must come after mod_perl.so
> +        $type eq 'STATIC'
> +            ? push    @libs, $self->{"MODPERL_LIB_$type"}
> +            : unshift @libs, $self->{"MODPERL_LIB_$type"};
>      }
>
>      print $fh $self->canon_make_attr('lib', "@libs");




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [PATCH mp2] Change order of libraries in MODPERL_LIB macro

Posted by Stas Bekman <st...@stason.org>.
Steve Hay wrote:
> Hi,
> 
> I've been having trouble building (the latest CVS) mp2 with perl 5.8.1 
> (@21148) -- see this thread on p5p if you want the gory details:
> 
>    
> http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2003-09/msg00701.html 
> 
> 
> The answer seems to be to ensure that mod_perl.so appears before 
> mod_perl.lib in the MODPLER_LIB macro in 
> src/modules/perl/Makefile.modperl.  The attached patch to 
> lib/Apache/Build.pm (against CVS) achieves this by simply sorting the 
> keys of the %libs hash (which are 'dso', 'shared', 'static').
> 
> Is this an appropriate way to do it, or too much like a happy coincidence?

Thanks Steve. I think it's better not to rely on any happy coincidences. If 
you need to make sure that mod_perl.so is listed first we need to explictly do 
that, so that if in the future something changes this happy coincidence 
doesn't vanish without a warning.

A possible way to code it:

Index: lib/Apache/Build.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/lib/Apache/Build.pm,v
retrieving revision 1.145
diff -u -r1.145 Build.pm
--- lib/Apache/Build.pm 6 Sep 2003 01:10:18 -0000       1.145
+++ lib/Apache/Build.pm 12 Sep 2003 16:56:57 -0000
@@ -1280,7 +1280,11 @@

      my @libs;
      for my $type (map { uc } keys %libs) {
-        push @libs, $self->{"MODPERL_LIB_$type"} if $self->{"MP_USE_$type"};
+        next unless $self->{"MP_USE_$type"};
+        # on win32 mod_perl.lib must come after mod_perl.so
+        $type eq 'DSO'
+            ? unshift @libs, $self->{"MODPERL_LIB_$type"}
+            ? push    @libs, $self->{"MODPERL_LIB_$type"};
      }

      print $fh $self->canon_make_attr('lib', "@libs");




or did you want to make sure that mod_perl.lib would be the very last one?
most likely this is the case since now we have: $libs{shared} = $libs{dso};

Index: lib/Apache/Build.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/lib/Apache/Build.pm,v
retrieving revision 1.145
diff -u -r1.145 Build.pm
--- lib/Apache/Build.pm 6 Sep 2003 01:10:18 -0000       1.145
+++ lib/Apache/Build.pm 12 Sep 2003 17:00:07 -0000
@@ -1280,7 +1280,11 @@

      my @libs;
      for my $type (map { uc } keys %libs) {
-        push @libs, $self->{"MODPERL_LIB_$type"} if $self->{"MP_USE_$type"};
+        next unless $self->{"MP_USE_$type"};
+        # on win32 mod_perl.lib must come after mod_perl.so
+        $type eq 'STATIC'
+            ? push    @libs, $self->{"MODPERL_LIB_$type"}
+            : unshift @libs, $self->{"MODPERL_LIB_$type"};
      }

      print $fh $self->canon_make_attr('lib', "@libs");

> ------------------------------------------------------------------------
> 
> --- Build.pm.orig	2003-09-06 02:10:18.000000000 +0100
> +++ Build.pm	2003-09-11 16:42:22.000000000 +0100
> @@ -1279,7 +1279,9 @@
>      }
>  
>      my @libs;
> -    for my $type (map { uc } keys %libs) {
> +    # NOTE: The keys are sorted to make sure the DSO/SHARED lib comes out before
> +    # the STATIC lib. Happily, a straightforward sort() does this for us!
> +    for my $type (map { uc } sort keys %libs) {
>          push @libs, $self->{"MODPERL_LIB_$type"} if $self->{"MP_USE_$type"};
>      }



__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org