http://www.perlmonks.org?node_id=964837

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

Hello Monks, I have built an application in perl. I have used pp utility to make it an exe.
pp -o script.exe script.pl
when i double click it in windows, it gives an error message saying that the "The version of this file is not compatible with the version of Windows you're running. Check your computer's system information to see whether you need x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher." I wonder what went wrong. Cant i use pp utility to make an exe for windows? if not can you suggest any other utility. Thank you Akhila. update: I am using 64 bit ubuntu and 64 bit windows 7 and windows vista. Any help is really appreciated. update: I am using perl5.

Replies are listed 'Best First'.
Re: pp utility incompatibility issue with windows
by dasgar (Priest) on Apr 13, 2012 at 03:40 UTC
    Cant i use pp utility to make an exe for windows?

    Yes, you can use pp utility to create stand-alone executable files for Windows. In fact, I did so just earlier this week.

    To help you figure out what might have gone wrong, it would help if you shared which Windows you're running, whether you're using 32-bit or 64-bit Windows, and what version of Perl that you're using.

    Based on the error message that you provided, my guess is that you used a 64-bit Perl on 64-bit Windows to create your .exe file and then tried to run the .exe file on a 32-bit Windows. I could be wrong, but I don't think that will work.

    It's been my personal experience so far that using 32-bit Perl (even on 64-bit Windows) and using pp to create .exe files, the created .exe files work on both 32-bit and 64-bit Windows. Of course, there's probably draw backs (such as limited to 32-bit integers) and problems that could come up from doing so. Fortunately, I haven't hit any of those issues.

      Both machines are 64 bit. I am using ubuntu and windows 7. I am not sure where to debug. The script runs perfectly fine in ubuntu.

        Are you using Ubuntu to create the .exe and then trying to run that on Windows? If so, that's your problem right there. Using pp, you can't build an executable one platform (Windows, Linux, Mac, etc.) and get that executable to run on another platform.

        To create a Windows executable, you'll need to do this on Windows. Two popular Perl distributions for Windows are ActivePerl from ActiveState and http://strawberryperl.com/. If you're wanting to try Perl on Windows and don't want to install anything, I would recommend checking out portable Strawberry Perl, which does not install anything.

        In order to install PAR::Packer (which has the pp utility), you'll definitely need a compiler and a make utility. Strawberry Perl already comes with both ready for use. With ActivePerl, you'll just need to use their PPM utility to install MinGW and dmake.

        Of course, if you have Perl installed and have all the needed modules installed too, you might be able to just copy your script to your Windows system and just run it.

      Hi dasgar, While making an exe for windows with pp utility, it generates a 16bit application. How can i change it? Thank you Akhila

        Hi dasgar, While making an exe for windows with pp utility, it generates a 16bit application. How can i change it? Thank you Akhila

        That is unlikely, how do you know?

        First thought: That doesn't sound right. I believe that you would need a 16 bit compiler to make a 16 bit application. However, that's a guess on my part.

        Second thought: What makes you think that it's a 16 bit application? Personally, I wouldn't have a clue on how to check if an application is a 16, 32, or 64 bit application.

        Third thought: If it works and you're able to use it, does it really matter if it is a 16 bit application? Not trying to sound harsh, but I'm just not seeing what the concern here is.

Re: pp utility incompatibility issue with windows
by Anonymous Monk on Apr 13, 2012 at 02:37 UTC

    I wonder what went wrong

    Really? The error message seems specific enough about what went wrong :/

    You might have better luck with Cava Packager