Cross Compiling Py - nodesign/weio GitHub Wiki

Method for Cross-compiling Python Packages for WeIO

Based on this:

We have added a script here: https://github.com/nodesign/openwrt/tree/weio/pyPkg to do automatic cross-compilations.

Usage:

  • Go to the dir
cd /home/drasko/openwrt/pyPkg
  • Get the Python package
drasko@Lenin:~/openwrt/pyPkg$ pip install pyephem --download="."
  • Untar it for build
drasko@Lenin:~/openwrt/pyPkg$ tar -xzvf pyephem-3.7.5.3.tar.gz
  • Prepare build environment
drasko@Lenin:~/openwrt/pyPkg$ source setEnvPy.sh
  • Build
drasko@Lenin:~/openwrt/pyPkg$ ./buildPyPkg pyephem-3.7.5.3
  • Take egg from /dist
drasko@Lenin:~/openwrt/pyPkg/pyephem-3.7.5.3/dist$ pwd
/home/drasko/openwrt/pyPkg/pyephem-3.7.5.3/dist
drasko@Lenin:~/openwrt/pyPkg/pyephem-3.7.5.3/dist$ ls
pyephem-3.7.5.3-py2.7-linux-mips.egg
  • Put it on the board (for example via SD card or USB key), and install it:
root@WEIO:/# easy_install /weioUser/sd/pyephem-3.7.5.3-py2.7-linux-mips.egg 
Processing pyephem-3.7.5.3-py2.7-linux-mips.egg
creating /usr/lib/python2.7/site-packages/pyephem-3.7.5.3-py2.7-linux-mips.egg
Extracting pyephem-3.7.5.3-py2.7-linux-mips.egg to /usr/lib/python2.7/site-packages
Adding pyephem 3.7.5.3 to easy-install.pth file

Installed /usr/lib/python2.7/site-packages/pyephem-3.7.5.3-py2.7-linux-mips.egg
Processing dependencies for pyephem==3.7.5.3
Finished processing dependencies for pyephem==3.7.5.3
root@WEIO:/#

Setup for Ubuntu

In order to cross-compile a package on Ubuntu, several packages must be installed

sudo apt-get install build-essential
sudo apt-get install python-setuptools
sudo easy_install distribute
sudo easy_install distutilscross
sudo apt-get install python-dev