Building PJSUA2
The PJSUA2 C++ library is built by default by PJSIP build system. Standard C++ library is required.
The following sections applies to building SWIG Python, Java, or C# modules.
Common Requirements
On Linux/MacOS X/Unix, you need to build PJPROJECT with
-fPIC
option. You can either put it inuser.mak
file in root pjproject directory like this:export CFLAGS += -fPIC
or you can specify it when calling ./configure:
./configure CFLAGS="-fPIC"
Then rebuild pjproject.
Install SWIG
For Debian based distributions (such as Ubuntu):
sudo apt-get install swig
For Windows and other platforms please see https://www.swig.org/download.html
Building Python SWIG Module
Install SWIG as shown above, and Python development package:
For Debian based distributions (such as Ubuntu):
sudo apt-get install swig python3-dev
For Windows (on MinGW/MinGW-w64 + MSYS2):
pacman -S swig python python-setuptools
Note
Make sure there’s no existing Python installation to avoid conflicts
Build:
cd pjsip-apps/src/swig/python make make install
Note
The above will install the module to user’s
site-packages
directory.If you’re currently on a virtualenv, run
python setup.py install
instead.For Windows, you need to use GNU tools, e.g: MinGW/MinGW-w64, and follow the above instructions to build PJSIP on Unix. Note that some video features may not work such as DirectShow renderer.
Test the installation:
$ python3 > import pjsua2 > ^Z
Building Java SWIG Module
Install SWIG as shown above.
Install JDK.
Build:
cd pjsip-apps/src/swig/java make make install
TBD.
Building C# SWIG Module
See ticket #2086 (Add C# binding using SWIG, and support for Xamarin).
For Windows, check: #3217 (Add two VS2015 projects for CSharp: SWIG binding builder & sample app).