3

安装 CPAN 模块时,PP (PAR::Packer) 总是失败。

如果我通过 cpan 安装它会失败。

cpan> cpan pp
CPAN: Storable loaded ok (v2.41)
Reading '/root/.cpan/Metadata'
  Database was generated on Sun, 15 Sep 2013 03:41:03 GMT
Running install for module 'pp'
Running make for R/RS/RSCHUPP/PAR-Packer-1.014.tar.gz
CPAN: Digest::SHA loaded ok (v5.84_01)
CPAN: Compress::Zlib loaded ok (v2.06)
Checksum for /root/.cpan/sources/authors/id/R/RS/RSCHUPP/PAR-Packer-1.014.tar.gz ok
CPAN: File::Temp loaded ok (v0.23)
CPAN: Parse::CPAN::Meta loaded ok (v1.4404)
CPAN: CPAN::Meta loaded ok (v2.120921)
CPAN: Module::CoreList loaded ok (v2.96)

PAN.pm: Building R/RS/RSCHUPP/PAR-Packer-1.014.tar.gz

*** You have extra Perl library paths set in your environment.
    Please note that these paths (set with PERL5LIB or PERLLIB)
    are not honored by perl when running under taint mode, which
    may lead to problems. This is a limitation (by design) of
    Perl, not of PAR::Packer; but some of the problems may
    manifest here during installation.
Checking if your kit is complete...
Looks good
Prototype mismatch: sub main::prompt: none vs ($;$) at /usr/local/lib/perl5/5.18.1/ExtUtils/MakeMaker.pm line 220.
Writing Makefile for par
Writing MYMETA.yml and MYMETA.json
Writing Makefile for PAR::Packer
Writing MYMETA.yml and MYMETA.json
cp lib/PAR/Filter/Bleach.pm blib/lib/PAR/Filter/Bleach.pm
cp lib/PAR/Filter.pm blib/lib/PAR/Filter.pm
cp lib/PAR/Filter/PodStrip.pm blib/lib/PAR/Filter/PodStrip.pm
cp lib/PAR/Filter/Obfuscate.pm blib/lib/PAR/Filter/Obfuscate.pm
cp lib/PAR/Filter/PatchContent.pm blib/lib/PAR/Filter/PatchContent.pm
cp lib/PAR/Packer.pm blib/lib/PAR/Packer.pm
cp lib/PAR/Filter/Bytecode.pm blib/lib/PAR/Filter/Bytecode.pm
cp lib/PAR/StrippedPARL/Base.pm blib/lib/PAR/StrippedPARL/Base.pm
cp lib/App/Packer/PAR.pm blib/lib/App/Packer/PAR.pm
cp lib/pp.pm blib/lib/pp.pm
make[1]: Entering directory `/root/.cpan/build/PAR-Packer-1.014-Cy_LGm/myldr'
Makefile:755: warning: overriding commands for target `.c.o'
Makefile:333: warning: ignoring old commands for target `.c.o'
/usr/local/bin/perl par_pl2c.pl my_par_pl < ../script/par.pl > my_par_pl.c 
/usr/local/bin/perl sha1.c.PL
cc -c -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -I/usr/local/lib/perl5/5.18.1/x86_64-linux/CORE  -DPARL_EXE=\"parl\" -O2 main.c
main.c: In function ‘main’:
main.c:121: warning: assignment discards qualifiers from pointer target type
cc main.o  -s -Wl,-E  -fstack-protector -L/usr/local/lib  -L/usr/local/lib/perl5/5.18.1/x86_64-linux/CORE -lperl -lnsl -ldl -lm -lcrypt -lutil -lc  -o ./par

true
/usr/local/bin/perl encode_append.pl Dynamic.in ./par Dynamic.pm
/usr/local/bin/perl ./file2c.pl -c 30000 ./par /usr/local/lib/perl5/5.18.1/x86_64-linux/CORE/libperl.a > boot_embedded_files.c
cc -c -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -I/usr/local/lib/perl5/5.18.1/x86_64-linux/CORE  -DPARL_EXE=\"parl\" -O2 boot.c
cc boot.o -static-libgcc -s -Wl,-E  -fstack-protector -L/usr/local/lib  -L/usr/local/lib/perl5/5.18.1/x86_64-linux/CORE -lnsl -ldl -lm -lcrypt -lutil -lc   -o ./boot
true
/usr/local/bin/perl encode_append.pl Static.in ./boot Static.pm
cp Static.pm ../blib/lib/PAR/StrippedPARL/Static.pm
cp Dynamic.pm ../blib/lib/PAR/StrippedPARL/Dynamic.pm
/usr/local/bin/perl -Mblib run_with_inc.pl ./boot -q -B -Oparl
system(./boot -I/root/.cpan/build/PAR-Packer-1.014-Cy_LGm/myldr/../blib/arch -I/root/.cpan/build/PAR-Packer-1.014-Cy_LGm/myldr/../blib/lib -I/usr/local/lib/perl5/site_perl/5.18.1/x86_64-linux -I/usr/local/lib/perl5/site_perl/5.18.1 -I/usr/local/lib/perl5/5.18.1   /x86_64-linux -I/usr/local/lib/perl5/5.18.1 -I. -q -B -Oparl) failed: 
make[1]: *** [parl] Error 255
make[1]: Leaving directory `/root/.cpan/build/PAR-Packer-1.014-Cy_LGm/myldr'
make: *** [subdirs] Error 2
  RSCHUPP/PAR-Packer-1.014.tar.gz
  /usr/bin/make -- NOT OK
