2

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
...
Patrik
  • 321
  • 1
  • 8
  • *"it doesn't work on my machines either if I change the name of the directory which holds the Perl installation*" How/when do you change the name of the directory? – Håkon Hægland Jun 08 '20 at 08:41
  • I change the name after making the executable, before running it. Sorry, it was a bit unclear. The point is, the executable can no longer reference the Perl installation. – Patrik Jun 08 '20 at 09:10
  • For Windows you can check out my answer at: [Find Dependencies using Process Explorer](https://stackoverflow.com/a/53353869/10667839) – clamp Jun 08 '20 at 15:41
  • @Patrik Maybe try ask at the GitHub [issue tracker](https://github.com/rschupp/PAR-Packer/issues) ? – Håkon Hægland Jun 08 '20 at 18:51
  • I tried your example code on Windows and packed with a minimal `wxpar -o test.exe test.pl`. Everything seems to be fine - also with the perl tree hidden from the executable. – clamp Jun 08 '20 at 21:08
  • @clamp Yes, it worked also for me on Windows, but not on macOS, confusingly. Btw, I tried your method with Process Explorer, but it shows nothing unfortunately. – Patrik Jun 08 '20 at 22:14
  • @Håkon: I might ask at he issue tracker, thanks for the idea. But I'm still suspecting that the I'm just doing something dumb. – Patrik Jun 08 '20 at 22:18

0 Answers0