Menu

HowToBuild

Anonymous

IMPORTANT

For any question on how to build PLEASE join the development group Also, if you build CSipSimple, you should first read the Licensing wiki page

Introduction

The application has two distinct parts :

  • The pjsip dynamic library part that produce a .so (to be more precise a .so by android target).
  • The java application that produce a .apk (and can be installed on your android device).

If you are a java developer and you are not interested in building the sip stack, there is an alternate - not easy to maintain - way to build by getting auto-generated swig java class and the dynamic library from nightly build website. Please search the dev google group to get info about this method that is not recommended.

Some very important note : CSipSimple is released under GPL license. Be really aware about what does that mean before developing. Read Licensing wiki page.

So if you plan to improve CSipSimple and redistribute it, you MUST release your source code. As we (CSipSimple developers) are open to any contribution, I'd advise you to directly contribute the CSipSimple project. All contributions are welcome !!!

  • IMPORTANT
  • Introduction
  • System and Software Requirements
    • For Linux
    • For MacOSX
    • For Windows
    • With a virtual machine
  • Finalize your SDK installation
  • Checkout source code
  • Build native library
    • Without building the native library
  • Build apk
    • Setup/import application in your IDE (Optional)
    • Using ant (Optional)
  • Updates
  • Fast way to develop a GPL branded version
  • Integrate an existing pjsip module
  • Build with pjsip 1.x

System and Software Requirements

For Linux

You'll need following package you may need to adapt depending to your distribution packages names

subversion git quilt unzip wget swig2.0 python make yasm

You also have to install the android NDK and the android SDK. I do not details here how to install android NDK and SDK. Please read Android documentations about that :

  • Android NDK doc
  • Android SDK doc
    To install correctly the android NDK, please add the NDK to your path. I usually recommend to add these lines to your .bashrc :

    export ANDROID_NDK=/_path_to/android-ndk-linux/
    export ANDROID_SDK=/_path_to/android-sdk-linux/
    export PATH=$PATH:$ANDROID_SDK/tools:$ANDROID_SDK/platform-tools:$ANDROID_NDK

Anyway the naming of ANDROID_NDK export is important in the build of one part of the application. You can also do that only at build time, but if you use to develop for android, it's a good idea to do that.

Don't forget to install SDK and NDK dependencies as well. For example, on ubuntu 64bits system you will need ia32-libs for both NDK and SDK.

For MacOSX

Thx to Benjamin and Magnus for the contrib on these instructions

For main instructions it's almost the same as for Linux.

Packages are a little bit more complicated to get however. The two more difficult to get are quilt and swig2.0.

DUE TO A BUG IN MACPORT with quilt 0.6 -- DON'T USE THE FOLLOWING.

