Cross compiling from Linux to Windows: Wine?

6,665 views
Skip to first unread message

supercheetah

unread,
Apr 14, 2011, 10:27:31 AM4/14/11
to PyInstaller
So I was taking a look at this <http://groups.google.com/group/
pyinstaller/browse_thread/thread/2884993f9b070968> here on cross
compiling from Linux to Windows.

How has people's experience been with this since?

Can it work with Wine?

Rene

Martin Zibricky

unread,
Apr 14, 2011, 12:03:43 PM4/14/11
to pyins...@googlegroups.com
one

supercheetah píše v Čt 14. 04. 2011 v 07:27 -0700:

one guy uses (or used?) pyinstaller and wine for the following service:

https://www.ohloh.net/p/python-packager


Hartmut Goebel

unread,
Apr 14, 2011, 12:22:48 PM4/14/11
to pyins...@googlegroups.com
Hi,

> So I was taking a look at this<http://groups.google.com/group/
> pyinstaller/browse_thread/thread/2884993f9b070968> here on cross
> compiling from Linux to Windows.
I'm the one who implemented this feature some time ago. And I'm going to
remove it in the near future, since it does one work half. Please have a
look at
<http://groups.google.com/group/pyinstaller/browse_thread/thread/61067112eb546562>

> Can it work with Wine?
Yes, it works fine with Wine. (In difference to py2exe which did not
work in wine last time I tried.) This is what I'm using now.

One of the benefits is: one can use a shell script to install Python and
everything you need in wine. And after bundling, you can simply delete
the wine directory. So you'll get an test environment quite cheep.

Here are parts of my setup-script:

PYHOME=c:/python25
PYTHON="wine $PYHOME/python.exe"
WINREPO=~/devel/windows-repos # my repository of Windows software

msiexec /q /i $WINREPO/python-2.5.4.msi
cd /tmp
curl http://python-distribute.org/distribute_setup.py | $PYTHON
wine easy_install pip virtualenv
cp -v $WINREPO/mfc71.dll $(winepath -u $PYHOME)/DLLs
wine $WINREPO/pywin32-209.1.win32-py2.5.exe
wine $WINREPO/nsis-*-setup.exe

--
Schönen Gruß - Regards
Hartmut Goebel
Dipl.-Informatiker (univ.), CISSP, CSSLP

Goebel Consult
Spezialist für IT-Sicherheit in komplexen Umgebungen
http://www.goebel-consult.de

Monatliche Kolumne: http://www.cissp-gefluester.de/
Goebel Consult mit Mitglied bei http://www.7-it.de


Hartmut Goebel

unread,
Apr 14, 2011, 12:25:08 PM4/14/11
to pyins...@googlegroups.com
Am 14.04.2011 18:03, schrieb Martin Zibricky:
> one guy uses (or used?) pyinstaller and wine for the following service:
>
> https://www.ohloh.net/p/python-packager
This is an interesting one.

supercheetah

unread,
Apr 14, 2011, 6:32:54 PM4/14/11
to PyInstaller
Since you're taking this feature out, I was trying to write up my own
script to automate this for my project.

#!/bin/bash

PYDIR="c:/Python27"
PYTHON="wine $PYDIR/python.exe"
WINPWD=`winepath -w \`pwd\``

cd pyinstaller

$PYTHON Configure.py
$PYTHON Makespec.py -p $WINPWD $WINPWD/diceroller.py
$PYTHON Build.py diceroller/diceroller.spec

I'm presuming that pywin32 has already been installed under wine
(which it has on my machine). Now I just went ahead and installed the
latest stable version of Python into Wine as well (2.7) and so I'm
using PyInstaller 1.5rc1 as advised for this version of Python in
Windows.

However, it seems that when I compile this for Windows, it doesn't
pull in any of my modules except the script I specify. As soon as my
executable makes a call into one of the other files, it says "'module'
object has no attribute 'othermodulefunction'" as though the
'othermodulefunction' just doesn't exist. It works just fine when I
compile it as a Linux binary though.

Anyone know what could be going on here or some work around?

