Cross platform compilation?

J

John Harper

I am trying to build Python to use in an embedded system which uses a
ppc_440 CPU. The only information I've found is something written by
Klaus Reimer a few years ago, which was based on Python 2.2. So far I
seem to have successfully built Python itself, but building the
extensions fails miserably with complaints about library format. It
insists on referring to "i686" which is indeed the platform it is
actually running on.

Before I try to reverse engineer completely setup.py, is there
something obvious that needs to be done to get it to use the right tool
chain?

More generally, it seems like this would be something that lots of
people would want to do. I'm surprised there isn't support for it built
into the distributed version of Python, without having to hack all the
setup files...?

Thanks,

John
 
M

Miki

I am trying to build Python to use in an embedded system which uses a
ppc_440 CPU. The only information I've found is something written by
Klaus Reimer a few years ago, which was based on Python 2.2. So far I
seem to have successfully built Python itself, but building the
extensions fails miserably with complaints about library format. It
insists on referring to "i686" which is indeed the platform it is
actually running on.

Before I try to reverse engineer completely setup.py, is there
something obvious that needs to be done to get it to use the right tool
chain?

More generally, it seems like this would be something that lots of
people would want to do. I'm surprised there isn't support for it built
into the distributed version of Python, without having to hack all the
setup files...?
Maybe http://www.ailis.de/~k/archives/19-ARM-cross-compiling-howto.html
could help?

HTH,
 
D

David Boddie

Before I try to reverse engineer completely setup.py, is there
something obvious that needs to be done to get it to use the right tool
chain?

I think it's more complicated than that, though in an ideal world it
wouldn't have to be that way.

I created some patches for Python 2.4.4 a while ago to make it slightly
easier to cross-compile it:

http://chaos.troll.no/~dboddie/Python/Greenphone/

There were patches to solve similar issues with the build system floating
around in the Python bug tracker. I had intended to help push those along
a bit, but lack of time prevented me from doing so.

The magic incantation that worked for me was this:

export HOST_PLATFORM=i386
export TARGET_TOOLS=$SOME_DIR/gcc-4.1.1-glibc-2.3.6/arm-linux/bin
export TARGET_PLATFORM=arm-linux

CC=$TARGET_TOOLS/$TARGET_PLATFORM-gcc \
CXX=$TARGET_TOOLS/$TARGET_PLATFORM-g++ \
./configure --prefix=$TARGETDIR --enable-shared --enable-unicode=ucs4 \
--build=$TARGET_PLATFORM --host=$HOST_PLATFORM

where SOME_DIR and TARGETDIR are appropriately set, of course. I did
experience issues with some extension modules, though.
More generally, it seems like this would be something that lots of
people would want to do. I'm surprised there isn't support for it built
into the distributed version of Python, without having to hack all the
setup files...?

I suppose people don't explicitly configure projects for cross-compilation
anymore, especially now that things like Scratchbox are used to fake the
build environment:

http://www.scratchbox.org/

That might also be worth looking at, but you really have to buy in to its
way of working to use it fully, in my experience.

David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top