My application is made with wxPerl, and I make an executable with PAR::Packer
. It works fine on my machines (macOS and Windows), but not on a machine without a Perl/wxPerl installation; in fact, it doesn't work on my machines either if I change the name of the directory which holds the Perl installation, e.g. to perl5X
or StrawberryX
, before running the executable.
On macOS I can get error messages from the terminal:
Can't load '/var/folders/[...]/ca54e36a.bundle' for module Wx:
dlopen(/var/folders/[...]/ca54e36a.bundle,
1): Library not loaded: /[...]/Alien/wxWidgets/osx_cocoa_3_0_2_uni/lib/libwx_osx_cocoau_core-3.0.0.2.0.dylib
Referenced from: /var/folders/[...]/libwx_osx_cocoau_adv-3.0.dylib
Reason: image not found at <embedded>/DynaLoader.pm line 197.
at <embedded>/PAR/Heavy.pm line 140.
I have tried to --link
all the .dylib
/.dll
files (errors about other files occur too), but the same error occurs.
I have use Wx::Perl::Packager
in my source file as explained here, and run pp
(or, on Windows, wxpar
; on macOS that doesn't work) like:
pp -x -c -o MyApp.exe script/app.pl -a assets/collections
The data files included with -a
gets unpacked into the right place when the executable is run, so it works that far. But then it stops.
So, what am I missing?
-- EDIT 1
Edited for clarity.
-- EDIT 2
I include a Minimal (not) Working Example:
use warnings;
use strict;
package MyFrame;
use Wx::Perl::Packager;
use Wx;
use base 'Wx::Frame';
sub new {
my $class = shift;
my $self
= $class->SUPER::new( undef, -1, 'Test', [ -1, -1 ], [ 250, 150 ], );
return $self;
}
1;
package MyApp;
use base 'Wx::App';
sub OnInit {
my ($self) = @_;
my $frame = MyFrame->new();
$frame->Show();
}
1;
package main;
MyApp->new->MainLoop;
I then run pp
like this:
#!/bin/bash
pp -x -c -o minimal.app \
-l /Users/Patrik/perl5/perlbrew/perls/perl-5.30.0/lib/site_perl/5.30.0/darwin-2level/Alien/wxWidgets/osx_cocoa_3_0_2_uni/lib/libwx_osx_cocoau_core-3.0.0.2.0.dylib \
minimal.pl
But after "hiding" the Perl installation and running the app I get
...
Library not loaded: /Users/Patrik/perl5/perlbrew/perls/perl-5.30.0/lib/site_perl/5.30.0/darwin-2level/Alien/wxWidgets/osx_cocoa_3_0_2_uni/lib/libwx_osx_cocoau_core-3.0.0.2.0.dylib
...