Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

PAR::Packer : Can't use the generated exe if there is no installation of perl

by Psylo (Novice)
on Apr 22, 2016 at 13:50 UTC ( [id://1161220]=perlquestion: print w/replies, xml ) Need Help??

Psylo has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,

I am trying to make standalone exe of my perl scripts. I have chosen Par::Packer to do that because it is free.
To begin with, here is my environment :
-This is perl 5, version 22, subversion 1 (v5.22.1) built for MSWin32-x64-multi-thread installed with Strawberry Perl
-PAR::Packer 1.0.31
-Windows 7

So now, what's the problem ?
I have managed to create an executable which is working fine with the command line pp -o test.exe test.pl
When I give it to my colleagues, they have the error 0xc00007b "the application was unable to start correctly".
I have managed to reproduce the issue by deleting some of my PATH values : C:\Strawberry\c\bin and/OR C:\Strawberry\perl\bin
After reading some forums I have tried pp -c -o test.exe test.pl or pp -c -x test.exe test.pl but I always have the same issue...


For me PAR::Packer is supposed to bundle perl in the exe. But am I suppose to add something to the delivery ? I didn't find anything on the internet about that that's why it sounds strange to me. Do I have to add some dlls which -c and -x options didn't find ? How to know which one I have to pick ?

Just in case, my colleagues all have Windows 7 installed.

Replies are listed 'Best First'.
Re: PAR::Packer : Can't use the generated exe if there is no installation of perl
by soonix (Canon) on Apr 22, 2016 at 15:12 UTC
    I didn't have such problems when I used pp on a setup similiar to yours, so I suspect there is something in your or your colleagues' setup.

    A quick google seems to indicate it is something 64/32bit-related. The most relevant seems to be this link.

    For generating EXEs I used a more or less "fresh"(*) copy of the Straberry Portable edition, and did all the steps (installing CPAN prerequisites etc) from within that (normal scripting and developing using a different perl installation) - see EXE from Script (Re: General advice desperately needed) and Re: How to make EXE file for Windows cmd window. Perhaps that is the reason why I didn't stumble over this problem (yet) :-)

    Update: (*) The point here not being the freshness, but that it is a different perl that doesn't use the libraries from your system (similiar to the Unix/Linux/OSX people's advice not to use the "system perl" for your own applications)

      Sorry I was in holidays with no network for a few days.
      I will try to generate the exe with a 32 bit portable edition of Strawberry. I'll update the comment asap.

      Anyway, thanks for the reply.

      Update : I have installed a 32 bits portable edition of perl, installed PAR::Packer with cpan for this portable installation, and it works now..
      I still don't understand the error which is annoying me but... It works so thank you for your help !!

Re: PAR::Packer : Can't use the generated exe if there is no installation of perl
by dasgar (Priest) on Apr 23, 2016 at 16:02 UTC

    I haven't seen that kind of issue using pp from PAR::Packer to create executables. Here's a few thoughts about possible problems.

    First, it looks like you're using a 64 bit Perl. That means that the executables that you create will be trying to run a 64 bit Perl. If your colleagues are using a 32 bit Windows 7, then they won't be able to run the executables you create using a 64 bit Perl. My recommendation is that you stick with 32 bit Perl for creating executables. If you need to leverage 64 bit Perl, then you need to treat all of the executables that you create as being 64 bit programs that will only run on 64 bit Windows.

    My next thought was wondering how you installed PAR::Packer. I'd recommend using cpan or cpanm (or whichever cpan utility you prefer) to install the PAR::Packer module.

    Lastly, I'm not sure if you typos in your post, but some of the syntax that you listed is not correct for the pp utility. The way that I usually use pp is to use is like this: pp -c -x -o script.pl program.exe. I doubt that this is the source of the issue that you are seeing, but thought I'd share this you in case it might be useful to others.

      Sorry I was in holidays with no network for a few days.
      As said in the answer just above, I will try to generate the exe with a 32 bit portable edition of Strawberry.

      To answer your questions : we all have the same Windows, and I have installed PAR::Packer with cpan. I will try to do a new installations...

      Anyway, thanks for the reply. I'll update the comment asap.

      Update : I have installed a 32 bits portable edition of perl, installed PAR::Packer with cpan for this portable installation, and it works now..
      I still don't understand the error which is annoying me but... It works so thank you for your help !!

Re: PAR::Packer : Can't use the generated exe if there is no installation of perl
by Anonymous Monk on Apr 22, 2016 at 22:23 UTC
Re: PAR::Packer : Can't use the generated exe if there is no installation of perl
by stevieb (Canon) on Apr 22, 2016 at 14:04 UTC

    I've never used Par::Packer before so this is just a guess, but could it be that something you're packing is looking for the path to the perl.exe binary in %PATH%, and when it can't find it, that's when it's breaking?

      I was also thinking about that. But when there is only C:\Strawberry\c\bin in my %PATH% it is working, and there is no perl.exe in this folder... So I will say that this is not the problem

        What is in the c:/strawberry/c/bin directory? I have a few Windows test servers, but all my perls are managed by berrybrew, so I don't have such a dir.

        Perhaps there's something in that directory that isn't perl.exe that's being looked for.

        Can you search through the pre-packed code and search for $ENV{PATH}?

        I suspect the resulting executable relies on one or more of the shared libraries (DLLs) in C:\Strawberry\c\bin. You should either transfer them along to the target machine or look for a way to include them into the PAR executable.
Re: PAR::Packer : Can't use the generated exe if there is no installation of perl
by RonW (Parson) on Apr 26, 2016 at 22:23 UTC
    pp has a -a option to include additional files, like DLLs that some modules might be looking for and pp missed.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1161220]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2024-04-24 22:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found