RE: packing Gtk2 scripts

[email protected] (RAPPAZ Francois via par) Tue, 19 Feb 2019 08:13:25 +0000
Newsgroups perl.par
Message-ID <[email protected]>
No libz_ file on my C: drive

I have a  PAR::Packer folder in my portable perl site/lib but pp is not recognize on the command line. It’s not a question of testing but of making it, I supose. I can get gmake to work now.


F.

From: Shawn Laffan <[email protected]>
Sent: 19 February 2019 08:55
To: RAPPAZ Francois <[email protected]>
Cc: [email protected]
Subject: Re: packing Gtk2 scripts

Where is libz_.dll on your system?

I would assume (perhaps incorrectly) the .xs.dll files are picked up as part of the usual loading process, as they are not in the path when pp_autoload is run, but libz_.dll should be there somewhere.  Possibly pp_autolink is not identifying it properly.

In regards to getting PAR::Packer installed on the portable strawberry, I think you can skip the tests when installing.  It is a portable strawberry perl, so if you later identify that PAR::Packer did not build or install properly then you can just delete the whole portable perl and start with a clean one.  Except for the antivirus issue PAR::Packer is unlikely to have other failures: https://www.cpantesters.org/distro/P/PAR-Packer.html?oncpan=1&distmat=1&version=1.047&grade=2

Shawn.






On Tue, 19 Feb 2019 at 18:20, RAPPAZ Francois <[email protected]<mailto:[email protected]>> wrote:
Hi there,

I download the new version of Shawn’s script.
The script’s messages  were
DLL check iter: 1
DLL check iter: 2
Unable to locate these DLLS, packed script might not work: cairo.xs.dll glib.xs.dll libz_.dll pango.xs.dll
Detected link list: --link C:\prog\gtk+\bin/freetype6.dll --link C:\prog\gtk+\bin/intl.dll --link C:\prog\gtk+\bin/libatk-1.0-0.dll --link C:\prog\gtk+\bin/libcairo-2.dll --link C:\prog\gtk+\bin/libexpat-1.dll --link C:\prog\gtk+\bin/libfontconfig-1.dll --link C:\prog\gtk+\bin/libgdk-win32-2.0-0.dll --link C:\prog\gtk+\bin/libgdk_pixbuf-2.0-0.dll --link C:\prog\gtk+\bin/libgio-2.0-0.dll --link C:\prog\gtk+\bin/libglib-2.0-0.dll --link C:\prog\gtk+\bin/libgmodule-2.0-0.dll --link C:\prog\gtk+\bin/libgobject-2.0-0.dll --link C:\prog\gtk+\bin/libgthread-2.0-0.dll --link C:\prog\gtk+\bin/libgtk-win32-2.0-0.dll --link C:\prog\gtk+\bin/libpango-1.0-0.dll --link C:\prog\gtk+\bin/libpangocairo-1.0-0.dll --link C:\prog\gtk+\bin/libpangoft2-1.0-0.dll --link C:\prog\gtk+\bin/libpangowin32-1.0-0.dll --link C:\prog\gtk+\bin/libpng14-14.dll --link C:\prog\gtk+\bin/zlib1.dll

perl pp_autolink.pl<http://pp_autolink.pl> -o %file%.exe simple.pl<http://simple.pl>

Unable to locate these DLLS, packed script might not work: cairo.xs.dll glib.xs.dll libz_.dll pango.xs.dll
When I run %file%.exe
Can't load 'C:\Users\rappazf\AppData\Local\Temp\par-72617070617a66\cache-70fbf47e9763857f88ec537021fcf7af875b7a06\778ce824.xs.dll' for module Pango: load_file:The specified module could not be found at C:/strawberry/perl/lib/DynaLoader.pm line 193.


