Cross compiling 32 bit application from a 64 bit Windows

9,064 views
Skip to first unread message
Message has been deleted

Andy

unread,
Oct 26, 2010, 12:04:51 AM10/26/10
to PyInstaller
Hi Guys!

I've got a new computer which has the 64-bit version of Windows 7. In
it I installed the 64-bit versions of Python, wxPython, and MySQLdb
too. With them I made a couple of applications that compile
beautifully with PyInstaller (http://www.pyinstaller.org/ticket/25).
Thanks to all involved.

The problem is that most of the people to whom I'd be giving copies of
my compiled programs use 32-bit versions of Windows. I already tried,
and sure enough, programs compiled in my 64-bit machine don't run in
32-bit machines. Is there a way to compile with PyInstaller 32-bit
applications from a 64-bit computer?

Thanks,
Andy

Daniel Hyams

unread,
Oct 26, 2010, 12:04:52 AM10/26/10
to pyins...@googlegroups.com
Sure, just install the 32-bit versions of python/wxpython/etc, and have at it.  I do exactly this
from a Windows 7 machine.

On Mon, Oct 25, 2010 at 11:59 PM, Andy <fuka...@gmail.com> wrote:
Hi Guys!

I've got a new computer which has the 64-bit version of Windows 7.  In
it I installed the 64-bit versions of Python, wxPython, and MySQLdb
too.  With them I made a couple of applications that compile
beautifully with PyInstaller (http://www.pyinstaller.org/ticket/25).
Thanks to all involved.

My problem is that most of the people to whom I'd be giving copies of

my compiled programs use 32-bit versions of Windows.  I already tried,
and sure enough, my programs compiled in my 64-bit machine don't run

in 32-bit machines.

Is there a way to compile with PyInstaller 32-bit applications from a
64-bit computer?

Thanks,
Andy

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To post to this group, send email to pyins...@googlegroups.com.
To unsubscribe from this group, send email to pyinstaller...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pyinstaller?hl=en.




--
Daniel Hyams
dhy...@gmail.com

Andy

unread,
Oct 26, 2010, 12:26:44 AM10/26/10
to PyInstaller
Thanks Daniel,

I guess I can install a second set of Python and libraries like you
suggest. But I was thinking more of something in the lines of using a
PyInstaller command line option or something of that sort.

Cheers,
Andy

On Oct 25, 9:04 pm, Daniel Hyams <dhy...@gmail.com> wrote:
> Sure, just install the 32-bit versions of python/wxpython/etc, and have at
> it.  I do exactly this
> from a Windows 7 machine.
>
>
>
>
>
>
>
>
>
> On Mon, Oct 25, 2010 at 11:59 PM, Andy <fukaz...@gmail.com> wrote:
> > Hi Guys!
>
> > I've got a new computer which has the 64-bit version of Windows 7.  In
> > it I installed the 64-bit versions of Python, wxPython, and MySQLdb
> > too.  With them I made a couple of applications that compile
> > beautifully with PyInstaller (http://www.pyinstaller.org/ticket/25).
> > Thanks to all involved.
>
> > My problem is that most of the people to whom I'd be giving copies of
> > my compiled programs use 32-bit versions of Windows.  I already tried,
> > and sure enough, my programs compiled in my 64-bit machine don't run
> > in 32-bit machines.
>
> > Is there a way to compile with PyInstaller 32-bit applications from a
> > 64-bit computer?
>
> > Thanks,
> > Andy
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "PyInstaller" group.
> > To post to this group, send email to pyins...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > pyinstaller...@googlegroups.com<pyinstaller%2Bunsubscribe@googlegr oups.com>
> > .

Daniel Hyams

unread,
Oct 26, 2010, 8:15:29 AM10/26/10
to pyins...@googlegroups.com
No, that's not the way pyinstaller works.  It basically searches the tree of dependencies, and packages the files up into one place for you.  So you at least have to have all of your dependencies present for it to do so.

I believe all you'll have to do is install all of the 32-bit versions of things, and when you run your Configure.py and Build.py scripts, make sure you run then with the 32-bit version of Python.  That should be it.

To unsubscribe from this group, send email to pyinstaller...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/pyinstaller?hl=en.




--
Daniel Hyams
dhy...@gmail.com

Andy

unread,
Oct 26, 2010, 10:26:41 AM10/26/10
to PyInstaller
Thanks for the clarification Daniel!

Andy

ragini dahihande

unread,
Dec 29, 2016, 1:20:45 AM12/29/16
to PyInstaller
Hello Guy,

I have one doubt.
If I have 64 bit of windows machine and I installed 32 bit python on that system.
If I create exe by PyInstaller that exe can be executed on 32 bit Windows ?

Mean for 32 bit windows exe no need to run project on 32 bit windows.
Using only 32 bit python we can create it.

Am I correct?

Thanks,
Ragini

Steve Barnes

unread,
Dec 29, 2016, 2:03:04 AM12/29/16
to pyins...@googlegroups.com


On 29/12/2016 06:20, ragini dahihande wrote:
> Hello Guy,
>
> I have one doubt.
> If I have 64 bit of windows machine and I installed 32 bit python on
> that system.
> If I create exe by PyInstaller that exe can be executed on 32 bit Windows ?
>
> Mean for 32 bit windows exe no need to run project on 32 bit windows.
> Using only 32 bit python we can create it.
>
> Am I correct?
>
> Thanks,
> Ragini
>

Yes you are.

For several years now I have been using a Windows 7 64 bit machine to
build python based code that runs on Windows 32 bit machines elsewhere -
All I do is to use the 32 bit version of python to do it. The only
major issue I have is that some of the machines still run XP and the
last version of python to support XP is 3.4 but hopefully we will
eventually replace the XP machines.

--
Steve (Gadget) Barnes
Any opinions in this message are my personal opinions and do not reflect
those of my employer.

davecortesi

unread,
Dec 29, 2016, 10:52:34 AM12/29/16
to PyInstaller

 For several years now I have been using a Windows 7 64 bit machine to
build python based code that runs on Windows 32 bit machines elsewhere -
All I do is to use the 32 bit version of python to do it.

It's good that works but you really should not count on it. The manual is specific about not being a "cross-compiler" and says if you want to bundle for a specific OS you need to run on that OS. My point being, if it ever breaks, you won't get a fix.

Steve Barnes

unread,
Dec 29, 2016, 11:59:16 AM12/29/16
to pyins...@googlegroups.com
Building 32 bit Windows Python Applications on a 64 bit platform is not
cross compiling when you are running 32 bit python on that platform - 32
bit Python under Windows runs with exactly the same instruction set and
memory model regardless of running on Windows 64 bit or 32 bit.

pyInstaller, (or py2exe or cxFreeze), embed the local copy of python,
and the required libraries, into the created package and the 32 bit
windows python installation is the same regardless of being installed on
a 32 bit or 64 bit machine. What you cannot do is deploy applications
built with 64 bit Windows python, (and it's libraries), on 32 bit
Windows machines. Needless say 32 bit deployments can also run on 64 bit
machines but it is a very good idea to run your tests using the exact
same version(s) of python that you are going to deploy with.

If you are even slightly worried you can build & test in a virtual
machine under vagrant or virtualbox, test VMs can be found at
https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/ you just
have to install python and the libraries that you need before your test
& build.

Coyot Linden (Glenn Glazer)

unread,
Mar 13, 2017, 7:50:23 PM3/13/17
to pyins...@googlegroups.com, Oz Linden (Scott Lawrence)
Based on this thread, we tried to solve a problem:

Right now, all of our software clients are 32 bit C++ executables, but we are making the migration to 64 bit for those that have 64 bit systems.  Since we don't know on first download of an updated client whether the client host is 32 or 64, we wanted to download a 32 bit version of the our python shim which would then detect the correct bitness and ask our servers for the right thing.

Unfortunately we seem to be running into problems with this scheme.   On a 64bit host, we have both 32 and 64 bit python and pyinstaller installed.  Using the 32 bit version, we compiled our scripts and got "Failed to execute script" when we ran them. 

I then wrote a hello world script (e.g., just the shebang and the print) and while python hello_world.py works, hello_world.exe just exits with no output.

Suggestions on how to solve this welcome.

Best,

coyot
GLENN GLAZER | Senior Software Engineer
m:
562.305.2920 | email:  co...@lindenlab.com | Second Life: Coyot Linden
LINDEN LAB | Create Virtual Experiences

Coyot Linden (Glenn Glazer)

unread,
Mar 14, 2017, 11:03:16 AM3/14/17
to pyins...@googlegroups.com, Oz Linden (Scott Lawrence)
On 3/13/17 16:50, Coyot Linden (Glenn Glazer) wrote:
Based on this thread, we tried to solve a problem:

Right now, all of our software clients are 32 bit C++ executables, but we are making the migration to 64 bit for those that have 64 bit systems.  Since we don't know on first download of an updated client whether the client host is 32 or 64, we wanted to download a 32 bit version of the our python shim which would then detect the correct bitness and ask our servers for the right thing.

Unfortunately we seem to be running into problems with this scheme.   On a 64bit host, we have both 32 and 64 bit python and pyinstaller installed.  Using the 32 bit version, we compiled our scripts and got "Failed to execute script" when we ran them. 

I then wrote a hello world script (e.g., just the shebang and the print) and while python hello_world.py works, hello_world.exe just exits with no output.

Suggestions on how to solve this welcome.

Best,

coyot
GLENN GLAZER | Senior Software Engineer
m:
562.305.2920 | email:  co...@lindenlab.com | Second Life: Coyot Linden
LINDEN LAB | Create Virtual Experiences


Update on this.  It turns out that the bitness was a false trail.  After a great deal of work late into last night, we discovered that the same python code, built by the same machine with the same python works completely correctly as an exe if the -w is left off and fails completely if it does.  This is true of both hello world (which outputs nothing) and our shim (which causes the failed to execute window).

The unfortunate part of this discovery is that the console window does pop up for awhile prior to the actual executable starting.  This is aesthetically unpleasing but certainly better than not functioning at all.

Again, suggestions are welcome.

Hartmut Goebel

unread,
Mar 14, 2017, 12:21:19 PM3/14/17
to pyins...@googlegroups.com
Am 14.03.2017 um 16:03 schrieb Coyot Linden (Glenn Glazer):
Again, suggestions are welcome.
A pull-request related to this is wellcome, too :-)

--
Schönen Gruß
Hartmut Goebel
Dipl.-Informatiker (univ), CISSP, CSSLP, ISO 27001 Lead Implementer
Information Security Management, Security Governance, Secure Software Development

Goebel Consult, Landshut
http://www.goebel-consult.de

Blog: http://www.goebel-consult.de/blog/35.000-gegen-vorratdatenspeicherung
Kolumne: http://www.cissp-gefluester.de/2012-09-steht-ein-manta-fahrer-vor-der-uni

0xBF773B65.asc

Steve Barnes

unread,
Mar 14, 2017, 3:10:09 PM3/14/17
to pyins...@googlegroups.com

[Snip]
>
> The unfortunate part of this discovery is that the console window does
> pop up for awhile prior to the actual executable starting. This is
> aesthetically unpleasing but certainly better than not functioning at all.
>
> Again, suggestions are welcome.
>
> Best,
>
> coyot

It would be worth trying the same script, on the same machine, with
pythonw script_name.py

It is possible that your pythonw executable is missing or broken.
Reply all
Reply to author
Forward
0 new messages