Wednesday, July 20, 2016

Compiling libjingle for Ubuntu - wihtout the pain

Compiling libjingle for Ubuntu


I have spent a good few hours at trying to compile libjingle constantly failing because of one reason or the other. The README on the git doesn't help much except for laying down the foundation of what you have to do. Its more like
" there is a dark forest, and you got to go through it without a night light . After walking a few hundred meters you will encounter something  and after than you will encounter more of those and similar to reach the jingling goodness "

Anyways, I have written down the steps I used to compile libjingle. You can download libjingle from "https://github.com/Ideasrefined/libjingle" or from the official link.

Steps are as follows 


Building LibJingle for Linux

How to Build
Libjingle is built with swtoolkit ( http://code.google.com/p/swtoolkit/), which is a set of extensions to the open-source SCons build tool ( http://www.scons.org).

First, install Python 2.4 or later from http://www.python.org/. Please note that since swtoolkit only works with Python 2.x, you will not be able to use Python 3.x.

Second, install the stand alone scons-local package 2.0.0 or later from http://www.scons.org/download.php and set an environment variable, SCONS_DIR, to point to the directory containing SCons, for example, /src/libjingle/scons-local/scons-local-2.0.0.final.0/.

DONT FORGE TO DO THE FOLLOWING 

in swtoolkit/site_scons/site_init.py , make sure the following lines (450 and 330) resemble these.

Line 330:
SCons.Script.Main._load_site_scons_dir(
    str(SCons.Node.FS.get_default_fs().SConstruct_dir), site_dir)

Line 450:
SCons.Script.Main._load_site_scons_dir(
    str(SCons.Node.FS.get_default_fs().SConstruct_dir), None)
}

Third, install swtoolkit from http://code.google.com/p/swtoolkit/.
(export PATH_TO_SWTOOLKIT= )

Finally, Libjingle depends on two open-source projects, expat and srtp. Download expat from http://sourceforge.net/projects/expat/ to talk/third_party/expat-2.0.1/. Follow the instructions at http://sourceforge.net/projects/srtp/develop to download latest srtp to talk/third_party/srtp. Note that srtp-1.4.4 does not work since it misses the extensions used by Libjingle. If you put expat or srtp in a different directory, you need to edit talk/libjingle.scons correspondingly.
2.1 Build Libjingle under Linux or OS X


First, make sure the SCONS_DIR environment variable is set correctly.
Second, run talk/third_party/expat-2.0.1/configure and talk/third_party/srtp/configure.
Third, go to the talk/ directory and run $path_to_swtoolkit/hammer.sh. Run $path_to_swtoolkit/hammer.sh --help for information on how to build for different modes.
Other than above given steps, See following as reference


Install libasound2-dev Lib to compile libJingle, otherwise you will encounter errors.
sudo apt-get install libasound2-dev

Patching srtp:
comment both of the specified lines in the specified file.
third_party/srtp/srtp/ekt.c line 169  and line 181


Possible components in LibJingle Directory

libjingle-0.5.2/talk/third_party$ ls
expat-2.0.1  libudev  scons-local  srtp  swtoolkit

PATCH
Edit the the file
/talk/base/scoped_ptr.h
find all instances of "type_must_be_complete" and comment this statement

Execute following command to build LibJingle

$PATH_TO_SWTOOLKIT/hammer.sh --mode=dbg expat jingle srtp all_test_programs stunserver relayserver