Linphone Android + Netbeans + OS X = problems

Linphone is an open-source VoIP API. They have a git project for Android, and I wanted to develop on OS X (Netbeans). Not a great setup for success, but of course I didn’t know that until I’d started. I hadn’t had much trouble developing for Android on the mac before.

So, some tips to spare you hours of pain:

  • Make sure you have the latest Android tools/SDK installed
  • Install the Google NDK, the project includes C code
  • Clone the git repository: git clone git://git.linphone.org/linphone-android.git --recursive
  • Modify the file “submodules/externals/libvpx/build/make/gen_asm_deps.sh” according to this link, in short, change this line:
    • includes=$(egrep -i "include +\"?+[a-z0-9_/]+\.${sfx}" $srcfile |
    • includes=$(egrep -i "include +\"?[a-z0-9_/]+\.${sfx}" $srcfile |
  • Follow the readme file to get the sources prepared and run the NDK stuff, this simply involves running make and make install if you want to test on a device. It seems to not be necessary to manually run ./prepare-sources and ndk-build, but you do need to add the things to your path as described by the readme file.
  • Don’t worry about an error you may receive that comes during ./prepare-sources. It is to do with AudioStreamer and is only a problem if you need SILK support*. It comes at the end of other preparation, so it can be assumed that the other, important stuff was successful* – This doesn’t happen to me anymore :)
  • Run “android update project” on the project folder
  • Edit the Makefile to find the $(NUMCPUS) call, remove it and replace it with the number of cores/CPUs you have (see below** for the explanation)
  • Run make***
  • Open the project in Netbeans, assuming you have the nbandroid plugin – my method is still to create a project and replace the contents, but I don’t think that’s necessary
  • Edit the custom_rules.xml and comment out the sections target name="build-libs" and target name="-post-compile" (using )***

It’s quite possible I forgot something, so if you run into problems, leave a comment and I’ll try and jog my memory accordingly

Remaining issues:

  • I have to clean every time before building, otherwise a file or files are in the way of the packaging process

*http://lists.gnu.org/archive/html/linphone-developers/2011-11/msg00099.html

**The script uses /proc/cpuinfo to get the number of CPUs. BSD/OS X doesn’t use the /proc file system, so this is not available. You can find out how many CPUs you have by running sysctl hw.physicalcpu (http://stackoverflow.com/questions/1715580/how-to-discover-number-of-cores-on-mac-os-x), and change the Makefile accordingly. If you were less lazy, you would change it to actually calculate it instead of hardcoding. Based on the advice on the Stackoverflow page, that should be possible.

***This was necessary for me because I couldn’t figure out how to add the NDK tools to the path such that Netbeans sees them. Eclipse has an option to add the path to the NDK (http://stackoverflow.com/questions/11825534/set-build-path-in-eclipse-for-ndk-program), so for Eclipse users this, and running make manually, shouldn’t be necessary

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>