Cross Compiler for Python?

Dan Upton upton at virginia.edu
Mon Jul 7 14:02:55 CEST 2008


On Mon, Jul 7, 2008 at 4:15 AM, Hendrik van Rooyen <mail at microcorp.co.za> 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?
>

If you don't have a 32 bit system to build it on, you could always set
up a VMWare machine... but that might be more effort than necessary.
You can probably just run configure on your normal machine and then
edit the makefile to add -m32 to the compiler or linker flags--that
will force gcc to generate 32-bit code.  You'd have to copy the files
over and get the paths right yourself though.  Alternately, if you can
mount the eBox somewhere in Linux, you should be able to do configure
--prefix=/path/to/eBox/mount and then make install will work for you
too.

(I haven't tried this before, but that's how I'd go about it.)



More information about the Python-list mailing list