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

Ok, I'm little confused about the underlying process of what I'm trying to do, so bear with me:

I've got a Perl script on Win32 that I want to compile, as the systems I'm going to be running this on don't have Perl installed.

I've got Cygwin installed on my development machine along with the Cygwin distribution of Perl 5.6.

I want to compile the script so that it doesn't have a dependency on cygwin.dll - from the perldoc pages I've read so far, I think perlcc will generate/compile C code. Here's where I'm unclear: if I run perlcc from within Cygwin, will it generate an executable with a dependency on cygwin.dll?? Or can I follow the instructions here for a mingw compile?? Or will it be a stand-alone executable on Win32 without me having to do anything else??

Replies are listed 'Best First'.
Re: compiling Perl scripts in Cygwin
by Courage (Parson) on Oct 20, 2002 at 07:18 UTC
    1. Even if you'll compile using perlcc perl still must exist on a machine that will execute your program
    2. if you're compiling anything using Cygwin, your executable will depend on cygwin1.dll and other auxiliary files.
      A bit less dependancies will be if you're compiling using just perl for Win32.
    To guarantee that your program will execute on machine without perl, just distribute perl files with your executable.
    May be you can strip most files and distribute just minimal set. But in this case do not perform perl installation procedure, just arrange your executable to be able to find right perl56.dll and other necessary files. (place them in a directory with your .exe file)

    Courage, the Cowardly Dog

Re: compiling Perl scripts in Cygwin
by true (Pilgrim) on Oct 20, 2002 at 13:09 UTC
    One way, which has some problems is perl2exe. I used it to connect an ohio lady, a Raleigh NC office, and an Access database. Neither machine had perl installed. perl2exe offers multi-build modes. There is still a required dll but one option allows you to build .exe with the dll pre-installed (only one program to download). The dll for perl2exe is PerlCtrl.dll.

    perl2exe has proven to work for me on Win98, Win2k, and WinXP. Major downside with perl2exe which i havn't worked around yet is Module compilation. Some modules perl2exe uses won't compile when you export to .exe. Here's a link to their site.

    There is an ActiveState solution for standalone. But i haven't paid the dough to use it yet. http://activestate.com

      I did use the ActiveState solution, but just for testing purposes (just in case we'd ever need to do such a thing, blah, blah, blah) and it worked fine. It was for an executable with quite some module dependencies and one ends up with just an executable that does the job. Everything gets compiled into the executable.

      Unfortunately, yes, it's payware, although it's not that expensive if memory serves.

      Best, -gjb-

A reply falls below the community's threshold of quality. You may see it by logging in.