Cpan module install fails

7,684

I did a force install (since the one failing test appeared to be faulty):

cpan -f -i Inline::MakeMaker

With this, it installed fine and I have not had any issues with it.

Share:
7,684

Related videos on Youtube

Jim Balo
Author by

Jim Balo

Updated on September 18, 2022

Comments

  • Jim Balo
    Jim Balo over 1 year

    I am trying to install the Inline::MakeMaker Perl module (including Inline::C), but it fails when installing Inline::C (seems it cannot find "make", though make is installed under /usr/bin).

    This is on CentOS 6 with Perl v5.18.2 (installed from source under /usr/local/perl).

    Here is the output from my installation attempt (I have divided the output in three parts to make it easier to read).

    This is the first part (no errors):

    [root@xyz .cpan]# cpan -i Inline::MakeMaker
    Reading '/root/.cpan/Metadata'
      Database was generated on Tue, 01 Apr 2014 19:06:25 GMT
    Running install for module 'Inline::MakeMaker'
    Running make for S/SI/SISYPHUS/Inline-0.54.tar.gz
    Checksum for /root/.cpan/sources/authors/id/S/SI/SISYPHUS/Inline-0.54.tar.gz ok
    
      CPAN.pm: Building S/SI/SISYPHUS/Inline-0.54.tar.gz
    
    Checking if your kit is complete...
    Looks good
    
    Inline::C is packaged with Inline.pm because it is the most commonly used
    Inline Language Support Module (ILSM).
    
    See also: Inline::ASM, ::Awk, ::BC, ::Basic, ::Befunge, ::CPP (C++), ::CPR,
              ::Foo, ::Guile, ::Java, ::Octave, ::PERL, ::Python, ::Ruby, ::TT,
              ::Tcl and ::WebChat.
    
    Config.pm indicates that your version of Perl was built with this C compiler:
    
        cc
    
    I have located this compiler on your system.
    
    Do you want to install Inline::C? [y] y
    Writing Makefile for Inline::C
    Writing MYMETA.yml and MYMETA.json
    Writing Makefile for Inline
    Writing MYMETA.yml and MYMETA.json
    cp lib/Inline/MakeMaker/Changes blib/lib/Inline/MakeMaker/Changes
    cp Inline.pm blib/lib/Inline.pm
    AutoSplitting blib/lib/Inline.pm (blib/lib/auto/Inline)
    cp Inline-API.pod blib/lib/Inline-API.pod
    cp Inline-Support.pod blib/lib/Inline-Support.pod
    cp lib/Inline/denter.pm blib/lib/Inline/denter.pm
    AutoSplitting blib/lib/Inline/denter.pm (blib/lib/auto/Inline/denter)
    cp lib/Inline/MakeMaker.pm blib/lib/Inline/MakeMaker.pm
    cp lib/Inline/Foo.pm blib/lib/Inline/Foo.pm
    cp Inline.pod blib/lib/Inline.pod
    cp Inline-FAQ.pod blib/lib/Inline-FAQ.pod
    make[1]: Entering directory `/root/.cpan/build/Inline-0.54-D_RUT7/C'
    cp lib/Inline/C/ParseRegExp.pm ../blib/lib/Inline/C/ParseRegExp.pm
    cp lib/Inline/C/ParseRecDescent.pm ../blib/lib/Inline/C/ParseRecDescent.pm
    cp C-Cookbook.pod ../blib/lib/Inline/C-Cookbook.pod
    cp C.pod ../blib/lib/Inline/C.pod
    cp C.pm ../blib/lib/Inline/C.pm
    Manifying ../blib/man3/Inline::C::ParseRecDescent.3
    Manifying ../blib/man3/Inline::C::ParseRegExp.3
    Manifying ../blib/man3/Inline::C-Cookbook.3
    Manifying ../blib/man3/Inline::C.3
    make[1]: Leaving directory `/root/.cpan/build/Inline-0.54-D_RUT7/C'
    Manifying blib/man3/Inline.3
    Manifying blib/man3/Inline-Support.3
    Manifying blib/man3/Inline-API.3
    Manifying blib/man3/Inline-FAQ.3
      SISYPHUS/Inline-0.54.tar.gz
      /usr/bin/make -- OK
    Running make test
    make[1]: Entering directory `/root/.cpan/build/Inline-0.54-D_RUT7/C'
    Manifying ../blib/man3/Inline::C::ParseRecDescent.3
    Manifying ../blib/man3/Inline::C::ParseRegExp.3
    make[1]: Leaving directory `/root/.cpan/build/Inline-0.54-D_RUT7/C'
    PERL_DL_NONLAZY=1 /usr/local/perl/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
    t/00init.t ............. ok   
    t/01usages.t ........... ok   
    t/02config.t ........... ok   
    t/03errors.t ........... ok   
    t/04create.t ........... ok   
    t/05files.t ............ Skipping - couldn't load the Inline::Files module
    t/05files.t ............ ok   
    t/06rewrite_config.t ... ok   
    t/07rewrite2_config.t .. ok   
    All tests successful.
    Files=8, Tests=19, 12 wallclock secs ( 0.04 usr  0.01 sys +  1.28 cusr  0.05 csys =  1.38 CPU)
    Result: PASS
    <snip>
    

    Here is where the error happens:

    <snip>
    make[1]: Entering directory `/root/.cpan/build/Inline-0.54-D_RUT7/C'
    PERL_DL_NONLAZY=1 /usr/local/perl/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, '../blib/lib', '../blib/arch')" t/*.t
    t/00init.t .............. ok   
    t/01syntax.t ............ ok   
    t/02config.t ............ ok   
    t/03typemap.t ........... ok   
    t/04perlapi.t ........... ok   
    t/05xsmode.t ............ ok   
    t/06parseregexp.t ....... ok   
    t/07typemap_multi.t ..... ok   
    t/08taint.t ............. 1/10 sh: make: No such file or directory
    
    A problem was encountered while attempting to compile and install your Inline
    C code. The command that failed was:
      make > out.make 2>&1
    
    The build directory was:
    /root/.cpan/build/Inline-0.54-D_RUT7/C/_Inline_test/build/_08taint_1_p_0965
    
    To debug the problem, cd to the build directory, and inspect the output files.
    
     at ./t/08taint_1.p line 7.
        ...propagated at /root/.cpan/build/Inline-0.54-D_RUT7/C/../blib/lib/Inline/C.pm line 797.
    BEGIN failed--compilation aborted at ./t/08taint_1.p line 7.
    Compilation failed in require at t/08taint.t line 45.
    # Looks like you planned 10 tests but ran 1.
    # Looks like your test exited with 127 just after 1.
    t/08taint.t ............. Dubious, test returned 127 (wstat 32512, 0x7f00)
    Failed 9/10 subtests 
    <snip>
    

    Here is the last part:

    <snip>
    t/09parser.t ............ This test could take a couple of minutes to run
    t/09parser.t ............ ok    
    t/10callback.t .......... ok   
    t/11default_readonly.t .. ok   
    t/12taint_old.t ......... Skipped - applies only to perl 5.6.x
    t/12taint_old.t ......... ok   
    t/14void_arg.t .......... ok     
    t/15ccflags.t ........... ok   
    t/16ccflagsex.t ......... ok   
    t/17prehead.t ........... ok   
    t/18quote_space.t ....... ok     
    t/19INC.t ............... ok   
    t/20eval.t .............. ok   
    t/21read_DATA.t ......... ok   
    t/22read_DATA_2.t ....... ok   
    t/23validate.t .......... ok   
    t/24prefix.t ............ ok   
    t/25proto.t ............. ok   
    
    Test Summary Report
    -------------------
    t/08taint.t           (Wstat: 32512 Tests: 1 Failed: 0)
      Non-zero exit status: 127
      Parse errors: Bad plan.  You planned 10 tests but ran 1.
    Files=25, Tests=91, 30 wallclock secs ( 0.08 usr  0.02 sys + 25.88 cusr  2.11 csys = 28.09 CPU)
    Result: FAIL
    Failed 1/25 test programs. 0/91 subtests failed.
    make[1]: *** [test_dynamic] Error 255
    make[1]: Leaving directory `/root/.cpan/build/Inline-0.54-D_RUT7/C'
    make: *** [subdirs-test] Error 2
      SISYPHUS/Inline-0.54.tar.gz
      /usr/bin/make test -- NOT OK
    //hint// to see the cpan-testers results for installing this module, try:
      reports SISYPHUS/Inline-0.54.tar.gz
    Running make install
      make test had returned bad status, won't install without force
    

    Here is some more data from my attempt at debugging this (sorry for making the post quite long):

    I manually executed the failing test in the debugger:

    cd /root/.cpan/build/Inline-0.54-Rbzd5U/C
    PERL_DL_NONLAZY=1
    /usr/local/perl/perls/perl-5.18.2/bin/perl -d "-MExtUtils::Command::MM" "-e" "test_harness(0, '../blib/lib', '../blib/arch')" t/08taint.t
    

    Here is an excerpt from the output:

    t/08taint.t ............. 1/10 sh: make: No such file or directory
    
    A problem was encountered while attempting to compile and install your Inline
    C code. The command that failed was:
      make > out.make 2>&1
    
    The build directory was:
    /root/.cpan/build/Inline-0.54-Rbzd5U/C/_Inline_test/build/_08taint_1_p_0965
    
    To debug the problem, cd to the build directory, and inspect the output files.
    
     at ./t/08taint_1.p line 7.
        ...propagated at /root/.cpan/build/Inline-0.54-Rbzd5U/C/../blib/lib/Inline/C.pm line 797.
    BEGIN failed--compilation aborted at ./t/08taint_1.p line 7.
    Compilation failed in require at t/08taint.t line 45.
    

    So the file that it is failing on is t/08taint_1.p (which is required on line 45 of t/08taint.t). 08taint_1.p contains this:

    BEGIN {is(${^TAINT}, 1, '1: taint_is_on');};
    
    use Inline Config =>
        UNTAINT => 1,
        DIRECTORY => '_Inline_test';
    
    use Inline C => <<'END_OF_C_CODE';
    
    int add(int x, int y) {
        return x + y;
    }
    
    END_OF_C_CODE
    
    is(add(7,3), 10, 'add_test');
    
    1;
    

    I gather that the test harness uses the above to construct a test, which in turn fails to find "make" for some obscure reason.

    Here is /root/.cpan/build/Inline-0.54-Rbzd5U/blib/lib/Inline/C.pm (line 781-799), and it is the 2nd code line from the bottom that generates the error:

    sub compile {
        my $o = shift;
    
        my $build_dir = $o->{API}{build_dir};
        my $cwd = &cwd;
        ($cwd) = $cwd =~ /(.*)/ if $o->UNTAINT;
    
        chdir $build_dir;
        # Run these in an eval block, so that we get to chdir back to
        # $cwd if there's a failure. (Ticket #81375.)
        eval {
          $o->call('makefile_pl', '"perl Makefile.PL"', 2);
          $o->call('make', '"make"', 2);
          $o->call('make_install', '"make install"', 2);
        };
        chdir $cwd;
        die if $@; #Die now that we've done the chdir back to $cwd. (#81375)
        $o->call('cleanup', 'Cleaning Up', 2);
    }
    

    So the "make" call above fails, but why? Make is in /usr/bin, which is in the PATH.

    • Jim Balo
      Jim Balo about 10 years
      Did that already (stepped through with the debugger, but I am not familiar enough with perl and the test harness to figure out what is wrong). I'll edit the question and add more details from that debugging.
    • Jim Balo
      Jim Balo about 10 years
      @dawud I have added more data on the point it is failing at.