Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Perl compiled by PAR::Packer doesn't run on other machines

Tags:

windows

perl

I have an existing 2000 LOC perl script with a Tkx GUI that I just inherited on my first day as an intern at a place where I am the sole programmer (everyone else is an IC engineer, but they do their simulations in perl).

The goal is to produce an executable for clients to run without having to install perl nor anything else. Apparently this has been possible in the past.

I've only been able to get the Program to build by installing ActiveTcl 8.5.15, ActivePerl 5.16, installing via PPM Win32::API and Win32::Exe, tk, tkx, Carp, then installing via cpanp i PAR::Packer. This very specific mix is the only one I found that produced any results that worked.

Then it's:

pp -vvv -l C:\Perl\lib\auto\Tcl\tkkit.dll -l C:\Perl\lib\auto\Tcl\Tcl.dll -l C:\Perl\lib\auto\Win32\API\API.dll --gui -o .\<THE NAME OF THE FILE.EXE> .\<PERL SOURCE>.pl

From here I get a working executable, except it will not run on any of the other machines I've tested it on. It's not an arch issue as far as I can tell.

The documentation by the previous developer is extremely lacking on the subject (he's better on documenting the actual code). I'm told he migrated it to StrawberryPerl then back to ActivePerl when that broke, but as yet it's still pretty broken over here and the existing build environment is long gone.

Any help would be appreciated.

Action: Use PAR::Packer pp to compile Windows binary from a perl script so that clients can run it without perl

Expected Result: A tk GUI Window opens and stays open.

Actual Result: A tk GUI Window does not open, no errors are produced on console nor in any prompt.

like image 817
Justin Reeves Avatar asked Dec 06 '25 05:12

Justin Reeves


1 Answers

Thanks to all who responded.

I actually found the solution myself, which was that this block

BEGIN { if (exists $ENV{PAR_PROGNAME}) { use Config (); $ENV{PERL_TCL_DL_PATH} = catfile($ENV{PAR_TEMP}, 'tkkit.' . $Config::Config{dlext}, ); } }

needs to appear before a "use Tkx;" to properly instruct PAR::Packer to grab the necessary parts of Tcl to package the program. So the necessary libraries were being left out and the executable was searching for ActiveTcl installations in %path% that did not exist. But thank you for the detail about the additional module for debugging.

like image 183
Justin Reeves Avatar answered Dec 08 '25 21:12

Justin Reeves