With adding the Cairo.xs.dll and co
When I run the exe
GLib-GObject-CRITICAL **: g_boxed_type_register_static: assertion `g_type_from_name (name) == 0' failed at C:/strawberry/perl/lib/DynaLoader.pm line 210.
cannot register alias Gtk2::Pango::Attribute for the unregistered type (null) at C:/strawberry/perl/lib/DynaLoader.pm line 210.

With adding the xs.dll and renaming the folder Cairo etc in lib/auto of the zip file
When I run the exe
Can't locate loadable object for module Glib in @INC (@INC contains: C:\Users\rappazf\AppData\Local\Temp\par-72617070617a66\cache-cae678787c742e4667f145613926678f88b6e4c4\inc\lib C:\Users\rappazf\AppData\Local\Temp\par-72617070617a66\cache-cae678787c742e4667f145613926678f88b6e4c4\inc CODE(0x318a334) CODE(0x318a52c)) at C:/strawberry/perl/site/lib/PAR/Heavy.pm line 99.
Compilation failed in require at script/simple.pl<http://simple.pl> line 12.
BEGIN failed--compilation aborted at script/simple.pl<http://simple.pl> line 12.
Adding C:\Users\rappazf\AppData\Local\Temp\par-72617070617a66\cache-cae678787c742e4667f145613926678f88b6e4c4 to the path

So the error comes before the print in the BEGIN bloc.

I'm stuck with installing the portable strawberry: I have to wait to be able to inactivate Windows defender to setup PAR::Packer, and I have an error when I tried to connect to mysql, about a mysql_old_password plugin.
I don't know if I can solve this on the client side only when connecting, or if I should downgrade the mysql driver (Getting help from my DB admin is not an option ...)

Cheers

François

From: Shawn Laffan <[email protected]<mailto:[email protected]>>
Sent: 17 February 2019 11:08
To: RAPPAZ Francois <[email protected]<mailto:[email protected]>>
Cc: [email protected]<mailto:[email protected]>
Subject: Re: packing Gtk2 scripts

Francois,

I just identified and fixed an issue with pp_autolink where it was not handling case insensitivity.  It is possible the previous runs were not linking all of the DLLs.

Could you try again with the latest version?

Shawn.



On Thu, 14 Feb 2019 at 20:15, Shawn Laffan <[email protected]<mailto:[email protected]>> wrote:
PAR::Packer often triggers antivirus software.  If you are prepared to do so you can disable it while installing PAR::Packer.  Alternately you can skip the tests.

cpanm --notest PAR::Packer

Shawn.


On Thu, 14 Feb 2019 at 20:11, RAPPAZ Francois <[email protected]<mailto:[email protected]>> wrote:
I install a portable version of Strawberry perl and the Gtk2 stuck from sisyphusion
I can run the simple.pl<http://simple.pl> script.

But I can get PAR::Packer install, I download it from cpan and gmake complains

Invalid argument at encode_append.pl<http://encode_append.pl> line 45.
gmake[1]: *** [Makefile:900: Static.pm] Error 22
gmake[1]: Leaving directory 'c:/spp/cpan/build/PAR-Packer-1.047-0/myldr'
gmake: *** [Makefile:543: subdirs] Error 2

And I received msg from the windows defender…

Idea ?

F.

From: Shawn Laffan <[email protected]<mailto:[email protected]>>
Sent: 14 February 2019 08:36
To: RAPPAZ Francois <[email protected]<mailto:[email protected]>>
Subject: Re: packing Gtk2 scripts

Both short and long scripts work for me.

I wonder if it is worth going for the clean option and using the PPMs from sisyphusion.tk<http://sisyphusion.tk> in a fresh installation of Strawberry perl.  If you use the Strawberry perl portable version then it will not interfere with your current installation.

Shawn.


On Thu, 14 Feb 2019 at 18:20, RAPPAZ Francois <[email protected]<mailto:[email protected]>> wrote:
Adding the PAR_TEMP folder in front of the path does not changed anything.

Looking for Gtk2.xs.dll (or Gtk2.dll) on my hard drive gives locations in
c:/users/ … /AppData/Local/Temp…,
c:\docs\... folders where I unzip the par archive and so it’s the same file

Gtk2.xs.dll is in
c:\strawberry\perl\site\lib\auto…

In my windows path I have C:\prog\gtk+\bin. C:\prog\gtk+ is where I unzipped the Gtk2 stuff.


Shawn, was it your trimmed down script (reduced to use Glib; ) that worked for you, or is it the longer script displaying the Gtk2 windows ?
The first works for me…

François

From: Shawn Laffan <[email protected]<mailto:[email protected]>>
Sent: 13 February 2019 23:30
To: RAPPAZ Francois <[email protected]<mailto:[email protected]>>
Cc: Roderich Schupp <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Subject: Re: packing Gtk2 scripts

The three DLLs listed as missing are system DLLs.  I would be surprised if they are actually missing.

The CODE() entries in @INC are how PAR adds its paths to @INC, and are expected.

On the bigger picture, I wonder if you have another Gtk2.dll somewhere in your path.

What happens if you list the PAR_TEMP folder at the front of the path?

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



On Thu, 14 Feb 2019 at 00:09, RAPPAZ Francois <[email protected]<mailto:[email protected]>> wrote:
Comparing the exe made without/with renaming the lib/auto/Glib, lib/auto/Gtk2, lib/auto/Pango

Without renaming
GLib-GObject-CRITICAL **: g_boxed_type_register_static: assertion `g_type_from_name (name) == 0' failed at C:/strawberry/perl/lib/DynaLoader.pm line 210.
cannot register alias Gtk2::Pango::Attribute for the unregistered type (null) at C:/strawberry/perl/lib/DynaLoader.pm line 210.
Compilation failed in require at script/simple.pl<http://simple.pl> line 12.
BEGIN failed--compilation aborted at script/simple.pl<http://simple.pl> line 12.
Adding C:\Users\rappazf\AppData\Local\Temp\par-72617070617a66\cache-4bb65b91bb192b62bf21122f83dfb014a10cbd14 to the path

