User Tools

Site Tools

A PCRE internal error occured. This might be caused by a faulty plugin

python-install

The Python binding is available for both Python2 (tested with version 2.7 only) and Python3 (tested with version 3.4). Instructions depend on the Python version. ======== Build and install the Python 2 binding of the ROHC library from sources ======== The instructions hereafter are for native build on Unix-like systems, such as [[wp>Linux|Linux]], [[wp>FreeBSD]], or [[wp>OpenBSD]]. - Log in as normal user on the system on which you want to install the Python binding of the ROHC library. - [[library-install-sources|Build and install of the ROHC library]] from sources. - Install the swig dependency:<code> $ su # yum install swig # for RHEL/CentOS # apt-get install swig # for Debian/Ubuntu # emerge -av swig # for Gentoo # exit</code> - Install the Python dependencies:<code> $ su # pip2 install future # exit</code> - Build the Python binding:<code> $ cd contrib/python/ $ python2 setup.py build</code> - Install the Python binding:<code> $ su # python2 setup.py install # exit</code> The Python2 binding of the ROHC library is installed, you may now [[python-usage|use it]]. ======== Build and install the Python 3 binding of the ROHC library from sources ======== The instructions hereafter are for native build on Unix-like systems, such as [[wp>Linux|Linux]], [[wp>FreeBSD]], or [[wp>OpenBSD]]. - Log in as normal user on the system on which you want to install the Python binding of the ROHC library. - [[library-install-sources|Build and install of the ROHC library]] from sources. - Install the swig dependency:<code> $ su # yum install swig # for RHEL/CentOS # apt-get install swig # for Debian/Ubuntu # emerge -av swig # for Gentoo # exit</code> - Install the Python dependencies:<code> $ su # pip3 install future # exit</code> - Build the Python binding:<code> $ cd contrib/python/ $ python3 setup.py build</code> - Install the Python binding:<code> $ su # python3 setup.py install # exit</code> 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 17:55 by didier