So, now simple.pl is
use strict;
use warnings;
BEGIN {
    if ($ENV{PAR_0}) {
        print "Adding $ENV{PAR_TEMP} to the path";
        use Config;
        $ENV{PATH} .= "$Config{path_sep}$ENV{PAR_TEMP}";
    }
};

use Gtk2 '-init';
use Glib qw/TRUE FALSE/;
my $window = Gtk2::Window->new;
$window->signal_connect (destroy => sub { Gtk2->main_quit; });

$window->show_all();
Gtk2->main;

Running
perl pp_autolink.pl -o simple.exe simple.pl
and then
simple.exe
gives
Can't load 
'C:\Users\rappazf\AppData\Local\Temp\par-72617070617a66\cache-273ef9b6a6b7e348eadc78be91c5b75711cfe242\778ce824.xs.dll'
 for module Pango: load_file:The specified module could not be found at 
C:/strawberry/perl/lib/DynaLoader.pm line 193.
…
Compilation failed in require at Gtk2.pm line 31.
BEGIN failed--compilation aborted at Gtk2.pm line 31.
Compilation failed in require at script/simple.pl line 11.
BEGIN failed--compilation aborted at script/simple.pl line 11.
Adding 
C:\Users\rappazf\AppData\Local\Temp\par-72617070617a66\cache-273ef9b6a6b7e348eadc78be91c5b75711cfe242
 to the path

François
From: Shawn Laffan <shawnlaf...@gmail.com>
Sent: 13 February 2019 01:20
To: RAPPAZ Francois <francois.rap...@unifr.ch>
Cc: par@perl.org; Roderich Schupp <roderich.sch...@gmail.com>
Subject: Re: packing Gtk2 scripts

I can replicate the errors using a cut-down script Francois provided, and which 
I stripped further to only use Glib.  I used Dependency Walker to check the 
hierarchy and pp_autolink is packing all the needed dlls.

I then checked my own (working) code, and it adds the PAR_TEMP folder to the 
path before loading Glib.

Francois - can you add the begin block from the code below to your script and 
test if it works?

If it does then maybe PAR_TEMP should be appended to the path by PAR, but 
that's Roderich's call.

Regards,
Shawn.



use strict;
use warnings;

BEGIN {
    if ($ENV{PAR_0}) {
        print "Adding $ENV{PAR_TEMP} to the path";
        use Config;
        $ENV{PATH} .= "$Config{path_sep}$ENV{PAR_TEMP}";
    }
};

use Glib;
print "1\n";









On Tue, 12 Feb 2019 at 20:46, RAPPAZ Francois via par 
<par@perl.org<mailto:par@perl.org>> wrote:
Hi there

Roderich, some years ago was explaining why, once the lib/auto/Glib …/Gtk2 had 
been hidden with renaming them in the par archive, running the exe made with pp 
worked for a script using Gtk2:
“Every DLL you add to the packed executable with "pp -l ..." is flatly packed 
in the zip in directory shlib/ARCH and unconditionally extracted in the cache 
area. Also the packed executable runs with the cache directory prepended to 
PATH. So when asked to load the glue DLL for Gtk2.pm etc, DyneLoader loads 
Gtk2.dll from the cache directory. That way we get rid of the second copy of 
the DLLs (extracted and loaded with mangled names) and inter-DLL symbol 
references work as expected. »

On my pc (with a new perl set up), this recipe  does not seems to work anymore. 
Moreover, my folders in perl/site/lib/auto/Glib, …/Gtk2  …/Pango, …/Cairo did 
not have  corresponding glue dll Glib.dll, Gtk2.dll and so on, even if these  
Gtk2 scripts are running fine from perl  without these. So why are these dll 
been needed after all ?

I have found these glue dll in my c:/users/rappazf/AppData …. Folders from the 
unpacking of previous par archives and placed these in a separate folder 
c:/docs/perl_dll
I have then include these in the par archive with –link, but the exe is still 
crashing.

should I select others dll files from these …lib/auto/… to be included with 
link ? how can I select the correct one ?

I tried to pack a 10 lines long script with using pp –x but once open, the gtk 
window seems to block pp. Closing the window gives the control back to pp but 
the resulting exe failed the same.

Thanks for any comment

François


Reply via email to