3

When installing a CPAN module, PP (PAR::Packer) it always fails.

If I install it via cpan it fails.

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

Fine i'll install it manually.

# 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

Results in a fail.

# make install

no better, still fails.

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

If I install a really old version, then I can get it to install, however the script still doesn't work. Does any one have suggestion / recommendations for compiling scripts to binary?

old versions I've found are located here: http://www.filewatcher.com/m/p5-PAR-Packer-0.97.6.tbz.31-0.html

This is the error if I install it manually. I've tried replacing all of the StrippedPARL files, with most to date versions. Didn't fix it.

# 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.

based on amons suggestions, I installed a old version of 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.

can't unset perl5lib, it's not set.

perl -e 'print "PERL5LIB: ", $ENV{PERL5LIB}, "\n";'
PERL5LIB: 
Ddragonimp
  • 61
  • 1
  • 7
  • What OS are you on? Do you have development tools like `make` and a C compiler installed? Do you realize that PAR won't compile your scripts? – amon Sep 15 '13 at 12:05
  • Linux server. CentOS 6. Yes to both make, C compiler are installed. PAR::Packer is a command line tool which says you can run #pp script.pl and it will compile it. http://search.cpan.org/~rschupp/PAR-Packer-1.014/lib/pp.pm – Ddragonimp Sep 15 '13 at 12:09
  • Willing to use alternatives, if someone has suggestions. – Ddragonimp Sep 15 '13 at 12:27
  • Well, this is weird. You can [file a bug](https://rt.cpan.org/Dist/Display.html?Name=PAR-Packer) if you want to. I see that you have a custom perl 5.18.1 installation. Was this compiled by your organization, or is it a specific Perl distribution like activestate? – amon Sep 15 '13 at 12:45
  • What about the PERL5LIB warning? Does it work if it's unset? – Slaven Rezic Sep 15 '13 at 20:32
  • Check `env | grep PERL` to see all of your Perl related environment variables. It's probably something set by the cpan shell. – Schwern Sep 15 '15 at 22:40

1 Answers1

0

I just ran into the same problem. At least in my case, check environment variable TMPDIR and check whether you can execute binary from it. In my case it is /dev/shm and execution from it is forbidden (for security reasons I guess). The code boot (from boot.c) unpacks binary into $TMPDIR and tries run from it and silently fails (because the module author failed to anticipate it will ever fail). If that is the case, the solution is:

    TMPDIR=/tmp make
Hui Zhou
  • 97
  • 1
  • 3