Re: [mod_perl2]: Install error with Makefile.PL - uninitialized value at TestRun.pm

Daniel Boerner <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <CAOCfoG6j=dj3GQ8O=5LCmR_utvy_Saon2tFNuo40g3+1RnAcSg@mail.gmail.com>
Responding to Susan (about not a static build with large file support,
thread support...) here my
perl5 -V:

Summary of my perl5 (revision 5 version 14 subversion 2) configuration:

  Platform:
    osname=linux, osvers=2.6.32-5-amd64, archname=x86_64-linux-thread-multi
    uname='linux oak 2.6.32-5-amd64 #1 smp sun may 6 04:00:17 utc 2012
x86_64 gnulinux '
    config_args='-des -Dprefix=/home/dani/perl -Dusethreads'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing
-pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64',
    optimize='-O2',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe
-fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.4.5', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
    libpth=/usr/local/lib /lib/../lib /usr/lib/../lib /lib /usr/lib /lib64
/usr/lib64
    libs=-lnsl -lgdbm -ldl -lm -lcrypt -lutil -lpthread -lc -lgdbm_compat
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
    libc=/lib/libc-2.11.3.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.11.3'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib
-fstack-protector'


Characteristics of this binary (from libperl):
  Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV
                        PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP
                        PERL_PRESERVE_IVUV USE_64_BIT_ALL USE_64_BIT_INT
                        USE_ITHREADS USE_LARGE_FILES USE_PERLIO
USE_PERL_ATOF
                        USE_REENTRANT_API
  Built under linux
  Compiled at Jul  8 2012 12:59:50
  @INC:
    /home/dani/perl/lib/site_perl/5.14.2/x86_64-linux-thread-multi
    /home/dani/perl/lib/site_perl/5.14.2
    /home/dani/perl/lib/5.14.2/x86_64-linux-thread-multi
    /home/dani/perl/lib/5.14.2
    .


Best,
Daniel

2012/7/16 Susan <[email protected]>

