Phantoon has asked for the wisdom of the Perl Monks concerning the following question:

So I have successfully installed Strawberry Perl 5.12, GTK2, and the Gtk-perl bindings on Windows XP SP3. I have tested and verified that the gtk-perl application works without any issue when just running the perl script manually, however when I package it via pp and link correctly, I seem to get an error when trying to start the application

--- Here is the error ---
C:\Documents and Settings\Administrator\Desktop\testgtk\test>testgtk.e +xe GLib-GObject-CRITICAL **: g_boxed_type_register_static: assertion `g_t +ype_from_n ame (name) == 0' failed at C:/strawberry/perl/lib/DynaLoader.pm line 2 +23. 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/testgtk.pl line 1. BEGIN failed--compilation aborted at script/testgtk.pl line 1.


-- Here is the pp + linking command i used --
pp -l "C:\strawberry\perl\site\lib\auto\Cairo\Cairo.dll" -l "C:\strawb +erry\perl\site\lib\auto\Pango\Pango.dll" -l "C:\strawberry\perl\site\ +lib\auto\Glib\Glib.dll" -l "C:\strawberry\perl\site\lib\auto\Gtk2\Gtk +2.dll" -o testgtk.exe testgtk.pl


-- Here is the sample GTK code that works manually --
use Gtk2 '-init'; $window = Gtk2::Window->new('toplevel'); $window->set_title("Hello World!"); $button = Gtk2::Button->new("Press me"); $button->signal_connect(clicked => sub { print "Hello again - the butt +on was pressed\n"; }); $window->add($button); $window->show_all; Gtk2->main; 0;

Replies are listed 'Best First'.
Re: pp + GTK2 + win32
by Khen1950fx (Canon) on Oct 22, 2010 at 06:21 UTC
    The sample Gtk2 code isn't correct. Added Gtk2->main_quit;. It'll close now. Try this:
    #!/usr/bin/perl use strict; use warnings; use Gtk2 '-init'; my $window = Gtk2::Window->new; my $button = Gtk2::Button->new('Press me'); $button->signal_connect(clicked => sub { print "Hello again - the butt +on was pressed\n"; }); $window->add($button); $window->signal_connect(destroy => sub { Gtk2->main_quit; }); $window->show_all; Gtk2->main;
Re: pp + GTK2 + win32
by Anonymous Monk on Oct 22, 2010 at 06:27 UTC
        Activestate PDK can make exe from gtk2 perl files the easy way

        Its not any easier

Re: pp + GTK2 + win32
by Anonymous Monk on Jan 16, 2011 at 02:29 UTC
    I'm getting the exact same error compiling Perl-Gtk2 apps using pp on Windows 7 using the CamelBox perl distribution and I can't for the life of me figure out why. I can compile Perl-Gtk apps fine using Perl2Exe, which I'd prefer not to use. Any ideas?
        perlapp from Activestate's PDK isn't a much better option to Perl2Exe being that it's a non-free, commercial solution. Indigo Star's Perl2Exe Pro (Pro is required to support the --gui option which suppresses the console, a requirement for stand alone perl GUI apps) costs $149 and really isn't that good. ActiveState's perlapp, which is distributed with their PDK (Perl Dev Kit) costs $295. pp is free and would be the preferred solution. If I'm left with no other option I guess I'd shell out the $295 for ActiveState's PDK, but I'd really prefer not too.