我试图安装Inline :: MakeMaker Perl模块(包括Inline :: C),但安装Inline :: C(似乎找不到“make”,虽然make安装在/ usr / bin下)失败。
这是在CentOS 6上使用Perl v5.18.2(从源代码安装在/ usr / local / perl下)。
这里是我的安装尝试的输出(我已经把输出分成三部分,以便于阅读)。
这是第一部分(没有错误):
[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>
这里是错误发生的地方:
<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>
这是最后一部分:
<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
以下是我尝试debugging的更多数据(抱歉让post很长):
我在debugging器中手动执行失败的testing:
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
这是从输出摘录:
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.
所以它的失败文件是t / 08taint_1.p(t / 08taint.t的第45行是必需的)。 08taint_1.p包含这个:
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;
我认为testing工具使用上面的方法来构build一个testing,而这个testing反过来又会因为一些不明确的原因而找不到“make”。
这里是/root/.cpan/build/Inline-0.54-Rbzd5U/blib/lib/Inline/C.pm(781-799行),它是从底部产生错误的第二条代码行:
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); }
所以上面的“make”调用失败了,但是为什么呢? make位于PATH中的/ usr / bin中。
我做了一个强制安装(因为一个失败的testing似乎是错误的):
cpan -f -i Inline::MakeMaker
有了这个,它安装好,我没有任何问题。
这个问题似乎是Inline.pm“sub env_untaint {}”部分的一个变化。
dir可写性的新testing不知何故采取了“制造”的道路,所以当然失败了。 值得注意的是,有一个注释部分:
# Was: # join ':', grep...
如果你还原了旧的Was: join代码,并在env_untaint子目录中注释掉它上面的新join代码, make clean , perl Makefile.PL ,它应该make test成功,安装完毕。