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.
The instructions hereafter are for native build on Unix-like systems, such as Linux, FreeBSD, or OpenBSD.
$ su # yum install swig # for RHEL/CentOS # apt-get install swig # for Debian/Ubuntu # emerge -av swig # for Gentoo # exit
$ su # pip2 install future # exit
$ cd contrib/python/ $ python2 setup.py build
$ su # python2 setup.py install # exit
The Python2 binding of the ROHC library is installed, you may now use it.
The instructions hereafter are for native build on Unix-like systems, such as Linux, FreeBSD, or OpenBSD.
$ su # yum install swig # for RHEL/CentOS # apt-get install swig # for Debian/Ubuntu # emerge -av swig # for Gentoo # exit
$ su # pip3 install future # exit
$ cd contrib/python/ $ python3 setup.py build
$ su # python3 setup.py install # exit
The Python3 binding of the ROHC library is installed, you may now use it.
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.
$ su # emerge -av swig # exit
$ 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
Run within Qemu with:
$ 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