Rene
On Apr 14, 11:22 am, Hartmut Goebel <h.goe...@goebel-consult.de>
wrote:
> Hi,> So I was taking a look at this<http://groups.google.com/group/
> > pyinstaller/browse_thread/thread/2884993f9b070968>  here on cross
> > compiling from Linux to Windows.
>
> I'm the one who implemented this feature some time ago. And I'm going to
> remove it in the near future, since it does one work half. Please have a
> look at
> <http://groups.google.com/group/pyinstaller/browse_thread/thread/61067...>> Can it work with Wine?
>
> Yes, it works fine with Wine. (In difference to py2exe which did not
> work in wine last time I tried.) This is what I'm using now.
>
> One of the benefits is: one can use a shell script to install Python and
> everything you need in wine. And after bundling, you can simply delete
> the wine directory. So you'll get an test environment quite cheep.
>
> Here are parts of my setup-script:
>
> PYHOME=c:/python25
> PYTHON="wine $PYHOME/python.exe"
> WINREPO=~/devel/windows-repos  # my repository of Windows software
>
> msiexec /q /i $WINREPO/python-2.5.4.msi
> cd /tmp
> curlhttp://python-distribute.org/distribute_setup.py| $PYTHON
> wine easy_install pip virtualenv
> cp -v $WINREPO/mfc71.dll $(winepath -u $PYHOME)/DLLs
> wine $WINREPO/pywin32-209.1.win32-py2.5.exe
> wine $WINREPO/nsis-*-setup.exe
>
> --
> Schönen Gruß - Regards
> Hartmut Goebel
> Dipl.-Informatiker (univ.), CISSP, CSSLP
>
> Goebel Consult
> Spezialist für IT-Sicherheit in komplexen Umgebungenhttp://www.goebel-consult.de
>
> Monatliche Kolumne:http://www.cissp-gefluester.de/
> Goebel Consult mit Mitglied beihttp://www.7-it.de
>
>  smime.p7s
> 6KViewDownload

Hartmut Goebel

unread,
Apr 14, 2011, 6:53:03 PM4/14/11
to pyins...@googlegroups.com
Hi,

> WINPWD=`winepath -w \`pwd\``
You may want to use the $(...) syntax here, which is much easier to read
and to nest:

WINPWD=$(winepath -w $(pwd))

> I'm presuming that pywin32 has already been installed under wine
> (which it has on my machine). Now I just went ahead and installed the
> latest stable version of Python into Wine as well (2.7) and so I'm

Well, you need to install everything into wine that you need for
building your package. If your program requires pywin32, you should
install it for Python 2.7 (pyinstaller does not require pywin32).


> However, it seems that when I compile this for Windows, it doesn't
> pull in any of my modules except the script I specify. As soon as my
> executable makes a call into one of the other files, it says "'module'
> object has no attribute 'othermodulefunction'" as though the
> 'othermodulefunction' just doesn't exist. It works just fine when I
> compile it as a Linux binary though.

Please make sure, your example is working in Unix/Linux, then move
forward to cross-bundling in wine. Try the same software version on both
sides, this helps finding bugs. Esp. use the same version of PyInstaller
in both cases.

HTH

supercheetah

unread,
Apr 15, 2011, 12:02:16 AM4/15/11
to PyInstaller
Actually, I just figured out that it was a problem in my script. I
just figured out there is a name conflict in the Windows version of
Python with one of my modules, namely "parser".
> Spezialist für IT-Sicherheit in komplexen Umgebungenhttp://www.goebel-consult.de
>
> Monatliche Kolumne:http://www.cissp-gefluester.de/
> Goebel Consult mit Mitglied beihttp://www.7-it.de
>
>  smime.p7s
> 6KViewDownload

Hartmut Goebel

unread,
Apr 15, 2011, 3:10:01 AM4/15/11
to pyins...@googlegroups.com
Am 15.04.2011 06:02, schrieb supercheetah:
> Actually, I just figured out that it was a problem in my script. I
> just figured out there is a name conflict in the Windows version of
> Python with one of my modules, namely "parser".

Glad to hear you solved the problem.

This is why I set up a fresh wine environment for each build :-) Wine
can easily change the place whare it looks for your setup, so you do not
destroy you working environment. Take a look at the env-var WINEPREFIX
in the man page

Reply all
Reply to author
Forward
0 new messages