Thursday, September 06, 2007

Compiling libjingle on Ubuntu Feisty Fawn or Ubuntu Gutsy Gibbon

My first compilation was on Ubuntu 7.04 installed on VMware as guest and i was testing it with Win XP Pro as the host. libjingle worked great for me.

I followed the links given below to compile libjingle on Ubuntu 7.04 (Feisty Fawn)

http://groups.google.com/group/google-talk-open/browse_thread/thread/bf92d054c144f167

http://www.francisrobichaud.com/index.php/2007/05/22/guide-to-compiling-libjingle-040/

  1. First install all the build tools.

    sudo apt-get install build-essential


  2. Install all the dependencies.

    sudo apt-get install libexpat1 libexpat1-dev libspeex1 libspeex-dev libssl-dev openssl
    sudo apt-get install libasound2-dev

    This step is important, otherwise libjingle make would give an error when you want to compile with speex.


  3. Download and install the following packages

Now download the libjingle from Google Code

libjingle-0.4.0

tar zxf libjingle-0.4.0.tar.gz
sudo mkdir /opt/libjingle
cd libjingle-0.4.0
./configure --prefix=/opt/libjingle

The output you get would be like this:

libjingle 0.4.0


Supported Examples: call pcp
Supported Codecs:
Speex: yes
iLBC: yes
MULAW: yes

Continuing with instructions

make

You wud get errors when compiling with gcc other that version 4.0.x. Feisty has version 4.1.2 installed by default and Gutsy would have a higher version i believe. You dont have to install gcc-4.0.0 or gcc-4.0.4 to make libjingle work. You just need to tweak the source code a bit.
  1. Change line 272 in talk/base/stringutils.h

    inline static const char* Traits::empty_str() { return ""; }

    to

    inline static const char* empty_str() { return ""; }

  2. Change lines 26 & 27 in talk/base/base64.h

    static const std::string Base64::Base64Table;
    static const std::string::size_type Base64::DecodeTable[];

    to

    static const std::string Base64Table;
    static const std::string::size_type DecodeTable[];

  3. Change line 141 in talk/xmpp/xmppclient.h

    std::string XmppClient::GetStateName(int state) const {

    to

    std::string GetStateName(int state) const {


  4. Change line 159 in talk/p2p/base/sessionmanager.h

    buzz::XmlElement* SessionManager::CreateErrorMessage(

    to

    buzz::XmlElement* CreateErrorMessage(


  5. The corrections suggested above would allow you to compile libjingle, but file transfer application will not work without the correction specified next.

    The pcp example will not correctly run giving the error (on the file 'receiver'):

    File transfer started.
    Get temp failed

    File transfer failed
    session.cc(377): state_ == STATE_RECEIVEDINITIATE @ ChooseTransport
    Aborted (core dumped)


    Change the following function in talk/base/unixfilesystem.cc

    bool UnixFilesystem::GetTemporaryFolderI(Pathname &pathname, bool create,
    const std::string *append) {
    pathname.SetPathname("/tmp");
    if (append) {
    pathname.AppendFolder(*append);
    if (create)
    CreateFolder(pathname);
    }
    }

    to

    bool UnixFilesystem::GetTemporaryFolderI(Pathname &pathname, bool create,
    const std::string *append) {
    pathname.SetPathname("/tmp");
    if (append) {
    pathname.AppendFolder(*append);
    if (create)
    CreateFolder(pathname);
    }
    return true;
    }

Now all the corrections are done. Its time to compile.

make && make check
sudo make install

Testing libjingle
  1. Testing File Sharing Application

    To start the receiver
    /opt/libjingle/pcp -d

    Enter your login details

    JID: "gmail address"
    Password: "gmail password"

    The received files are saved in the directory where you start the program pcp from. Once all the files have been transfered the program quits.

    To start the sender

    /opt/libjingle/pcp -d "files" "receiver_id"

    JID: "gmail address"
    Password: "gmail password"


    Once all the files have been sent, the program quits.

    To test both on the same computer start the sender and receiver from 2 separate directories. You can ignore option -d to avoid messages on terminal.

  2. Testing call application

    /opt/libjingle/call

    Enter your login details

    JID: "gmail address"
    Password:
    "gmail password"

    Type the command roster to get the list of friends on google talk.

    roster

    Roster contains 1 callable
    abcd123@gmail.com "status"


    To make a call to the person who is on roster use the command

    call abcd123@gmail.com

    quit
* The quotes should not be added while entering file names, email addresses or passwords. The double quotes are shown just to highlight those items.

3 comments:

Виктор Скляр said...

That it good doc. Thanks.

But I have some questions about.

Why bin-files so large?

For example pcp have 12M!

Whay?

And I can't run 'call':
./call: error while loading shared libraries: libortp.so.0: cannot open shared object file: No such file or directory

haricharan said...

Were you able to install all the packages properly? The error means you haven't installed Ortp properly

Did you get pcp in the supported examples?

nuwansam said...

Hi,
I am trying to run the pcp application on windows. it can send files in the working folder correctly, but when a file in any other folder is offered to send (in relative format as well as absolute path), the file transfer fails. Any idea??
Regards,
Nuwan Sam