With renaming
Can't locate loadable object for module Glib in @INC (@INC contains: C:\Users\rappazf\AppData\Local\Temp\par-72617070617a66\cache-c4da599a70a5b23ad01cab4f5d3b75e95393de36\inc\lib C:\Users\rappazf\AppData\Local\Temp\par-72617070617a66\cache-c4da599a70a5b23ad01cab4f5d3b75e95393de36\inc CODE(0x32a485c) CODE(0x32a4a54)) at C:/strawberry/perl/site/lib/PAR/Heavy.pm line 99.
Compilation failed in require at Gtk2.pm line 30.
BEGIN failed--compilation aborted at Gtk2.pm line 30.
Compilation failed in require at script/simple.pl<http://simple.pl> line 12.
BEGIN failed--compilation aborted at script/simple.pl<http://simple.pl> line 12.
Adding C:\Users\rappazf\AppData\Local\Temp\par-72617070617a66\cache-c4da599a70a5b23ad01cab4f5d3b75e95393de36 to the path

If I run depends.exe with adding the path above for both exe
UserDir C:\Users\rappazf\AppData\Local\Temp\... \
UserDir C:\Users\rappazf\AppData\Local\Temp\... \inc\shlib\MSWin32-x86-multi-thread-64int\

depends.exe /oc:out_dwi.txt /d:dwp.txt simple_al2.exe

The output shows that 3 system dll  are not found, Seems to be the same dll for both exe

