Saturday, September 8, 2012

Compiling libjingle on OS X

I recently spent the day (yes, the entire day) compiling libjingle on OS X. I'm still running OS X 10.6.8, so that may have been part of the problem, but there are clearly some deeper issues. I thought I'd document the changes I had to make to the compilations instructions in case anyone else (like me in the future) has to go through this nightmare.

First off, the package includes compilation instructions in the README file. This file has some organizational issues (For example, the dependencies expat and srtp are not listed under the "prerequisites" section, but rather the "libjingle" section) and does not account for some bugs I found, but otherwise includes some pretty good detail. Unfortunately, all the "examples" they give are for windows, so I imagine that's where all the development and testing is done. Still, you need to read it. This post is just an outline and only goes into detail where the README doesn't explain things.

Also, there's no longer an active mailing list to go to ask questions, which is sad because that would be a good place to bring these issues up (there are already bugs posted for most of the fixes). It also makes me think maybe libjingle is dead or on critical life-support. (the mailing list linked from the developer's page is currently non-existant, and the link from their blog to the "google talk help center" goes to!) If you need help, your best bet is probably, which is a great place to go for help, but it's no substitute for a mailing list.

Compiling libjingle

  1. Download and extract libjingle from the google code page. I used 0.6.14 for this.
  2. Be sure to extract it somewhere without any weird characters in the path (including spaces) or the build will barf.
  3. Create a makefile (below) at the top level of libjingle. This will be especially useful in case you need to run the build over and over again as you tweak things.
  4. Install the prerequisites (see the README for more details)
    1. Python should already be installed
    2. To install scons, I recommend homebrew: $ brew install scons
    3. download swtoolkit and extract it as talk/third_party/swtoolkit
    4. download gtest. extract it as talk/third_party/gtest
    5. download expat 2.0.1. extract as talk/third_party/expat-2.0.1
    6. download srtp and extract as talk/third_party/srtp
  5. Apply the following fixes:
    1. Fix talk/third_party/swtoolkit/site_scons/ as described here and here.
    2. Fix talk/libjingle.scons as described here.
    3. Make the following two changes to talk/main.scons:
      1. comment out the line that has '-fno-rtti' in it (if you are running a newer version of OS X, and up-to-date dev tools, you may not need to do this.)
      2. Apply the fix described here. A logical place to add the mac_env.Replace(...) is after mac_env.Append( … ).
  6. Holy crap! You did it! It should now build with $ make
  7. If you get stuck, you may get a hint from $ make verbose
  8. To compile 64-bit binaries, you need to do a few more things:
    1. Comment out "session/phone/" from libjingle.scons, and 'Carbon' from main.scons.
    2. Change '-arch', 'i386', to '-arch', 'x86_64', in two places in main.scons
    3. Though the build will terminate with errors, you should at least have the .a files you need.

======= Makefile ========

SCONS_DIR ?= /usr/local/Cellar/scons/2.2.0/libexec/scons-local/

default: build
cd talk/third_party/expat-2.0.1 && ./configure
cd talk/third_party/srtp && ./configure

build: talk/third_party/expat-2.0.1/Makefile talk/third_party/srtp/Makefile
cd talk && third_party/swtoolkit/

verbose: talk/third_party/expat-2.0.1/Makefile talk/third_party/srtp/Makefile
cd talk && third_party/swtoolkit/ --verbose

~/bin/swtoolkit/ --help

cd talk && third_party/swtoolkit/ --clean

UPDATE: notes on 64-bit build.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.