Subject: | Cannot package with GTK on Windows |
I am attempting to package a GTK program of hello world complexity
(attached).
Using Strawberry Perl v5.10.1 and the latest CPAN GTK libraries.
The program works when executed from Perl directly.
The PAR packaging works when done in Linux (for Linux).
Running Windows XP.
M:\>pp -r -o gtk_test.exe gtk_test.pl --lib c:\strawberry\perl\vendor\lib
Can't load
'C:\DOCUME~1\TULLOH~1\LOCALS~1\Temp\par-TULLOH_DR\cache-747980e518612640bb53c4cf915453f938dc7a91\9790912d.dll'
for module Pango: load_file:The specified module could not be found at
C:/strawberry/perl/lib/DynaLoader.pm line 200. at
C:\strawberry\perl\vendor\lib/PAR/Heavy.pm line 128
Compilation failed in require at Gtk2.pm line 31.
BEGIN failed--compilation aborted at Gtk2.pm line 31.
Compilation failed in require at script/gtk_test.pl line 1.
BEGIN failed--compilation aborted at script/gtk_test.pl line 1.
Directory of
C:\DOCUME~1\TULLOH~1\LOCALS~1\Temp\par-TULLOH_DR\cache-747980e518612640bb53c4cf915453f938dc7a91
2010-03-09 09:41 AM 183,808 9790912d.dll
Cracking the ZIP file open manually I can see the four GTK dlls are
present, though they have been moved from site\lib\auto\ in the Perl
tree to just lib\auto\ in the PAR file.
Manually adding the libraries on the command line produced a different
error. I'm not sure if it's the same issue failing at a different spot
or a different problem.
M:\>pp -r -o gtk_test.exe gtk_test.pl --lib
c:\strawberry\perl\vendor\lib -l
c:\strawberry\perl\site\lib\auto\Cairo\Cairo.dll -l
c:\strawberry\perl\site\lib\auto\Glib\Glib.dll -l
c:\strawberry\perl\site\lib\auto\Pango\Pango.dll -l
c:\strawberry\perl\site\lib\auto\Gtk2\Gtk2.dll
GLib-GObject-CRITICAL **: g_boxed_type_register_static: assertion
`g_type_from_name (name) == 0' failed at
C:/strawberry/perl/lib/DynaLoader.pm line 223.
cannot register alias Gtk2::Pango::Attribute for the unregistered type
(null) at C:/strawberry/perl/lib/DynaLoader.pm line 223.
Compilation failed in require at script/gtk_test.pl line 1.
BEGIN failed--compilation aborted at script/gtk_test.pl line 1.
If you are attempting to recreate this I saw reports online that the
same issue occured with Camelbox Perl, which has the GTK libraries
bundled with it. Installing GTK from CPAN was a bit fiddly.
Subject: | gtk_test.pl |
use Gtk2 -init;
# Gtk2->init; works if you didn't use -init on use
my $window = Gtk2::Window->new ('toplevel');
my $button = Gtk2::Button->new ('Quit');
$button->signal_connect (clicked => sub { Gtk2->main_quit });
$window->add ($button);
$window->show_all;
Gtk2->main;