Using a howto from this site I managed to cross-compile python 2.5.1 for my embedded linux board . Although AXIS provides python 2.4 with their SDK and configures it with no threads and stuff, I compiled the the original python 2.5.1 with only this patch applied to prevent tests from running while cross compiling and to byte-compile python scripts using host’s python compiler.
The patch is heavily based on Chris’, which is heavily based on K’s
I modified only what was need to successfully patch 2.5.1 (Chris’ patch is for 2.5.0)
Here is a small howto to get you going:
Get python
wget http://python.org/ftp/python/2.5.1/Python-2.5.1.tgz
wget http://www.sealabs.net/seadog/files/python-2.5.1-cris.patch
tar zxf Python-2.5.1.tgz
Apply Patch
cd Python-2.5.1
patch < ../python-2.5.1-cris.patch
Now we compile python for our host architecture to get python and Parser/pgen executables. These are needed to byte-compile python during our cross compile procedure.
./configure
make
Save native python and pgen
mv python hostpython
mv Parser/pgen Parser/hostpgen
Clean everything up
make clean
Now we are ready to cross-compile!
If you have downloaded Acme criss-gcc debian package, don’t forget to add /usr/local/cris/bin to PATH
export PATH="/usr/local/cris/bin:$PATH"
Set enviroment variables
export HOST="cris-axis-linux-gnu"
export CC=" gcc-cris -mlinux -mno-mul-bug-workaround"
export CXX=$(CC)
export LN=” ln”
export RM=” rm -f”
export AR=” ar-cris”
export INSTALL=” install_elinux -p”
export LD=” ld-cris -mcrislinux”
export OBJCOPY=” objcopy-cris”
export RANLIB=” ranlib-cris”
export STRIP=” strip-cris”
export OPT=”-Os”
export CFLAGS=”-Wall -Wshadow -g”
export LDFLAGS=”-fPIC”
export HOSTPYTHON=./hostpython
export HOSTPGEN=./Parser/hostpgen
export CROSS_COMPILE=yes
Configure
./configure --host=$HOST --prefix=/tmp/cris-python --build=`uname -m`-pc-linux-gnu
Make and install respecting enviroment variables
make -e
make -e install
Now check if you can run your cross compiled binary /tmp/cris-python/bin/python. (You shouldn’t!)
seadog@plu:~/Projects/fox/cris-binary/python/bin$ ./python
bash: ./python: cannot execute binary file
Dada! You have a cross-compiled binary!
I also cross compiled twisted python 2.5.0 and pyxml 0.8.
You just untar and execute (python is native binary)
python -E setup.py install --prefix=../cris-python --install-scripts=/tmp/cris-python/bin
I have a bazaar repository with binary python here http://www.sealabs.net/cris/cris-binary which you can checkout using
bzr checkout http://www.sealabs.net/cris/cris-binary
And now my jabber bots can run on my fox board!

