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

Hello Monks,
I am trying to compile a simple perl script into self-contained executable so that it can be distributed among other people.
pp -o myGame.exe myGame.pl
I am using perl with cygwin. When someone else tries to use that executable, it fails with error of missing cygwin1.dll.
Does this mean that executable will work only on similar kind of environment or OS you can say.
Do we have any other option or I should go towards Strawberry or ActivePerl again.
Thanks if anyone can provide guidance. Couldn't find much in the docs of pp

Replies are listed 'Best First'.
Re: Using pp (Perl Packer) with cygwin
by taint (Chaplain) on May 27, 2014 at 06:20 UTC
    As to
    Does this mean that executable will work only on similar kind of environment or OS you can say.
    Pretty much, yes. While it has been many years, since I have had the need (or desire) to work in such an environment. Using the one you're currently working in will require at least a similar one. Doing it as you are now.

    There are other options/methods to accomplishing what you're after. But I can't recall right off, all the details. So I'll defer to others, until I have better details to offer.

    Best wishes.

    --Chris

    UPDATE:
    While the solutions mentioned in The Perl Compiler (turning perl scripts into binary executables) aren't the one(s) I was thinking of, or have as broad an application. The node does provide you with a great amount of insight, in spite of it's age.
    UPDATE2: See also: PAR, and
    PAR::Packer
    ...and last, but not least; from the Perl FAQ: How can I compile my Perl program into byte code or C?

    ¡λɐp ʇɑəɹ⅁ ɐ əʌɐɥ puɐ ʻꜱdləɥ ꜱᴉɥʇ ədoH

Re: Using pp (Perl Packer) with cygwin
by soonix (Chancellor) on May 27, 2014 at 12:26 UTC

    Perhaps it will be sufficient to provide them with a copy of your cygwin1.dll, at least this worked for me in a similiar case. (If they already have cygwin on their machine, the program wouldn't complain about missing it)

    However, probably the cygwin1.dll must be suited for their system (XP/7/8, 32 vs. 64 bit, whatever) - and be compatible to your version of cygwin...

    If, however, you want to distribute only one (executable) file, you have to go with one of the "native" ports, like ActiveState, Strawberry, Citrus, DWIM or so, as proposed in Re: Using pp (Perl Packer) with cygwin (don't). I think it should be possible to install (and use) it alongside with your cygwin perl...

    Update: you might find this: Newb guidance for Perl on MS Windows: Cygwin, Strawberry, ActivePerl? informative (despite the "newb" in its subject)

Re: Using pp (Perl Packer) with cygwin (don't)
by Anonymous Monk on May 27, 2014 at 08:03 UTC
      There are no multiple cygwin on a single machine
      I want my "self-contained" exe file(created over cygwin) to run on some machine (without cygwin and without perl) on default command prompt.
      This exe runs perfectly on my machine but not on another machine and gives the error of cygwin1.dll required.
      This simply appears that to run on Windows, I need to use pp using strawberry or ActivePerl. To run on cygwin, I need to build it on cygwin perl. And finally to run on unix machine, I need to build it on unix machine.
      Please correct me if I am wrong.

        This exe runs perfectly on my machine but not on another machine and gives the error of cygwin1.dll required.

        Yes, you said that in your original posting, and I provided the answer already (-x -l depends ... the links)

        This simply appears that to run on Windows, I need to use pp using strawberry or ActivePerl. To run on cygwin, I need to build it on cygwin perl. And finally to run on unix machine, I need to build it on unix machine. Please correct me if I am wrong.

        Well, cygwin is not windows, the end :)

        You , can call cygwin programs from windows, even a pp-ed perl program ... but kinda misses the point of windows and of cygwin, and complicates your perl programs ... why surprise windows people with an unixish cygwin perl program ?

        Have a nice day

Re: Using pp (Perl Packer) with cygwin
by RonW (Parson) on May 27, 2014 at 21:04 UTC
    There is an option to manually specify additional DLLs to include in a self contained EXE. However, as mentioned by another, the cygwin.ddl from your PC might not work correctly on another PC.