'YAML' not installed, will not store persistent state
Running make test
  Can't test without successful make
Running make install
  Make had returned bad status, install seems impossible

好的,我会手动安装它。

# wget http://search.cpan.org/CPAN/authors/id/R/RS/RSCHUPP/PAR-Packer-1.014.tar.gz
# tar -xzf PAR-Packer-1.014.tar.gz
# cd PAR-Packer-1.014
# perl Makefile.PL
# make


Skip blib/lib/App/Packer/PAR.pm (unchanged)
Skip blib/lib/PAR/Filter/Bleach.pm (unchanged)
Skip blib/lib/pp.pm (unchanged)
Skip blib/lib/PAR/StrippedPARL/Base.pm (unchanged)
Skip blib/lib/PAR/Filter/PodStrip.pm (unchanged)
Skip blib/lib/PAR/Filter/Obfuscate.pm (unchanged)
Skip blib/lib/PAR/Packer.pm (unchanged)
Skip blib/lib/PAR/Filter/PatchContent.pm (unchanged)
Skip blib/lib/PAR/Filter/Bytecode.pm (unchanged)
Skip blib/lib/PAR/Filter.pm (unchanged)
make[1]: Entering directory `/root/PAR-Packer-1.013/myldr'
Makefile:765: warning: overriding commands for target `.c.o'
Makefile:341: warning: ignoring old commands for target `.c.o'
cc -c -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -I/usr/local/lib/perl5/5.18.1/x86_64-linux/CORE  -DPARL_EXE=\"parl\" -O2 main.c
cc main.o  -s -Wl,-E  -fstack-protector -L/usr/local/lib  -L/usr/local/lib/perl5/5.18.1/x86_64-linux/CORE -lperl -lnsl -ldl -lm -lcrypt -lutil -lc -o ./par
true
/usr/local/bin/perl encode_append.pl Dynamic.in ./par Dynamic.pm
/usr/local/bin/perl ./file2c.pl -c 30000 ./par my_par.c load_my_par
cc -c -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -I/usr/local/lib/perl5/5.18.1/x86_64-linux/CORE  -DPARL_EXE=\"parl\" -O2 boot.c
cc boot.o -s -Wl,-E  -fstack-protector -L/usr/local/lib  -L/usr/local/lib/perl5/5.18.1/x86_64-linux/CORE -lnsl -ldl -lm -lcrypt -lutil -lc  -o ./boot
true
/usr/local/bin/perl encode_append.pl Static.in ./boot Static.pm
Skip ../blib/lib/PAR/StrippedPARL/Dynamic.pm (unchanged)
Skip ../blib/lib/PAR/StrippedPARL/Static.pm (unchanged)
/usr/local/bin/perl -Mblib run_with_inc.pl ./boot -q -B -Oparl
system(./boot -I/root/PAR-Packer-1.013/myldr/../blib/arch -I/root/PAR-Packer-1.013/myldr/../blib/lib -I/usr/local/lib/perl5/site_perl/5.18.1/x86_64-linux -I/usr/local/lib/perl5/site_perl/5.18.1 -I/usr/local/lib/perl5/5.18.1/x86_64-linux -I/usr/local/lib/perl5/5.18.1 -I. -q -B -Oparl) failed: 
make[1]: *** [parl] Error 255
make[1]: Leaving directory `/root/PAR-Packer-1.013/myldr'
make: *** [subdirs] Error 2

