You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Christian Krause <ch...@plauener.de> on 2004/10/13 22:56:43 UTC

problem building modperl 1.99

Hi,

1. Problem Description:

I can't build mod_perl on some machines. The "make test" results in the
following error:

-----------------------------------
/usr/sbin/httpd -d /usr/src/RPM/BUILD/mod_perl-1.99_16/t -f /usr/src/RPM/BUILD/mod_perl-1.99_16/t/conf/httpd.conf -D APACHE2 -D PERL_USEITHREADS
using Apache/2.0.52 (prefork MPM)

waiting 120 seconds for server to start: ..[Tue Oct 12 23:01:56 2004] [info] 26 Apache:: modules loaded
[Tue Oct 12 23:01:56 2004] [info] 7 APR:: modules loaded
[Tue Oct 12 23:01:56 2004] [info] base server + 20 vhosts ready to run tests
...Syntax error on line 2008 of /usr/src/RPM/BUILD/mod_perl-1.99_16/t/conf/httpd.conf:
Can't locate object method "method_is_limited" via package "Apache::CmdParms" at /usr/src/RPM/BUILD/mod_perl-1.99_16/t/response/TestDirective/cmdparms.pm line 50.\n
[  error]
server has died with status 255 (t/logs/error_log wasn't created, start the server in the debug mode)
---------------------------------------

Reason:
- in xs/maps/apache_functions.map is the MODULE=Apache::MethodList (and
  so the method ap_method_is_limited) disabled
- in xs/maps/modperl_functions.map is the MODULE=Apache::CmdParms (and
  so the method ap_method_is_limited) enabled

During building the make files with "perl Makefile.PL" the following command
is called:

/usr/bin/perl Makefile.PL PREFIX=/usr/src/RPM/tmp/mod_perl-root/usr
INSTALLDIRS=vendor MP_APXS=/usr/sbin/apxs MP_APR_CONFIG=/usr/bin/apr-config
'CCFLAGS=-O2 -fomit-frame-pointer -pipe -march=i586 -mtune=athlon -fPIC' This
builds as far as I know "lib/ModPerl/MethodLookup.pm".

Whether this function "ap_method_is_limited" is included in the
"function_map" of lib/ModPerl/FunctionMap.pm (and later in
MethodLookup.pm) depends on the sequence of these 2 files in the
filesystem:

In lib/ModPerl/MapUtil.pm the name of the map files are read into an
array (map_files) with readdir, this does _not_ sort the files. Later
they are parsed with the "parse" method in FunctionMap.pm. If the files
are no in alphabetic sequence, the mapping of method_is_limited will be
"undef" in the hash.

Conclusion: A correct build of mod_perl depends on the order of
the map files in the filesystem. Depending on this is not correct,
because as far as I know there is no default sort order in any
filesystem.


Reproduce:
To reproduct the problem the sequence of the map files must be
explicitly given:

The following patch generates a sequence of map files which will cause
the problem occurs
------------------------
+++ mod_perl-1.99_16/lib/ModPerl/MapUtil.pm     2004-10-12 23:11:08.000000000 +0200
@@ -160,8 +160,9 @@
     my($self) = @_;

     my $map = {};
-
-    for my $file (map_files($self)) {
+    my @f = map_files($self);
+       
+    for my $file (reverse sort @f) {
         open my $fh, $file or die "open $file: $!";
         local $ModPerl::MapUtil::MapFile = $file;
         bless $fh, __PACKAGE__;
--------------------------

The next patch generates a sequence of map files which will let the
package build:
------------------------
+++ mod_perl-1.99_16/lib/ModPerl/MapUtil.pm     2004-10-12 23:11:08.000000000 +0200
@@ -160,8 +160,9 @@
     my($self) = @_;

     my $map = {};
-
-    for my $file (map_files($self)) {
+    my @f = map_files($self);
+       
+    for my $file (sort @f) {
         open my $fh, $file or die "open $file: $!";
         local $ModPerl::MapUtil::MapFile = $file;
         bless $fh, __PACKAGE__;
--------------------------


Best regards,
Christian


*** mod_perl version 1.9916

*** using /usr/src/RPM/BUILD/mod_perl-1.99_16/lib/Apache/BuildConfig.pm

*** Makefile.PL options:
  MP_APR_CONFIG  => /usr/bin/apr-config
  MP_APR_LIB     => aprext
  MP_APXS        => /usr/sbin/apxs
  MP_COMPAT_1X   => 1
  MP_GENERATE_XS => 1
  MP_LIBNAME     => mod_perl
  MP_USE_DSO     => 1
  MP_USE_STATIC  => 1


*** The httpd binary was not found


*** (apr|apu)-config linking info

 -lapr-0 -lrt -lm -lcrypt  -lpthread -ldl
 -laprutil-0 -lldap -llber -ldb-4.2 -lexpat



*** /usr/bin/perl -V
Summary of my perl5 (revision 5 version 8 subversion 5) configuration:
  Platform:
    osname=linux, osvers=2.6.7, archname=i586-linux-thread-multi
    uname='linux  2.6.7 #2 smp mon sep 20 21:35:25 cest 2004 i686 unknown unknown gnulinux '
    config_args='-des -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dusethreads -Duseithreads -Duselargefiles -Dd_semctl_semun -Duseshrplib -Uversiononly -Doptimize=-O2 -fomit-frame-pointer -pipe -march=i586 -mtune=athlon -Dmyhostname=localhost -Dperladmin=root@localhost -Darchname=i586-linux -Dprefix=/usr -Dvendorprefix=/usr -Dsiteprefix=/usr/local -Dinstallprefix=/usr -Darchlib=/usr/lib/perl5/5.8.5 -Dprivlib=/usr/share/perl5/5.8.5 -Dsitearch=/usr/local/lib/perl5/site_perl/5.8.5 -Dsitelib=/usr/local/share/perl5/site_perl/5.8.5 -Dvendorarch=/usr/lib/perl5/vendor_perl/5.8.5 -Dvendorlib=/usr/share/perl5/vendor_perl/5.8.5 -Dinc_version_list=5.8.3 5.8.2 5.8.1 5.8.0 -Dcc=gcc'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2 -fomit-frame-pointer -pipe -march=i586 -mtune=athlon',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -fno-strict-aliasing -pipe -I/usr/local/include'
    ccversion='', gccversion='3.4.2', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
    libc=/lib/libc-2.3.3.so, so=so, useshrplib=true, libperl=libperl.so
    gnulibc_version='2.3.3'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/usr/lib/perl5/5.8.5/CORE'
    cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl):
  Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL_IMPLICIT_CONTEXT
  Built under linux
  Compiled at Oct 10 2004 04:25:05
  %ENV:
    PERL_LWP_USE_HTTP_10="1"
  @INC:
    /usr/lib/perl5/5.8.5
    /usr/share/perl5/5.8.5
    /usr/local/lib/perl5/site_perl/5.8.5
    /usr/local/lib/perl5/site_perl/5.8.3
    /usr/local/lib/perl5/site_perl/5.8.2
    /usr/local/lib/perl5/site_perl/5.8.1
    /usr/local/lib/perl5/site_perl/5.8.0
    /usr/local/share/perl5/site_perl/5.8.5
    /usr/local/share/perl5/site_perl/5.8.3
    /usr/local/share/perl5/site_perl/5.8.2
    /usr/local/share/perl5/site_perl/5.8.1
    /usr/local/share/perl5/site_perl/5.8.0
    /usr/local/share/perl5/site_perl
    /usr/lib/perl5/vendor_perl/5.8.5
    /usr/lib/perl5/vendor_perl/5.8.3
    /usr/lib/perl5/vendor_perl/5.8.2
    /usr/lib/perl5/vendor_perl/5.8.1
    /usr/lib/perl5/vendor_perl/5.8.0
    /usr/share/perl5/vendor_perl/5.8.5
    /usr/share/perl5/vendor_perl/5.8.3
    /usr/share/perl5/vendor_perl/5.8.2
    /usr/share/perl5/vendor_perl/5.8.1
    /usr/share/perl5/vendor_perl/5.8.0
    /usr/share/perl5/vendor_perl
    .

*** Packages of interest status:

Apache::Request: -
CGI            : 3.05
LWP            : 5.800
mod_perl       : 1.9916


3. This is the core dump trace: (if you get a core dump):

  [CORE TRACE COMES HERE]

This report was generated by ./REPORT on Tue Oct 12 20:59:36 2004 GMT.


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: problem building modperl 1.99

Posted by Stas Bekman <st...@stason.org>.
Christian Krause wrote:

>>While you are at it, if you can post a patch that will make the build
>>croak if the same function is encountered more than once, that would
>>be helpful for the future. Thanks.
> 
> 
> Here is a patch which makes the Makefile creating abort in case of
> 1) an already mapped function will be set to undef
> 2) an already mapped function will be defined again
> 
> I hope this helps...

Thanks Christian, committed with minor tweaks.

-- 
__________________________________________________________________
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

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: problem building modperl 1.99

Posted by Christian Krause <ch...@plauener.de>.
On Wed, 13 Oct 2004 22:41:58 -0400, Stas Bekman wrote:

> Christian Krause wrote:
>> I can't build mod_perl on some machines. The "make test" results in the
>> following error:
> [...]
>> Can't locate object method "method_is_limited" via package "Apache::CmdParms" at /usr/src/RPM/BUILD/mod_perl-1.99_16/t/response/TestDirective/cmdparms.pm line 50.\n
>> [  error]
> [...]
>> Reason:
>> - in xs/maps/apache_functions.map is the MODULE=Apache::MethodList (and
>> so the method ap_method_is_limited) disabled
>> - in xs/maps/modperl_functions.map is the MODULE=Apache::CmdParms (and
>> so the method ap_method_is_limited) enabled

> Thanks for the detailed report, great analysis and the patch,
> Christian. But it has already been fixed[1] by gozer in the current
> cvs [2].

Ok, fine.

> While you are at it, if you can post a patch that will make the build
> croak if the same function is encountered more than once, that would
> be helpful for the future. Thanks.

Here is a patch which makes the Makefile creating abort in case of
1) an already mapped function will be set to undef
2) an already mapped function will be defined again

