Join Today
+ Reply to Thread
Results 1 to 6 of 6
Like Tree2Likes
  • 1 Post By dsydsy
  • 1 Post By BruceLee

Thread: Building python interpreter.

  1. #1

    Default Building python interpreter.

    == How to crosscompile python for arm-linux ==

    I will assume you have a working toolchain for crosscompilation of arm binary
    for ezx platform, if not you can use the one on
    http://lsb.blogdns.net/software and you can use the patch posted here:
    http://www.motorolafans.com/index.ph...wnload&id=1244 to fix an issue that can lead to a broken limits.h

    My toolchain is built in this directory:
    ~/EZX/crosstools/ezx-crosstool-0.5/gcc-arm-iwmmxt/gcc-3.3.6-glibc-2.3.2/arm-linux
    so maybe you have to replace this location appropriately in the proceeding text.

    Following there is a step-by-step guido to have our beloved python interpreter
    running on our phones. ("guido" is a funny typo here, he he)

    NOTE: when you see a \ at the end of the line you are in front of a multiline
    command, so paste the following line, too.


    === Step by step

    Python official distribution does not support yet crosscompilation, so we have
    to apply a patch to the source.

    1. Get the official source:
    wget http://www.python.org/ftp/python/2.4.3/Python-2.4.3.tgz

    2. Download the patch for crosscompiling:
    wget "http://sourceforge.net/tracker/download.php?group_id=5470&atid=305470&file_id=97061&aid=1006238" -O python-patch.diff

    3. Extract the tarball and apply the patch:
    tar xzvf Python-2.4.3.tgz
    cd Python-2.4.3
    cat ../python-patch.diff | patch -p3

    4. Rerun autoconf, since the patch touches configure.in
    autoconf configure.in > configure

    5. Configure python, but being in a directory parallel to the
    extracted distribution. remembering to have the toolchain binaries in the
    PATH:
    cd ..
    mkdir crossbuild-py2.4
    cd crossbuild-py2.4

    PATH=$PATH:~/EZX/crosstools/ezx-crosstool-0.5/gcc-arm-iwmmxt/gcc-3.3.6-glibc-2.3.2/arm-linux/bin \
    ../Python-2.4.3/configure --host=arm-linux

    6. Build python:
    PATH=$PATH:~/EZX/crosstools/ezx-crosstool-0.5/gcc-arm-iwmmxt/gcc-3.3.6-glibc-2.3.2/arm-linux/bin \
    make

    7. Installing, I use /opt/python-2.4 for instance:
    PATH=$PATH:~/EZX/crosstools/ezx-crosstool-0.5/gcc-arm-iwmmxt/gcc-3.3.6-glibc-2.3.2/arm-linux/bin \
    make install prefix=/opt/python-2.4

    8. Strip binaries so to save some space:
    PATH=$PATH:~/EZX/crosstools/ezx-crosstool-0.5/gcc-arm-iwmmxt/gcc-3.3.6-glibc-2.3.2/arm-linux/bin \
    find /opt/python-2.4 -name "*.so" -or -name "python" -or -type f -name "lib*" -exec arm-linux-strip {} \;

    9. Copy the files in /opt/python-2.4 on the phone with your preferred method.
    I use to mount the "system" share via samba so i have access directly to the
    / mount point.

    10. Test that it actually works, after telnetting to the phone:
    # ./python
    Could not find platform dependent libraries <exec_prefix>
    Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
    Python 2.4.3 (#1, Apr 5 2006, 20:09:52)
    [GCC 3.3.6] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import os
    >>> os.uname()
    ('Linux', '(none)', '2.4.20_mvlcee30-mainstone', '#1 Jan 1,2003', 'armv5tel')
    >>>


    That's all, for now.


    === Problems ===

    - The installation size is quite big even after stripping binaries, how to build
    and install a minimal python distribution?

    - There are problems building the zlib module, maybe because I do not have a
    crosscompiled zlib?
    Attached Files Attached Files
    ustrucx likes this.

  2. #2

    Default Re: Building python interpreter.

    Now, imagine if we could have python bindings for EZX toolkit...

  3. #3

    Default

    hi!
    @dsydsy, any news on this?

  4. #4
    Join Date
    Aug 2008
    Location
    Colombia
    Posts
    13

    Default

    wonderfl

  5. #5
    Join Date
    Jan 2008
    Location
    Romania
    Posts
    785

    Default

    @latino18hvm
    If you're interested in a python interpreter you can try scribi. It's an interpreter collection:
    LINK

    screen:
    Last edited by BruceLee; 08-29-2008 at 05:59 PM.
    latino18hvm likes this.

  6. #6
    Join Date
    Aug 2008
    Location
    Colombia
    Posts
    13

    Default

    yes, thanks for the link
    thanks thanks thanks


 
+ Reply to Thread

Similar Threads

  1. Python
    By trip0d in forum Motorola ZINE ZN5
    Replies: 2
    Last Post: 04-09-2010, 05:48 PM
  2. building qtopia from source
    By muromec in forum Qt Extended
    Replies: 0
    Last Post: 02-14-2009, 02:06 PM
  3. How I Can Install Python or Perl in A1200
    By KASRA in forum A1200 General Chat
    Replies: 23
    Last Post: 01-04-2009, 10:35 AM
  4. Need help with building theme
    By JA_SAM in forum Moto Skins Technical Forum
    Replies: 4
    Last Post: 10-02-2008, 12:55 AM
  5. Python 2.4.3 for A780
    By trbs in forum A780 Applications
    Replies: 3
    Last Post: 05-24-2007, 01:19 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Single Sign On provided by vBSSO

Search Engine Optimization by vBSEO 3.6.0 RC 1