Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion Compiling and running python for android
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Marcelo Barros de Almeida  
View profile  
 More options Nov 20 2007, 7:52 pm
From: Marcelo Barros de Almeida <marcelobarrosalme...@gmail.com>
Date: Tue, 20 Nov 2007 16:52:57 -0800 (PST)
Local: Tues, Nov 20 2007 7:52 pm
Subject: Compiling and running python for android
Hi,

I have cross-compiled python 2.5 for ARM and copied it into android
emulator (see instructions below). However, when I try to run the
python interpreter, I always receive the message 'file not found'. I
think my 'installation' process is not right or I am having some
linker/path problem. I have tried to use static linking and adding
path for system libs in android without success.

Could anyone help me with this issue ? Instruction for compiling
python are below.
It is a modified version of compiling instructions found in 5.1, 5.2
and 5.3 (see references at the end).

0) Downloading arm compiler

I am using an ARM GNU/Linux toolchain, downloaded from:
http://www.codesourcery.com/gnu_toolchains/arm/download.html

I have installed the toolchain in:
/home/marcelo/toolchain/

1) Downloading sources and applying patches (see reference 5.1 at the
end)

mkdir ~/temp
cd ~/temp
wget http://www.python.org/ftp/python/2.5/Python-2.5.tar.bz2
wget http://whatschrisdoing.com/~lambacck/Python2.5_xcompile.patch
tar xvjf Python-2.5.tar.bz2
cd Python-2.5/
patch -p1 < ../python/Python2.5_xcompile.patch

2) Compiling python. There are some tricks for cross-compiling (see
references).
Change paths when necessary (like /home/marcelo or compiler path). gcc
-v can
provide you the value for --build parameter.

./configure
make python Parser/pgen
mv python hostpython
mv Parser/pgen Parser/hostpgen
make distclean

export PATH=/home/marcelo/toolchain/arm-2007q3/bin/:$PATH

make HOSTPYTHON=./hostpython HOSTPGEN=./Parser/hostpgen BLDSHARED="arm-
none-linux-gnueabi-gcc -static" CROSS_COMPILE=yes

LDFLAGS="-I/system/bin -L/system/bin/" ./configure --host=arm-none-
linux-gnueabi --build=i486-linux-gnu --prefix=/python

make HOSTPYTHON=./hostpython HOSTPGEN=./Parser/hostpgen BLDSHARED="arm-
none-linux-gnueabi-gcc -static" CROSS_COMPILE=yes

3) Local install (take care of paths)

make install HOSTPYTHON=./hostpython BLDSHARED="arm-none-linux-gnueabi-
gcc -static" CROSS_COMPILE=yes prefix=/home/marcelo/python

4) Android emulator install (trying to use the same path)

- Inside emulator shell, create the install dir /home/marcelo/python
(run emulator with <android_sdk_path>/tools/emulator -console and use
mkdir)
- using adb in a host shell, copy python:
<android_sdk_path>/tools/adb push /home/marcelo/python/ /home/marcelo/
python/
- try to execute it to see the error (/home/marcelo/python/bin/python)

5) references

5.1) http://whatschrisdoing.com/blog/2006/10/06/howto-cross-compile-python...
5.2) http://avr32linux.org/twiki/bin/view/Main/Python
5.3) http://www.cibomahto.com/?p=82


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google