User Tools

Site Tools


python-install

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

python-install [2016/01/11 20:45]
didier created
python-install [2016/07/03 19:55] (current)
didier add cross-compiling instructions
Line 53: Line 53:
 The Python3 binding of the ROHC library is installed, you may now [[python-usage|use it]]. The Python3 binding of the ROHC library is installed, you may now [[python-usage|use it]].
  
 +
 +======== Cross-compiling the Python 3 binding of the ROHC library from sources ========
 +
 +The instructions hereafter are for cross-compilation build on Unix-like systems. The instructions were tested on Gentoo Linux, please adapt them to your system when needed.
 +
 +  - Log in as normal user on the system on which you want to build the Python binding of the ROHC library.
 +  - [[library-install-sources#​cross-compilation_for_arm_powerpc_on_unix-like_systems|Cross-compile the ROHC library]] from sources for your target.
 +  - Install the swig dependency:<​code>​
 +$ su
 +# emerge -av swig
 +# exit</​code>​
 +  - Build the Python binding:<​code>​
 +$ cd contrib/​python/​
 +$ CC='​arm-softfloat-linux-gnueabi-gcc -pthread'​ \
 +  CFLAGS='​-I/​usr/​arm-softfloat-linux-gnueabi/​usr/​include/​python3.5m/'​ \
 +  LDSHARED='​arm-softfloat-linux-gnueabi-gcc -shared'​ \
 +  LDFLAGS='​-L/​usr/​arm-softfloat-linux-gnueabi/​usr/​lib/'​ \
 +    python3.5 setup.py build
 +$ # change arch in the library name
 +$ ln -s _rohc.cpython-35m-x86_64-linux-gnu.so \
 +        build/​lib.linux-x86_64-3.5/​_rohc.cpython-35m-arm-linux-gnueabi.so
 +</​code>​
 +
 +Run within Qemu with:<​code>​
 +$ PYTHONPATH=/​usr/​arm-softfloat-linux-gnueabi/​usr/​lib64/​python3.5/​site-packages/:​build/​lib.linux-x86_64-3.5/​ \
 +    qemu-arm -B 1048576 \
 +      /​usr/​arm-softfloat-linux-gnueabi/​lib/​ld-linux.so.3 \
 +        --library-path /​usr/​arm-softfloat-linux-gnueabi/​lib:/​usr/​arm-softfloat-linux-gnueabi/​usr/​lib:/​usr/​lib/​gcc/​arm-softfloat-linux-gnueabi/​6.1.0:​../​../​src/​.libs/:​build/​lib.linux-x86_64-3.5/​ \
 +        /​usr/​arm-softfloat-linux-gnueabi/​usr/​bin/​python3.5 ./​example.py 5
 +</​code>​
python-install.txt · Last modified: 2016/07/03 19:55 by didier