To install quilt you should install MacPorts first (http://www.macports.org). Installation instructions

If you work behind a proxy follow these instructions additionally MacPorts behind proxy

And then install quilt using :

sudo port selfupdate
sudo port install quilt

Instead build it from source

Download quilt from latest source available here : http://download.savannah.gnu.org/releases/quilt/ And then execute

./configure # optionally add prefix here to be able to install in your env
make
make install # optionally do that in sudo if target is read only for the current user

To install swig 2.0 : download from source available here : http://www.swig.org/download.html And then execute

./configure # optionally add prefix here to be able to install in your env
make
make install # optionally do that in sudo if target is read only for the current user

Finally, since csipsimple make file has some crappy hard coded link to swig tool for now, you have to add a symbolic link to allow your system to recognize swig2.0 to be the same than swig. The faster way is probably to make a symlink:

sudo ln -s <path to swig> /opt/local/bin/swig2.0

Other packages (subversion git unzip wget python make) should be easier to install but are also required on Mac.

Continue instructions of Linux build. It should go the same way once packages are installed.

For Windows

I don't not explain how to build for Windows because if you really want to develop you probably don't and shouldn't use Windows. However it should be possible to build it for Windows too. To do so, you must understand Makefile syntax and have a look on commands to run to build the project. It's most about checkouting other projects using git, getting zip files from elsewhere, applying patches, and generating a swig interface. Maybe using cygwin it's easier.

So, in this case the easiest way is to use the virtual machine as described in following chapter.

With a virtual machine

If you want to have an environment with everything required for CSipSimple you can use a Virtual Machine. Thanks to Dennis work, there is one ready for direct use :

CSipSimple-CompilerVM.vmdk

You can get root privilege with sudo command. The password is equals to the username, which should be "user".

Using, this machine, you should still read the following step for your complete understand of how things work, but don't need to run the commands since everything was already done. The step about how to update may be necessary to read if you want to be able to update to latest source code.

Finalize your SDK installation

Launch android sdk manager to download and install the SDK of versions listed as target in files : CSipSimple project.properties and ABS project.properties.

Checkout source code

We assume here you are in your folder where you put dev with a shell.

Start with a checkout of source code

# Checkout CSipSimple incl. all svn dependancies
svn checkout http://csipsimple.googlecode.com/svn/trunk/ CSipSimple-trunk

It will create a folder CSipSimple-trunk with the following folder structure containing all source code and SVN dependencies:

  • ActionBarSherlock: is a backward compatible way to use Fragments and Action Bar pattern of android newer versions
  • CSipSimple: The CSipSimple-App source code
  • CSipSimpleBranded
  • CSipSimpleCodecG729
  • CSipSimpleCodecPack
  • CSipSimpleVideoPlugin

Build native library

Go into source folder

cd CSipSimple-trunk/CSipSimple

Launch make to build the native part of the library and dependancies

make

If needed build video support libary (Optional)

make VideoLibs

If needed build CodecPackLibs (Optional)

make CodecPackLibs

If needed build CodecG729 (Optional)

make CodecG729

Note that you can use make -j4 to make things go faster if your computer allow that

If you get a problem at this point, it could be because there is a missing package on your system install. Since at this point it will do git, swig2.0, wget, unzip, quilt... there is chance one of these apps is missing. If so, try to get that installed on your system first. About swig you may have to build and install it by yourself because version 2.0 is recent.

If everything goes well, congrats, you have created the native libraries for CSipSimple (it will also produce native libs for plugins apps).

Without building the native library

Alternate way -- most developers should ignore this section

This method is not officially supported. However it's helpful if you have not knowledge in native development or GNU toolchains.

The native library build produce two things :

  • swig auto generated java/jni bindings class.
  • dynamic native library .so files
    To get the java/jni bindings class get the archive file here :

org.tar.gz and unpack it to have the org.pjsip package in the src folder of CSipSimple.

To get the .so files, download latest nightly build from nightly build website and unpack the apk file (apk files are just zip files). Then get lib/ARCH/.so files and copy it into CSipSimple libs/ARCH/.so

Build apk

There is several ways to build the apk once the native library is built. You can either use an IDE that integrates android development toolchains (described in details for Eclipse) or you can use Ant (for command line environments).

Setup/import application in your IDE (Optional)

You can now open the projects with Eclipse or your preferred java IDE that is able to build a regular android application.

Import the projects into Eclipse as an Android projects (right click > import > Android project from source) and select the folder CSipSimple-trunk.

Pick at least SipHome and ActionBarSherlock. Add CSipSimpleXXX-projects if needed.

Then when ADT plugin will ask you which android version you'd like to link on, you should check the "project.properties" file of each project you are importing (do that both for CSipSimple and ActionBarSherlock). You can have a look to online files here : CSipSimple project.properties and ABS project.properties. Obviously you need these versions to be installed by Android SDK Manager if not already done.

Don't be worried about the fact it's high values! It does not mean that your app will not run with older android versions. Actually, it will be able to run on android 1.6! MinSdk version and targetVersion are not linked. Backward compatibility is ensured by code not by the lib you link on while building.

Finally, you need to add the project dependencies to "SipHome", which is at least "ActionBarSherlock" and optional native lib projects. In Eclipse: right-click on "SipHome"-> Properties -> Java Build Path -> Projects.

If you encounter some problems about override of methods, ensure that your Eclipse env setup projects for "java 1.6" or upper. -You should also check that per project if necessary-

You should now be able to launch the application as an Android application.

Using ant (Optional)

This is particularly useful for a pure command line environment. It's used on the automatic nightly build server for example.

Directory structure:

  • ./ActionBarSherlock
  • ./CSipSimple

Steps:

  • Install ant
  • Setup SDK and NDK path (see above)
  • (if needed) Built native lib part: in ./CSipSimple execute: make
  • in ./ActionBarSherlock execute: android update project -p ./
  • in ./CSipSimple execute: android update project -p ./
  • Setup code signing for .apk
  • in ./CSipSimple execute: ant release
  • ./CSipSimple/bin/CSipSimple-release.apk

You have to create your own ant script based integrating ant scripts from the SDK. You can get inspired of what is produced by command line tool of the sdk http://developer.android.com/guide/developing/projects/projects-cmdline.html.

Some interesting tutorial to follow : http://www.androidengineer.com/2010/06/using-ant-to-automate-building-android.html.

You can also add additional ant task such as the one made for automatic revision in code number of the manifest.

Updates

If you would like to update your checkout of CSipSimple-trunk to the current SVN revision use the provided make tasks! This command will remove all applied quilt patches from SVN dependencies, update the SVN dependencies and CSipSimple-repository, and re-apply the new patches. All native libraries must be re-build.

make update && make

If you want to automate the build of the native part as well as the build of the android project, you can do that by installing CDT on eclipse and then on the android project do : New Project->Other->C++->Convert to C++ and tells it's a makefile project.


Fast way to develop a GPL branded version

BuildGplBrandedVersion

Integrate an existing pjsip module

IntegrateExistingPjsipModule


Build with pjsip 1.x

OldWayToBuild wiki page gives for reference the old way to build the library on older csipsimple versions. It's not supported anymore in development process.


Related

Wiki: BuildGplBrandedVersion
Wiki: IntegrateExistingPjsipModule
Wiki: Licensing
Wiki: MainSideBar

Discussion

1 2 3 .. 6 > >> (Page 1 of 6)
  • Anonymous

    Anonymous - 2010-06-14

    Originally posted by: winfa...@gmail.com

    Great job! I worked according to above, but it produced the .so under android-3. Could you tell me how I change the target platform for android API level 7 or 8?

     
  • Anonymous

    Anonymous - 2010-06-14

    Originally posted by: r3gis...@gmail.com

    Right now, it's not needed anymore to produce a custom library for each android version.

    At the beginning of the project I tried using private medialib API so it was necessary. But now, android-3 target will produce same thing than android-7 or 8 target /or at least something compatible.

    Btw, if you want to force the use of a target, it's quietly simple.

    While you launch make add the APP_PLATEFORM argument. For example :

    make APP=pjsip APP_PLATFORM=android-7 NDK_LOG=true V=1
    

    You must have the folder android-7 in your NDK "build/prebuilt" directory.

    It's a common feature from the android NDK. My modified NDK will produce things in separate directories which was really useful when a lib was needed by target android version.

     
  • Anonymous

    Anonymous - 2010-09-07

    Originally posted by: Jerry1....@gmail.com

    Hi There,

    If I want to use the libpjsipjni.so I built, where (which directory) should I copy the .so lib so that the .apk package to pickup the file?

    thanks, Jerry

     
  • Anonymous

    Anonymous - 2010-09-07

    Originally posted by: r3gis...@gmail.com

    >> libs/armeabi/libpjsipjni.so of the android project

    P.S. : in the current svn version target has been changed for built libs, there are now build in ../CSipSimple/libs/armeabi/libpjsipjni.so => so that if you checkout directly the trunk (pjsip_android & CSipSimple) it will put the built file directly on the Android project and with eclipse everything will be automatically done.

     
  • Anonymous

    Anonymous - 2010-10-19

    Originally posted by: dothangb...@gmail.com

    Thanks for the tutorial.

     
  • Anonymous

    Anonymous - 2010-10-25

    Originally posted by: xCh...@gmail.com

    @r3gis.3R I have about 100Gb free space on my drive

    How can I fix this issue with non-case-sensitive file system? I also tried to do checkout on Mac and got the same result

     
  • Anonymous

    Anonymous - 2010-10-25

    Originally posted by: xCh...@gmail.com

    Or may be there is another way to get sources?

     
  • Anonymous

    Anonymous - 2010-10-25

    Originally posted by: r3gis...@gmail.com

    Yes there is a mirror of the project on Lauchpad. http://bazaar.launchpad.net/~r3gis-r3gis/csipsimple/trunk/files/head%3A/pjsip_android/

    You have to use bazar to checkout. So maybe better regarding svn cases issues. bzr branch lp:csipsimple (Don't know the equivalent on mac or windows, but there is probably one... I'm running linux... so much easier to develop!! ;) )

     
  • Anonymous

    Anonymous - 2010-10-30

    Originally posted by: r3gis...@gmail.com

    @dengx2.com : you should rebuild the entiere application. As the apk I distribute are made to be directly installed (signed) you can't change files inside. Just rebuild the java app... that's not too hard to do ;)

     
  • Anonymous

    Anonymous - 2010-12-04

    Originally posted by: marcello...@gmail.com

    after the changes today, the libpjsipjni.so will not be build successfully

    StaticLibrary? : libspeex.a SharedLibrary? : libpjsipjni.so arm-eabi-gcc: ./build/platforms/android-3/arch-arm/usr/lib/libmissing.a: No such file or directory

     
  • Anonymous

    Anonymous - 2010-12-04

    Originally posted by: r3gis...@gmail.com

    Ok libs was missing (eclipse doesn't add .a files automatically ;) ). So added in last revision. Could you confirm it works now?

     
  • Anonymous

    Anonymous - 2010-12-04

    Originally posted by: marcello...@gmail.com

    Yepp, build Server send a success Report :) Are you interested in automatic tls build?

    Thx you for your gread job

     
  • Anonymous

    Anonymous - 2010-12-04

    Originally posted by: r3gis...@gmail.com

    Lol :) That's exactly what I'm doing it right now :) Thx for proposition but will be available soon :)... it's currently building on my server : http://nightlies.csipsimple.com/ (will be available for TLS and armv4t ;) ) However if you want to publish url for your server, it will be welcome. It's always interesting to have another source for users, if something goes wrong with my own server.

     
  • Anonymous

    Anonymous - 2010-12-15

    Originally posted by: pad...@gmail.com

    Yeah, I should have mentioned that I can build and run sample apps w/o any issues.

    What else can I tell you?

    I will try to collect up all the data I can about the environment and errors, but where can I send it?

     
  • Anonymous

    Anonymous - 2010-12-16

    Originally posted by: liuksm...@gmail.com

    @papada I had same problem in Eclipse then I've configured project_properties->java compiler->Enable project specific setting and I've choosen java 1.6 as default compliance setting I did it two times and now it's ok.

     
  • Anonymous

    Anonymous - 2010-12-16

    Originally posted by: pad...@gmail.com

    Thanks liuksmith :) now it compiles fine ... is this an Eclipse issue or a csipsimple issue?'

    One more thing to fix and I should be good to get playing ... When the app starts, it wants to download a file and can't, so I'm in an endless loop ... download, next, download, next ... etc.

    I thought I saw a note about moving a file from the pjsip build ... off to find that now

     
  • Anonymous

    Anonymous - 2010-12-16

    Originally posted by: pad...@gmail.com

    I think this is what I'm looking for:

    If you have build the pjsip library, copy the .so generated by the build in the directory : libs/armeabi/libpjsipjni.so of the android project. Else the library will be automatically downloaded from internet at first run (and put into the files/ directory of the package on the device).

    so if I have /workspace/android/csipsimple/ as my project directory and my build of pjsip in /workspace/android/pjsip_android

    So I should copy pjsip_android/libs/armeabi/libpjsipjni.so to where?

     
  • Anonymous

    Anonymous - 2010-12-16

    Originally posted by: r3gis...@gmail.com

    To CSipSimple/libs/armeabi/libpjsipjni.so

    You can also configure pjsip_android Application.mk to directly copy the output to the CSipSimple project. By default if you have checked out the entire trunk it should put libs in the right place. (The default target is ../CSipSimple/libs which is fine.

     
  • Anonymous

    Anonymous - 2010-12-16

    Originally posted by: pad...@gmail.com

    I put the file libpjsipjin.so in /csipcimple/libs/armeabi/ and that didn't help.

    Should it be in /csipcimple/libs/ instead?

     
  • Anonymous

    Anonymous - 2010-12-16

    Originally posted by: r3gis...@gmail.com

    No, armeabi is for arm eabi compatible CPU armeabi-v7a folder for arm eabi v7a compatible devices etc...

    One folder by CPU arch.

    In the manifest file did you change something? (debug mode?)

     
  • Anonymous

    Anonymous - 2010-12-16

    Originally posted by: pad...@gmail.com

    I just freshly built this Ubuntu system 10.4 LTS (i386 -Dell D620), loaded all the dev tools, made sure I could compile some of the basic samples.

    Now I am trying to get your code loaded so I can try to add some functions/mods. I'm used to working with linux on the asterisk/firewall level and this is my first attempt at Eclipse and Android dev ... But I work with SIP as my primary job.

    So to answer your other questions, I haven't changed anything yet, but I have lots of errors after I put the files and subfolders in /csipsimple/libs/

    Errors occurred during the build.

    Errors running builder 'Integrated External Tool Builder' on project 'csipsimple'.

    Variable references empty selection: ${project_loc}

    Variable references empty selection: ${project_loc}

     
  • Anonymous

    Anonymous - 2010-12-16

    Originally posted by: r3gis...@gmail.com

    This one is probably linked to the locale or SVN version on your system : I use little tool to update the manifest file to automatically propagate the svn revision to the manifest file. It make me save a lot of time but is not a really standard tool (half coded by me and half found on a blog of another project) ;)

    You can disable it easily : remove the .externalToolBuilders folder in CSipSimple. It will remove the auto svn <-> manifest file update.

    It will remove the error related to the external tool builder.

     
  • Anonymous

    Anonymous - 2010-12-20

    Originally posted by: r3gis...@gmail.com

    Now you miss the native library file in the correct directory. As the java part does not find it in libs/armeabi it download it from the internet. But that is not compatible with the debug mode which require the native lib to be bundled in the apk. I do that cause most of the time (and here it's the case) production native lib (online version) is outdated. So just read this wiki page again (the first part) you'll have information about how to build native part.if you don't want to bother with native lib build you can also download the latest dev build from nightlies and extract the .so from the apk but you still need toread the page above to know where to put the .so file and to understand what you are doing ;)

     
  • Anonymous

    Anonymous - 2010-12-21

    Originally posted by: pad...@gmail.com

    regis,

    Thanks for your help and patience. I will work on this today and let you know.

    BTW I had a friend download the standard release of csipsimple on to his verizon (Samsung) handset and when he called me, he sounds like one of the Disney chipmunks to me, but I sound normal to him. Any ideas???

     
1 2 3 .. 6 > >> (Page 1 of 6)

Log in to post a comment.