Status,Module,File Time Stamp,Link Time Stamp,File Size,Attr.,Link Checksum,Real Checksum,CPU,Subsystem,Symbols,Preferred Base,Actual Base,Virtual Size,Load Order,File Ver,Product Ver,Image Ver,Linker Ver,OS Ver,Subsystem Ver
?,"ADVAPI32.DLL","Error opening file. The system cannot find the file specified (2).",,,,,,,,,,,,,,,,,,
?,"KERNEL32.DLL","Error opening file. The system cannot find the file specified (2).",,,,,,,,,,,,,,,,,,
?,"MSVCRT.DLL","Error opening file. The system cannot find the file specified (2).",,,,,,,,,,,,,,,,,,
,"u:\docs\perl\dokpe_i02_dd\SIMPLE_AL2.EXE",2019-02-13 13:13:16,2017-07-07 12:03:24,15977245,A,0x0035BC00,0x00F4BB0D,x86,Console,"None",0x00400000,Unknown,0x0035B000,Not Loaded,0.0.0.0,0.0.0.0,1.0,2.25,4.0,4.0

I’m puzzled by the message “C:\Users\rappazf\AppData\Local\Temp\par-72617070617a66\cache-c4da599a70a5b23ad01cab4f5d3b75e95393de36\inc CODE(0x32a485c) CODE(0x32a4a54)) at”
Is the code() correct ? shouldn’t be a path in full ?

Thanks for any help.

F.


From: RAPPAZ Francois via par <[email protected]<mailto:[email protected]>>
Sent: 13 February 2019 12:22
To: Shawn Laffan <[email protected]<mailto:[email protected]>>
Cc: [email protected]<mailto:[email protected]>
Subject: RE: packing Gtk2 scripts

Thanks for the feed back
I have summarized my problems here https://www.perlmonks.org/?node_id=1229858
and from Rob’s answer I conclude that there would be no point in installing the Gtk2 stack from his sisyphusion site.

I’m puzzled that you don’t need to add any of Glib.dll etc in your packing process.

When you say add x to the path, it’s the windows path you mean ? something around set PATH =%PATH%;xxx before running dep walker
And to use dependency walker when my simple.exe is running,  it is this file that I should load in it ?

François

From: Shawn Laffan <[email protected]<mailto:[email protected]>>
Sent: 13 February 2019 09:26
To: RAPPAZ Francois <[email protected]<mailto:[email protected]>>
Cc: [email protected]<mailto:[email protected]>
Subject: Re: packing Gtk2 scripts

That code packs and runs without issue on my machine.

For comparison, I have Strawberry perl 5.28.0 (PDL version), and have installed Gtk2, Glib etc from the PPMs at http://sisyphusion.tk/ppmindex.html

Maybe try Dependency Walker on C:\Users\rappazf\AppData\Local\Temp\par-72617070617a66\cache-273ef9b6a6b7e348eadc78be91c5b75711cfe242\778ce824.xs.dll to see what it is expecting to load, and how far it gets.  Make sure to add C:\Users\rappazf\AppData\Local\Temp\par-72617070617a66\cache-273ef9b6a6b7e348eadc78be91c5b75711cfe242\ to the search path so it finds the perl dll (and maybe also the "inc\shlib\MSWin32-x64-multi-thread" folder).  Having both paths in this analysis might confuse the issue if the PAR error is a search path problem, but at the least you will see what is expected.
http://www.dependencywalker.com/

Shawn.


On Wed, 13 Feb 2019 at 17:20, RAPPAZ Francois <[email protected]<mailto:[email protected]>> wrote:
So, now simple.pl<http://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<http://pp_autolink.pl> -o simple.exe simple.pl<http://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<http://simple.pl> line 11.
BEGIN failed--compilation aborted at script/simple.pl<http://simple.pl> line 11.
Adding C:\Users\rappazf\AppData\Local\Temp\par-72617070617a66\cache-273ef9b6a6b7e348eadc78be91c5b75711cfe242 to the path

François
From: Shawn Laffan <[email protected]<mailto:[email protected]>>
Sent: 13 February 2019 01:20
To: RAPPAZ Francois <[email protected]<mailto:[email protected]>>
Cc: [email protected]<mailto:[email protected]>; Roderich Schupp <[email protected]<mailto:[email protected]>>
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 <[email protected]<mailto:[email protected]>> 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