Cross Compiler for Python?

Diez B. Roggisch deets at nospam.web.de
Mon Jul 7 07:55:14 EDT 2008


Hendrik van Rooyen wrote:

> Up to now, I have been innocently using the vanilla python
> that comes with the Linux distribution (Suse in my case).
> 
> For the past few days, I have been playing with a little
> device called an eBox - it is basically a 486 with 128Mb
> memory, and a 1Gig pcmcia flash drive.
> 
> We want to try to use this as an industrial controller, so
> I want to load python onto it.
> 
> So I downloaded the sources, and got them into the box,
> over its ethernet connection.
> 
> Then I got stymied - the configure script will not run,
> because the "distribution" has no C compiler - it is
> basically a kernel, and Busybox, with precious little else.
> 
> So I googled, and I found mobile python, and portable python,
> both aimed at windows. - no good to me.
> 
> Adding "embedded" to the Google string is also useless,
> as it basically brings up instances of embedding the
> interpreter into another app, not for small processors.
> 
> So how does one do a compile of python on one machine
> aimed at another one?  - All I want is a vanilla installation
> with the stuff in all the usual places.  And just to make matters
> interesting, the two Linux boxes I have available are both
> 64 bit dual core animals, one Intel, one AMD...
> 
> I don't need much more than the interpreter, sys, os, sockets
> and ctypes.
> 
> Alternatively, where can one find a set of binaries for
> 32 bit Linux?
> 
> Looking for some sane advice please.

Look at the gumstix project, they do have a cross-compiled python in there.
You should be able to get an idea on how to do that yourself.

It involves (or at least did back then) a bit of trickery as the
build-process of python uses the freshly created interpreter to pre-compile
modules. But it is possible.

Diez



More information about the Python-list mailing list