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

Hello!

I'm trying to teach myself Tk, by making a little game. Now I'd like to send it to my sister, so my little nephews can play it, but she doesn't have Perl installed, so I'd like to compile it to an executable (we both have macs). I use the pp tool, and it seems to work just fine on little example programs, but for this one I get errors. I worked out most of the problems, but the last error has me at a loss.

>>> pp -c hopgame SYSTEM ERROR in compiling hopgame: 11 at /System/Library/Perl/Extras/5 +.18/Module/ScanDeps.pm line 1351. >>> pp hopgame /usr/bin/pp5.18: Failed to extract a parl from 'PAR::StrippedPARL::Sta +tic' to file '/var/folders/y8/p9hddj4d1l7fryf24cz0cd3m0000gn/T/parlpo +XAzmu' at /System/Library/Perl/Extras/5.18/PAR/Packer.pm line 1152, < +DATA> line 1.

I guess it's something to do with importing the Tk modules? I don't know what else to do about it. Of course, if there's an easier way to compile to an executable, I'd welcome that too. I have ActivePerl 5.20, Mac OS 10.12.6.

Replies are listed 'Best First'.
Re: Issues with pp and Tk
by Discipulus (Canon) on Oct 18, 2017 at 11:05 UTC
    Hi Chuma,

    I think you need -M Tk to add the Tk module and -x too and probalby -g to exclude the console passed to pp packer.

    Read about them at pp's docs.

    See also Re: pp with gui for other useful infos. Also my my homenode has a bounch of useful links.

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
Re: Issues with pp and Tk
by marto (Cardinal) on Oct 18, 2017 at 11:08 UTC
Re: Issues with pp and Tk
by kcott (Archbishop) on Oct 19, 2017 at 01:02 UTC

    G'day Chuma,

    Your pathnames (/System/Library/Perl/Extras/5.18/...) indicate the System Perl v5.18. You say you have "ActivePerl 5.20". And later you say "I'm having a little trouble installing modules.".

    I suspect you're partly working with the System Perl and partly with ActivePerl: therein lies your problem (or, at least, some aspect of it).

    I have almost the same version as you (macOS 10.12.5). I run Perlbrew and have been for many years. I've installed 11 Perl versions (5.14 .. 5.26) using that, along with all the modules I use (via the cpan utility). For private modules written locally, I use the standard incantation (note the absence of sudo):

    perl Makefile.PL && make && make test && make install

    In the normal course of events, I do not interact with the System Perl at all; on the rare occasions that I do, it's usually little more than this:

    $ perl -v | head -2 | tail -1 This is perl 5, version 26, subversion 0 (v5.26.0) built for darwin-th +read-multi-2level $ /usr/bin/perl -v | head -2 | tail -1 This is perl 5, version 18, subversion 2 (v5.18.2) built for darwin-th +read-multi-2level

    As you can see, I'm normally running 5.26 (perl -v); and my System Perl (/usr/bin/perl -v) is 5.18, which is the same as yours.

    I've never used ActivePerl on any Mac, so I can't really offer much in the way of advice regarding that. If you choose to continue using ActivePerl, you should spend some time finding out how you are also referencing the System Perl, then work out what you need to do to stop that.

    I can advise that I successfully run Tk with Perlbrew (e.g. my most recent Tk post). I don't use pp; however, I can confirm a successful installation just now:

    $ cpan ... cpan[1]> install PAR::Packer ... various messages including installation of dependencies ... RSCHUPP/PAR-Packer-1.039.tar.gz /usr/bin/make install -- OK cpan[2]> q ... $ which pp /Users/ken/perl5/perlbrew/perls/perl-5.26.0t/bin/pp

    And, just to be clear, none of what I've said here is intended to invalidate other advice you've already received: as I'm not a user of that module, I'm not in a position to comment on any of that.

    — Ken

Re: Issues with pp and Tk
by thanos1983 (Parson) on Oct 18, 2017 at 10:45 UTC

    Hello Chuma,

    From a "similar question" Perl to Exe throws error using pp command the monks fellow Monk marto suggested:

    Make sure you have the most up to date version of PAR and PAR::Packer, can you give a try and let us know if it worked for you?

    Looking forward to your update, BR.

    Seeking for Perl wisdom...on the process of learning...not there...yet!
Re: Issues with pp and Tk
by Chuma (Scribe) on Oct 19, 2017 at 04:35 UTC

    Oh! Yes, of course, I didn't even think of that – pp is probably using the system version, which doesn't have Tk, and is not very up-to-date generally. So I would need to somehow convince pp to use the ActivePerl version? Or is there another method?

    I mean, in principle it should work anyway, since I've linked to Tk, but my experience with using the system version is nothing but frustration. Although I suppose if I could get it to work with the system version, without updating anything, then I wouldn't need to compile it at all...

      If running multiple versions of perl you should run pp for the version of perl you're actually using. Otherwise, madness lies ahead. Binary comparability, version differences...

      I'd no idea anyone used ActiveState on MacOS. If you have the time consider looking at a combination of perlbrew and cpanm for perl & module installs.

        I should indeed, if I knew how to do that.

        I also used to think ActivePerl was just for Windows. I tried for months getting "normal" Perl to work properly, digging my way through endless indecipherable Unix errors, until I finally found that you could just install ActivePerl and have things at least sort of work. There may be better options, but I'm a simple Mac user, I don't get that complicated stuff. I just want to click an app, if possible.

Re: Issues with pp and Tk
by Chuma (Scribe) on Oct 18, 2017 at 11:38 UTC

    Thanks for your replies!

    I tried just adding -x, which gives the same result as -c.

    This may seem kind of trivial, but I'm having a little trouble installing modules. I used the PPM app to get the stuff I needed (such as Tk itself), but it installs them for the user, and pp seems to ignore those, so I got it to work with use lib instead, but now if I update PAR, I assume it will put that in the wrong place too... it's a bit of a mess.

    I think it should be possible to get PPM to install it in the right place, but I can't work out how to do it. I tried changing a bunch of permissions, but that didn't seem to do anything.