结果失败。

# make install

没有更好,仍然失败。

make[1]: Entering directory `/root/PAR-Packer-1.013/myldr'
Makefile:757: warning: overriding commands for target `.c.o'
Makefile:333: warning: ignoring old commands for target `.c.o'
/usr/local/bin/perl -Mblib run_with_inc.pl ./boot -q -B -Oparl
system(./boot -I/root/PAR-Packer-1.013/myldr/../blib/arch -I/root/PAR-Packer-1.013/myldr/../blib/lib -I/usr/local/lib/perl5/site_perl/5.18.1/x86_64-linux -I/usr/local/lib/perl5/site_perl/5.18.1 -I/usr/local/lib/perl5/5.18.1/x86_64-linux -I/usr/local/lib/perl5/5.18.1 -I. -q -B -Oparl) failed: 
make[1]: *** [parl] Error 255
make[1]: Leaving directory `/root/PAR-Packer-1.013/myldr'
make: *** [subdirs] Error 2

如果我安装了一个非常旧的版本,那么我可以安装它,但是脚本仍然不起作用。有没有人有关于将脚本编译为二进制的建议/建议?

我发现的旧版本位于:http ://www.filewatcher.com/m/p5-PAR-Packer-0.97.6.tbz.31-0.html

如果我手动安装,这就是错误。我尝试用最新版本替换所有 StrippedPARL 文件。没修。

# pp -o test test.pl 
PAR::StrippedPARL::Static->get_raw() did not return the raw binary data for a PAR loader at PAR/StrippedPARL/Base.pm line 141, <DATA> line 1.
Could not write temporary parl (class PAR::StrippedPARL::Static) to file '/tmp/parl7iXv' at PAR/StrippedPARL/Base.pm line 65, <DATA> line 1.
/bin/pp: Failed to extract a parl from 'PAR::StrippedPARL::Static' to file '/tmp/parlV69KOmc' at PAR/Packer.pm line 1169, <DATA> line 1.

[root@server lib]# pp -p test.pl 
[root@server lib]# pp -o hello a.par 
PAR::StrippedPARL::Static->get_raw() did not return the raw binary data for a PAR loader at PAR/StrippedPARL/Base.pm line 141, <DATA> line 1.
Could not write temporary parl (class PAR::StrippedPARL::Static) to file '/tmp/parlH3l2' at PAR/StrippedPARL/Base.pm line 65, <DATA> line 1.
/bin/pp: Failed to extract a parl from 'PAR::StrippedPARL::Static' to file '/tmp/parlGJdI1MP' at PAR/Packer.pm line 1169, <DATA> line 1.

根据 amons 的建议,我安装了旧版本的 perl。

[root@server lib]# pp test.pl 
PAR::StrippedPARL::Static->get_raw() did not return the raw binary data for a PAR loader at PAR/StrippedPARL/Base.pm line 141, <DATA> line 1.
Could not write temporary parl (class PAR::StrippedPARL::Static) to file '/tmp/parlW2E0' at PAR/StrippedPARL/Base.pm line 65, <DATA> line 1.
/bin/pp: Failed to extract a parl from 'PAR::StrippedPARL::Static' to file '/tmp/parlK48HkV0' at PAR/Packer.pm line 1169, <DATA> line 1.
[root@server lib]# perl -v

This is perl, v5.10.1 (*) built for x86_64-linux

Copyright 1987-2009, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

无法取消设置 perl5lib,它没有设置。

perl -e 'print "PERL5LIB: ", $ENV{PERL5LIB}, "\n";'
PERL5LIB: 
4

1 回答 1

0

我刚刚遇到了同样的问题。至少在我的情况下,检查环境变量 TMPDIR 并检查是否可以从中执行二进制文件。就我而言,它是 /dev/shm 并且禁止从它执行(我猜是出于安全原因)。代码 boot(来自 boot.c)将二进制文件解压缩到 $TMPDIR 中并尝试从中运行,然后默默地失败(因为模块作者没有预料到它会失败)。如果是这种情况,解决方案是:

    TMPDIR=/tmp make
于 2016-07-09T01:36:06.107 回答