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

Windows 8 64-bit. Activestate Perl 5.16.3. Perl2exe 16.00. My user is an admin for Windows.

My Perl program works fine when interpreted with Perl. I can make an EXE file with Perl2EXE. But when I try to run the program, it just locks up the cmd window. There are no error messages, the cmd windows just locks up and the program produces no output. When I run my compiled/bundled program with no args, it's supposed to print some instructions but I get nothing.

I tried perl2exe with both of these options:

  1. perl2exe script.pl -platform=Win32-5.16.3
  2. perl2exe script.pl -platform-Win64-5.16.3
  3. I have the same problem when I try to compile and run the Perl2exe sample.pl program.

Any idea how to fix this? Also, pp won't install with cpan. I get an error with dmake. EDIT: Dmake failed because the install script couldn't find windres and has this error: 'windres' is not recognized as an internal or external command, operable program or batch file. I'll look into finding windres.exe and make sure that dir is on my path when I get home. But for this question let's focus on the EXE produced by perl2exe not working at all.

Thank you.

Replies are listed 'Best First'.
Re: Program made with perl2exe locks up
by marto (Cardinal) on Jan 03, 2016 at 18:38 UTC
      I've done some searching and cannot find any cpan logs for Activestate Perl on my machine, but here's the last few lines of the install log when I did "cpan pp".
      Writing MYMETA.yml and MYMETA.json
      Set up gcc environment - gcc.exe (rubenvb-4.5.4) 4.5.4
      cp lib/PAR/StrippedPARL/Base.pm blib\lib\PAR\StrippedPARL\Base.pm
      cp lib/PAR/Packer.pm blib\lib\PAR\Packer.pm
      cp lib/PAR/Filter/PodStrip.pm blib\lib\PAR\Filter\PodStrip.pm
      cp lib/PAR/Filter/Obfuscate.pm blib\lib\PAR\Filter\Obfuscate.pm
      cp lib/App/Packer/PAR.pm blib\lib\App\Packer\PAR.pm
      cp lib/PAR/Filter.pm blib\lib\PAR\Filter.pm
      cp lib/PAR/Filter/PatchContent.pm blib\lib\PAR\Filter\PatchContent.pm
      cp lib/PAR/Filter/Bytecode.pm blib\lib\PAR\Filter\Bytecode.pm
      cp lib/pp.pm blib\lib\pp.pm
      cp lib/PAR/Filter/Bleach.pm blib\lib\PAR\Filter\Bleach.pm
      C:\perl64\bin\perl.exe par_pl2c.pl my_par_pl < ..\script\par.pl > my_par_pl.c
      C:\perl64\bin\perl.exe sha1.c.PL
      C:\Perl64\site\bin\gcc.exe -c -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT -DWIN64 -D
      CONSERVATIVE -DPERL_TEXTMODE_SCRIPTS -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT
       -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DHASATTRIBUTE -fno-strict-aliasing -mms-bitfi
      elds  -I"C:\Perl64\lib\CORE"  -DPARL_EXE=\"parl.exe\" -O2 main.c
      main.c: In function 'main':
      main.c:121:23: warning: assignment discards qualifiers from pointer target type
      windres -i winres/pp.rc -o ppresource.coff --input-format=rc --output-format=cof
      f --target=pe-x86-64
      'windres' is not recognized as an internal or external command,
      operable program or batch file.
      dmake.exe:  Error code 129, while making 'ppresource.coff'
      dmake.exe:  Error code 255, while making 'subdirs'
        RSCHUPP/PAR-Packer-1.028.tar.gz
        C:\Perl64\site\bin\dmake.exe -- NOT OK
      CPAN: YAML::XS loaded ok (v0.41)
      Running make test
        Can't test without successful make
      Running make install
        Make had returned bad status, install seems impossible
      
      C:\Perl64\projects>
      
      Hm, windres is not being found. Why wasn't it installed and how do I install it?
        Hm, windres is not being found. Why wasn't it installed and how do I install it?

        windres.exe is part of the MinGW distro.
        You should find it alongside gcc.exe (and others) in the MinGW/bin directory which, for you, appears to be C:\Perl64\site\bin.
        Is C:\Perl64\site\bin in your PATH ? (It should be.)

        Cheers,
        Rob

        Sounds like a path issue, what is the result of running the following at the command prompt:

        where windres
Re: Program made with perl2exe locks up
by hotchiwawa (Scribe) on Jan 03, 2016 at 19:17 UTC
    I don't know if it's your problem but on Windows 8, there is a setting to lock the console in power options.
    Have you set your script with "use autodie;", "use warnings;" ?
      Yes, I use both:
      use warnings; use strict; use autodie qw(:all); # For writing utf-8 files.
      Edit: under display/console lock
        I don't see any "Console Lock" under Control Panel/Display, nor do I see it under the shortcut to cmd.exe properties.
Re: Program made with perl2exe locks up
by james28909 (Deacon) on Jan 03, 2016 at 21:19 UTC
    If its not a huge script, you could post it and maybe someone could point out what /might/ be causing the lockup.
      I think I mentioned even the perl2exe sample.pl program fails when the EXE is run, but here is sample.pl.
      #!/usr/bin/perl
      
      #perl2exe_info CompanyName=My Company
      #perl2exe_info FileDescription=My File Description
      #perl2exe_info FileVersion=1.2.3.4
      #perl2exe_info InternalName=My International Name
      #perl2exe_info LegalCopyright=My Legal Copyright
      #perl2exe_info LegalTrademarks=My Legal Trademarks
      #perl2exe_info OriginalFilename=My Original Filename
      #perl2exe_info ProductName=My Product Name
      #perl2exe_info ProductVersion=My Product Version
      #perl2exe_info Comment=My Comment
      
      print "This is sample.pl\n";
      print "ARGV = ", join(" ", @ARGV), "\n";
      
      print "Script path \$0 = $0\n";
      print "Exe path \$^X = $^X\n";
      print "Perl verison \$] = $]\n";
      
      print "\@INC=\n   ", join("\n   ", @INC), "\n";
      sleep (1);
      
      The real script I'm trying to compile is actually quite large.
        Windows 8 ;l Maybe try running it as administrator. And also maybe try using compatibility mode in the executables properties. Personally I am not sure what the problem may be, but you could try to use perlapp from the active state website to see if it will work that way. It could just be your Perl2Exe that is messed up.
        The Perl Dev Kit has a 30 day trial. Why dont you download and install it real quick, then run "perlapp" from console and try compiling it that way.
Re: Program made with perl2exe locks up
by hotchiwawa (Scribe) on Jan 04, 2016 at 08:00 UTC
    Check the "Event Viewer" too :)
      How do I check the Event Viewer?
        http://windows.microsoft.com/en-us/windows/open-event-viewer#1TC=windows-7

        Open Event Viewer by clicking the Start button Picture of the Start button, clicking Control Panel, clicking System and Security, clicking Administrative Tools, and then double-clicking Event Viewer.‌ Administrator permission required If you're prompted for an administrator password or confirmation, type the password or provide confirmation.