Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

ActiveState PerlApp + Gtk and themes

by Ralesk (Pilgrim)
on Jan 20, 2012 at 14:26 UTC ( #948975=perlquestion: print w/ replies, xml ) Need Help??
Ralesk has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks,

We have a Perl program with a GTK+ GUI that we'd like to bundle into a single .exe file for our Win32 users.

Since ActiveState don't seem to get GTK+ (they're missing pkg-config among other things, and as such there are only some rather outdated third-party PPM repositories to use), we've decided to compile Gtk (the Perl binding) ourselves. It seems to work quite decently, even use the WIMP (libwimp.dll) engine to look like Windows. This is in contrast with one of the third-party things that only carried the default engine.

The problem: actually packaging with PerlApp.

  • PerlApp seems to be otherwise quite fine, but for one, it can't figure out what DLLs we need from GTK+ (the C original) to use Gtk (the Perl binding), manually copying the respective libs to site/lib/auto/{Cairo,Glib,Gtk2,Pango,Gtk2/GladeXML} seems to help and the program runs at least. This is kinda magical and weird.
  • WIMP isn't found. I've tried to put it where the other GTK+ libs live in the tree, but GTK wasn't happy about it. Tried to mess with the GTK_PATH environment variable, but I have absolutely no idea about the file system structure within the PerlApp executable, if there's even any. I've tried Strawberry+PAR the last few days, there there is a FS tree (it's a ZIP file, afterall), but I couldn't figure out PerlApp yet. I'm hoping that all I have to do is place libwimp.dll to the right directory somewhere.

So I'm asking you for any ideas on how to get WIMP to be recognised by the theming engine. For extra points: is it possible to include another (mostly unrelated) binary in the bundle and have it available during the script's run?

Comment on ActiveState PerlApp + Gtk and themes
Download Code
Re: ActiveState PerlApp + Gtk and themes
by Marshall (Prior) on Jan 20, 2012 at 15:40 UTC
    If you run the GUI version of perlApp (just type perlApp with no args) some of this might be more apparent.

    For the "extra" .exe I think you need what is called a "bound file". Read the help (access easiest from the GUI). This will be added in the Files tab. You can configure it to be automatically extracted so that you can just run it from your Perl program. You can also cram in say a config file or some fancy graphic, etc.

    In the front pane of the GUI, you can specifiy additional search paths (in addition to the normal Perl directories). I think this will help with your first 2 problems.

    When you get this setup, the GUI version can save what you've done as a "project file" so you don't have to keep doing this stuff every time you make the .exe.

    Update: As far as the .dll goes, I think that if all else fails, you can use the bound file trick to force it into the .exe package and if its automatically unpacked, I think at run time your program will find it. Congratulations on doing something pretty complicated - you've without doubt already surmounted many hurdles to get this far!

      Thanks. We've been using the GUI ever since we've started playing with PerlApp, so we do already have a decent-ish project file for it. I'll look at the File tab more closely for adding the extra file we'd need to run, it might be that I missed some controls there.

      However, the other problem doesn't seem to be fixable with the library (blib, shared lib, etc.) list on the main tab, I've tried them and no change in the resulting file (the GTK+ DLLs only began to get included when I copied them to the Perl lib/auto directory). Might be doing something wrong, but adding more paths than the normal ones simply didn't change a thing.

      I have just found out that if I do copy the GTK+ libs to the "awkward" directories, the theming will go off in the original Perl script too, not just the packed one. This makes it slightly easier and faster to debug, as long as I can find a way to figure out to see just what kinds of files it tries to open. An open-source Windows strace app I found wasn't of any use, though.

        I've never tried to build a GUI library before. I know that when Active State does this, they add extra heuristics to perlApp that makes it "smarter". This is how it can find and force additional modules into the .exe that aren't explicitly "used" (via a use xxx; statement) - there are probably other things that they do of which I am unaware. It may be that you are stuck with some kludgy stuff. I think the "bound file" idea will work and I think I've done it before, but its been awhile. Sorry that I can't help further.

        Update: I've used Taskinfo before. It can show files that a process currently has open, I don't know of there is a way to figure out what files were accessed (but are in the steady state closed: i.e. were opened read, but are now closed). The author has continuously updated this app since I first used it- speculation: maybe there is now some kind of "trace" option - I don't know.

Re: ActiveState PerlApp + Gtk and themes
by Anonymous Monk on Jan 21, 2012 at 03:57 UTC

      Thanks for those links, Google didnít quite lead me to them in the past, Iíll look into them when Iím working on this again. The third one seems a bit superfluous with the patches, I think the only thing needed to be patched was Module::ScanDeps, exactly as it was shown there too, compilation of the other stuff worked right out of the box afterwards.

        The third one seems a bit superfluous with the patches,

        Trust me, nothing was superfluous in 2009

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://948975]
Approved by sundialsvc4
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2014-09-20 20:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (163 votes), past polls