I hope this helps...

Best regards,
Christian

--- mod_perl-1.99_16.old/lib/ModPerl/FunctionMap.pm     2004-03-04 07:01:06.000000000 +0100
+++ mod_perl-1.99_16/lib/ModPerl/FunctionMap.pm 2004-10-14 21:58:36.000000000 +0200
@@ -135,7 +135,11 @@

         if ($name =~ s/^(\W)// or not $cur{MODULE} or $disabled) {
             #notimplemented or cooked by hand
-            $map->{$name} = undef;
+            if ($map->{$name}) {
+                   die "already mapped function \"$name\" will be undef, assume a bug in the map files";
+           }
+           
+           $map->{$name} = undef;
             push @{ $self->{disabled}->{ $1 || '!' } }, $name;
             next;
         }
@@ -160,7 +164,11 @@
             $name =~ s{^(DEFINE_)(.*)}
               {$1 . ModPerl::WrapXS::make_prefix($2, $cur{CLASS})}e;
         }
-
+       
+       if ($map->{$name}) {
+           die "already mapped function \"$name\" will be defined again, assume a bug in the map files";
+       }
+           
         my $entry = $map->{$name} = {
            name        => $alias || $name,
            dispatch    => $dispatch,

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: problem building modperl 1.99

Posted by Stas Bekman <st...@stason.org>.
Christian Krause wrote:

> I can't build mod_perl on some machines. The "make test" results in the
> following error:
[...]
> Can't locate object method "method_is_limited" via package "Apache::CmdParms" at /usr/src/RPM/BUILD/mod_perl-1.99_16/t/response/TestDirective/cmdparms.pm line 50.\n
> [  error]
[...]
> Reason:
> - in xs/maps/apache_functions.map is the MODULE=Apache::MethodList (and
>   so the method ap_method_is_limited) disabled
> - in xs/maps/modperl_functions.map is the MODULE=Apache::CmdParms (and
>   so the method ap_method_is_limited) enabled

Thanks for the detailed report, great analysis and the patch, Christian. 
But it has already been fixed[1] by gozer in the current cvs [2].

It was simply an omission (there should be no duplicates). While you are 
at it, if you can post a patch that will make the build croak if the same 
function is encountered more than once, that would be helpful for the 
future. Thanks.

[1] 
http://cvs.apache.org/viewcvs.cgi/modperl-2.0/xs/maps/apache_functions.map?r1=1.99&r2=1.100&diff_format=h
[2]
http://perl.apache.org/download/source.html#Development_mod_perl_2_0_Source_Distribution

-- 
__________________________________________________________________
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

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html