Wine will make you do the craziest things

Wine Will Make You Do the Craziest Things

I’ll resist the temptation to continue with a bunch of double-entendres. The Wine I’m talking about is the open source Windows emulator, and the crazy thing is using it to run PerlApp to make Windows executables on Linux.
Before I continue though, I have to add: Using ActiveState products under Wine is not supported. Please don’t email ActiveState support asking for help with this, because it’s not guaranteed to work. Your mileage may will vary.
Last week someone emailed me with just such a request. Of course, I should have just said “Not supported. Good luck!” but the question tickled my curiosity. Could you use this configuration to cross-wrap a Perl program on Linux that would run on Windows? As it turns out, you can.
First of all, here’s what I mean by cross-wrapping. TclApp has a very handy feature that allows you to create executables for “foreign” platforms (i.e. ones you’re not actually running TclApp on). It does this by dynamically downloading the basekits needed in the wrapped executable from ActiveState’s TeaPot repository. PerlApp doesn’t have a similar mechanism (yet) so you have to run it on the deployment platform to get a native executable.
But what if you’re running Linux and don’t have a Windows system or VM to run it on?. Well, you can do this:

  1. Install Wine
  2. Install ActivePerl and Perl Dev Kit
       $ msiexec /i ActivePerl-<version>-MSWin32-<build>.msi
       
       $ msiexec /i PDK-<version>-windows.msi

    If all goes well. Wine will install ActivePerl here:

        ~/.wine/drive_c/Perl/bin/

    … and Perl Dev Kit here:

        ~/.wine/drive_c/Program Files/ActiveState Perl Dev Kit 7.3/bin
  3. Install the license if you have one. If not, the Perl Dev Kit will give you a 21 day trial.
        $ wine <serial_number>.exe
  4. Run PerlApp. One Wine “gotcha” here: use Wine’s filesystem paths (in double-quotes) for perlapp arguments. For example:
      wine perlapp.exe --perl "C:\Perl\bin\perl.exe"

Notice I’ve specified the ‘–perl’ argument here. For some reason the ActivePerl installer is unable to add itself to Wine’s PATH. You can add it manually with wine regedit.
I was able to wrap the PerlApp examples (and even Tkx-ed!) into executables under Wine and run them on a Windows XP system.
Things that won’t work:

  • Komodo’s PDK toolbar: In Komodo (yes it seems to run under Wine too), the PDK toolbar doesn’t seem to work consistently. This seems to have something to do with how Wine handles “Windows” paths, but I haven’t gotten to the bottom of it. If none of the paths have spaces, it seems to work.
  • PPM: PPM will launch, and show package details for installed packages, but it doesn’t seem to be able to query the ActiveState repository. If you need to install additional packages in Wine, you could download the ppm zip files then install from a local directory.

Title photo courtesy of Kym Ellis on Unsplash.

Recent Posts

Webinar - Securing Python and Open Source Ecosystems
Securing Python and Open Source Ecosystems

Dustin Ingram, Fellow at the Python Software Foundation (PSF), joins us to discuss trust and security for PyPI and other repositories in light of recent supply chain attacks, and steps being taken to secure the open source ecosystem.

Read More
Scroll to Top