> **
>
> Ok. I finally got it to glue together with apache 2.2.22, perl 5.14.2, and
> mod_perl 2.0.7. The perl can probably be upgraded to newest.
>
> However, mod_perl 2.0.7 will NOT do a static build (as daniel states
> below, tho that looks real good otherwise) with large file support enabled
> and no perl thread support enabled. It throws constant errors in various
> places -> error: unknown type name 'off64_t'.
>
> So it appears it has to be built as a dso under those circumstances, and
> that goes pretty smoothly with httpd installed first, --with-mpm=prefork
> and any other apache options enabled, as a dso it or something else can be
> unloaded anyway if memory issues with ssl, for instance, are an issue as
> the mod_perl (1) docs state.
>
> Fred's patch is a lifesaver, so patch first:
>
> Index: lib/Apache/TestRun.pm
> ===================================================================
> --- lib/Apache/TestRun.pm(revision 1359945)
> +++ lib/Apache/TestRun.pm(working copy)
> @@ -1097,6 +1097,9 @@
>
>
>      my %args = @Apache::TestMM::Argv;
>      while (my($k, $v) = each %args) {
> +        unless (defined $v) {
> +            die "key $k has no value";
> +        }
>
>          $v =~ s/\|/\\|/g;
>          $body .= "\n\$Apache::TestConfig::Argv{'$k'} = q|$v|;\n";
>      }
>
>
>
> and the makefile cmd I used is:
>
> [mod_perl-2.0.7 ]# perl Makefile.PL MP_USE_DSO=1
> MP_APR_CONFIG=/usr/local/bin/apr-1-config MP_APXS=/srv/httpd/sbin/apxs
>
>
> configures without error, 'make' without error, 'make test' without error,
> and then 'make install'.
>
>
>
> thanks for your help!
>
> Susan
>
>
>
>
>
> =============================================================
>
> On 2012-07-15 09:40, Daniel Boerner wrote:
>
> Hi Fred, Hi Todd
> I just subscribed to this list and still don't know how to link my message
> to your thread from July 10th. Sorry.
> I just want to show you my workaround of the same problem: "Install error
> with Makefile.PL - uninitialized value at TestRun.pm"
>
> Here my proceedings aiming at a statically mod_perl Apache with Perl
> 5.14.2 on Debian "squeeze" Linux:
>
> cd ~/src
> tar -xvzf perl-5.14.2.tar.gz
> cd perl-5.14.2
> mkdir "$HOME/perl"
> ./Configure -des -Dprefix="$HOME/perl" -Dusethreads
> make
> make test
> make install
>
> Making some symlinks... (basically appending a '5' to the name of each
> executable in the newly installed $HOME/perl/bin).
> su ./perl_version_links.pl /home/dani /usr/local/bin
>
> Some prerequisites:
> cpan5
>   install CPAN
>   reload cpan5
>   exit
>
> cpan5
>   install YAML
>   install LWP
>   install CGI
>   install Chatbot::Eliza
>   install Compress::Zlib
>   install Devel::CoreStack
>   install Devel::Symdump
>   install Digest::MD5
>   install IPC::Run3
>   exit
>
>
> And now, making up a statically mod_perl Apache server:
>
> cd ~/src
> tar -xvzf httpd-2.2.22.tar.gz
> tar -xvzf mod_perl-2.0-current.tar.gz
>
> mkdir "$HOME/apache2"
> cd mod_perl-2.0.7/
> perl5 Makefile.PL MP_USE_STATIC=1 MP_AP_PREFIX="$HOME/src/httpd-2.2.22"
> MP_AP_CONFIGURE="--prefix=$HOME/apache2 --with-mpm=prefork" MP_COMPAT_1X=0
>
> Error:
> ERROR from evaluation of
> /home/dani/src/mod_perl-2.0.7/Apache-Reload/Makefile.PL: Use of
> uninitialized value $v in concatenation (.) or string at
> Apache-Test/lib/Apache/TestRun.pm line 1100
>
> Locating line 1100 and adding two print statements just before it:
>
>     my %args = @Apache::TestMM::Argv;
>     while (my($k, $v) = each %args) {
> print "--> $k\n";
> print "---> $v\n";
>         $v =~ s/\|/\\|/g;
>         $body .= "\n\$Apache::TestConfig::Argv{'$k'} = q|$v|;\n";
>     }
>
> Running again:
> perl5 Makefile.PL MP_USE_STATIC=1 MP_AP_PREFIX="$HOME/src/httpd-2.2.22"
> MP_AP_CONFIGURE="--prefix=$HOME/apache2 --with-mpm=prefork" MP_COMPAT_1X=0
>
> Result:
> Configuring Apache/2.2.22 mod_perl/2.0.7 Perl/v5.14.2
> --> httpd
> ---> /home/dani/src/httpd-2.2.22/httpd
> --> apxs
> ERROR from evaluation of
> /home/dani/src/mod_perl-2.0.7/Apache-Reload/Makefile.PL: Use of
> uninitialized value $v in concatenation (.) or string at
> Apache-Test/lib/Apache/TestRun.pm line 1101.
>
> Ok. As I'm building mod_perl statically, I don't need apxs so I apply the
> following workaround: enclose lines 1100 and 1101 in an if-block testing if
> $v is defined:
>
>     my %args = @Apache::TestMM::Argv;
>     while (my($k, $v) = each %args) {
>       if (defined $v) {
>         $v =~ s/\|/\\|/g;
>         $body .= "\n\$Apache::TestConfig::Argv{'$k'} = q|$v|;\n";
>       }
>     }
>
> Now, no error and I could proceed with make:
>
> make
> make test
>
> ...
> All tests successful.
> Files=242, Tests=2469, 427 wallclock secs ( 4.71 usr  0.94 sys + 372.71
> cusr 45.48 csys = 423.84 CPU)
> Result: PASS
> [warning] server localhost:8529 shutdown
> [warning] port 8529 still in use...
> done
> cd ModPerl-Registry && make test
> make[1]: se ingresa al directorio
> `/home/dani/src/mod_perl-2.0.7/ModPerl-Registry'
> /home/dani/perl/bin/perl -I../blib/arch -I../blib/lib \
>         t/TEST  -clean
> [warning] setting ulimit to allow core files
> ulimit -c unlimited; /home/dani/perl/bin/perl
> /home/dani/src/mod_perl-2.0.7/ModPerl-Registry/t/TEST -clean
> APACHE_TEST_GROUP= APACHE_TEST_HTTPD= APACHE_TEST_PORT= APACHE_TEST_USER=
> APACHE_TEST_APXS= \
>         /home/dani/perl/bin/perl -I../blib/arch -I../blib/lib \
>         t/TEST  -bugreport -verbose=0
> [warning] setting ulimit to allow core files
> ulimit -c unlimited; /home/dani/perl/bin/perl
> /home/dani/src/mod_perl-2.0.7/ModPerl-Registry/t/TEST -bugreport -verbose=0
> /home/dani/src/httpd-2.2.22/httpd  -d
> /home/dani/src/mod_perl-2.0.7/ModPerl-Registry/t -f
> /home/dani/src/mod_perl-2.0.7/ModPerl-Registry/t/conf/httpd.conf -D APACHE2
> -D PERL_USEITHREADS
> using Apache/2.2.22 (prefork MPM)
>
> waiting 90 seconds for server to start: ....
> waiting 90 seconds for server to start: ok (waited 2 secs)
> server localhost:8529 started
> t/206.t .............. ok
> t/304.t .............. ok
> t/404.t .............. ok
> t/500.t .............. ok
> t/bad_scripts.t ...... ok
> t/basic.t ............ ok
> t/bin_resp.t ......... ok
> t/cgi.t .............. ok
> t/closure.t .......... ok
> t/dirindex.t ......... ok
> t/fatalstobrowser.t .. skipped: fatalsToBrowser known not to work, CGI
> version 99.99 or higher is required
> t/flush.t ............ skipped: cannot find module 'deflate'
> t/ithreads.t ......... ok
> t/nph.t .............. ok
> t/perlrun_extload.t .. ok
> t/prefork.t .......... ok
> t/redirect.t ......... ok
> t/regex.t ............ ok
> t/rewrite_env.t ...... skipped: cannot find module 'mod_rewrite.c'
> t/special_blocks.t ... ok
> All tests successful.
> Files=20, Tests=84, 33 wallclock secs ( 0.39 usr  0.09 sys + 26.39 cusr
> 3.21 csys = 30.08 CPU)
> Result: PASS
> [warning] server localhost:8529 shutdown
> make[1]: se sale del directorio
> `/home/dani/src/mod_perl-2.0.7/ModPerl-Registry'
> cd Apache-Reload && make test
> make[1]: se ingresa al directorio
> `/home/dani/src/mod_perl-2.0.7/Apache-Reload'
> /home/dani/perl/bin/perl -I../blib/arch -I../blib/lib \
>         t/TEST  -clean
> [warning] setting ulimit to allow core files
> ulimit -c unlimited; /home/dani/perl/bin/perl
> /home/dani/src/mod_perl-2.0.7/Apache-Reload/t/TEST -clean
> APACHE_TEST_GROUP= APACHE_TEST_HTTPD= APACHE_TEST_PORT= APACHE_TEST_USER=
> APACHE_TEST_APXS= \
>         /home/dani/perl/bin/perl -I../blib/arch -I../blib/lib \
>         t/TEST  -bugreport -verbose=0
> [warning] setting ulimit to allow core files
> ulimit -c unlimited; /home/dani/perl/bin/perl
> /home/dani/src/mod_perl-2.0.7/Apache-Reload/t/TEST -bugreport -verbose=0
> mod_perl 2 was built against Apache sources, we don't know where
> httpd/apxs executables are, therefore skipping the test suite execution at
> /home/dani/src/mod_perl-2.0.7/Apache-Test/lib/Apache/TestConfig.pm line 371.
> make[1]: *** [run_tests] Error 2
> make[1]: se sale del directorio
> `/home/dani/src/mod_perl-2.0.7/Apache-Reload'
> make: *** [run_subtests] Error 2
>
> Again, no apxs needed so I ignore the failure of this last test and
> proceed with the install:
>
> make install
>
> Finally, some manual testing (from the mod_perl doc) and everything seems
> to work:
>
> Registry Scripts
> To enable registry scripts add the following to httpd.conf:
>
>   Alias /perl/ /home/dani/httpd/perl/
>
>       SetHandler perl-script
>       PerlResponseHandler ModPerl::Registry
>       PerlOptions +ParseHeaders
>       Options +ExecCGI
>       Order allow,deny
>       Allow from all
>
>
> and now assuming that we have the following script:
>
>   #!/usr/local/bin/perl5
>   print "Content-type: text/plain\n\n";
>   print "mod_perl rocks!\n";
>
> saved in /home/dani/httpd/perl/rock.pl. Make the script executable and
> readable by everybody:
>
>   % chmod a+rx /home/dani/httpd/perl/rock.pl
>
> Of course the path to the script should be readable by the server too. In
> the real world you probably want to have a tighter permissions, but for the
> purpose of testing that things are working this is just fine.
>
> Now restart the server and issue a request to
> http://localhost/perl/rock.pl and you should get the response:
>
>   mod_perl rocks!
>
> If that didn't work check the error_log file.
>
> For more information on the registry scripts refer to the
> ModPerl::Registry manpage. (XXX: one day there will a tutorial on registry,
> should port it from 1.0's docs).
>
>
> Handler Modules
> Finally check that you can run mod_perl handlers. Let's write a response
> handler similar to the registry script from the previous section:
>
>   #file:MyApache2/Rocks.pm
>   #----------------------
>   package MyApache2::Rocks;
>
>   use strict;
>   use warnings;
>
>   use Apache2::RequestRec ();
>   use Apache2::RequestIO ();
>
>   use Apache2::Const -compile => qw(OK);
>
>   sub handler {
>       my $r = shift;
>
>       $r->content_type('text/plain');
>       print "mod_perl 2.0 rocks!\n";
>
>       return Apache2::Const::OK;
>   }
>   1;
>
> Save the code in the file MyApache2/Rocks.pm, somewhere where mod_perl can
> find it. For example let's put it under
> /home/dani/httpd/perl/MyApache2/Rocks.pm, and we tell mod_perl that
> /home/dani/httpd/perl/ is in @INC, via a startup file which includes just:
>
>   use lib qw(/home/dani/httpd/perl);
>   1;
>
> and loaded from httpd.conf:
>
>   PerlRequire /home/dani/httpd/perl/startup.pl
>
> Now we can configure our module in httpd.conf:
>
>
>       SetHandler perl-script
>       PerlResponseHandler  MyApache2::Rocks
>
>
> Now restart the server and issue a request to http://localhost/rocks and
> you should get the response:
>
>   mod_perl 2.0 rocks!
>
> If that didn't work check the error_log file.
>
>
> Cheers,
> Dani
>
>
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.