Jul 20

Compile a perl script that uses Wx with pp and PAR

Tag: Uncategorizedtengo @ 9:30 am

Compiling scripts with pp, PAR’s helper script, to executable binaries (.exe files on Win32) should be a pretty straightforward process. Anyway, if you are developing GUI applications, probably with Wx, you will surely run into some problems.

Upon execution, the generated execs will complain about missing libraries, DLLs or similar. This is because pp does a lot, but it is somehow blind to see the Wx bindings dependencies. So you need to tell it that you have additional libraries for it to include in the build. You can do so by using the -M switch, or by using Mark Dootson’s excellent Wx::Perl::Packager! On Win32 ActivePerl setups, you might want to do “ppm install http://www.wxperl.co.uk/repository/Wx-Perl-Packager.ppd”, as not all repositories carry a ppm for this module.

Then, simply add this line at the very top of your Wx-using script:

use Wx::Perl::Packager;

and then use Wx::Perl::Packager’s “wxpar” drop-in replacement for pp. So, to compile, do:

wxpar -o myapp.exe myapp.pl

optionally adding a bit of salt like in the docs

wxpar –gui –icon=myicon.ico -o myprog.exe myscript.pl

and there you go.


Random Posts

Leave a Reply