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 4 5 6 > >> (Page 3 of 6)
  • Anonymous

    Anonymous - 2011-06-17

    Originally posted by: david.ha...@gmail.com

    Hi

    I have the same problem that "manu" stated on Apr 6, 2011 a little bit up the page.

    I quote:

    Hi all, i an trying to build the Android app by copying the pjsip libraries from latest nightly apk. I copied the lib folder and its contents to the CsipSimple?? foler of my Java project. But still when i build the Java project, the generated apk do not contain the lib folder and hence the Sip Stack initialisation fails when i launch the apk in my device.

    Do i need to change any configuration in the java project after i copy teh lib folder from the latest apk to Java project folder?

    can someone help us please? thank you

     
  • Anonymous

    Anonymous - 2011-06-25

    Originally posted by: ocean.ra...@gmail.com

    How to add "tls/srtp" for csipsimple?.is it possible?

    only I found that how to active "tls/zrtp"

    MY_USE_TLS := 1 and -DPJ_HAS_SSL_SOCK=$(MY_USE_TLS) -DPJMEDIA_HAS_ZRTP=$(MY_USE_TLS) \

     
  • Anonymous

    Anonymous - 2011-06-28

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

    Hi

    I have tried above steps mentioned to build application for eclipse, i have taken latest version from SVN and also extracted .so files from the same apk version, but still the apk which is generated, is not working properly. The account i add, its status always remain as inactive.

    Please guide me through this.

    Regards

     
  • Anonymous

    Anonymous - 2011-06-29

    Originally posted by: werner...@googlemail.com

    Building CSipSimple with TLS/ ZRTP: I tried to build it and set MY_USE_TLS=1 in the makefile but got an error about missing openSSL stuff (see some comments above). It seems that somehow this setting ins not propagated to the other makefiles. Thus I called the toplevel make and set an additional parameter "-DMY_USE_TLS=1" - this worked and CSipSimple compiled with TLS/ZRTP and built the openSSL libs.

    Testing ZRTP/secure calls: ZRTP is an end-to-end protocol, thus the best way to test if secure calls are working is to use another ZRTP enabled SIP client, for example Twinkle or Jitsi, and connect to it. Maybe you use a WiFi? connection to you PC running Twinkle or Jitsi. If you can't do a simple SIP call (without a registrar) then you must youe a SIP registrar of your choice (I usually use iptel.org because this registrar/outbound proxy has full NAT support)

    Regards.

     
  • Anonymous

    Anonymous - 2011-06-29

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

    @werner : when you set MY_USE_TLS to 1 did you take care of removing any extra space after the 1.

    If not it take "1 " and the tests made on others .mk will not consider the option as activated (cause it test "1" and not "1 "). I should probably remove the extra space after 0 in the Application.mk that is under revision control.

     
  • Anonymous

    Anonymous - 2011-06-30

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

    Hi all. Another question: if I use TLS and SRTP but I do not use ZRTP what should I do to make the client recognize the certificate of the server?

     
  • Anonymous

    Anonymous - 2011-06-30

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

    Hi all, I buit libpjmedia.a and other libraries using csipsimple.

    After that I made simple android application like streamutil in pjsip-app/src/samples/streamutil.c.

    But when I run the program it makes an error at "pjmedia_snd_port_create" and the error code is PJMEDIA_EAUD_NODEFDEV

    status = pjmedia_snd_port_create(pool, -1, -1,

    stream_port->info.clock_rate, stream_port->info.channel_count, stream_port->info.samples_per_frame, stream_port->info.bits_per_sample, 0, &snd_port);

    if (status != PJ_SUCCESS) {

    ADNROID_LOGE("Unable to create sound port, error %d", status); Stop(); return status;

    }

    I wonder what is the problem and from where I have to struggle with.

    Thanks you in advance. I run the program using Android emulator 2.3 and samsung galaxyS (android 2.2)

     
  • Anonymous

    Anonymous - 2011-07-01

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

    @systal... : CSipSimple has now options in ui to allow/disable automatic certificate trust and to setup path to a certificate. I didn't test that point yet.

    @killerf.. : For now, pjsip_android use a different toolchain than the Makefile one. As consequence, you have to use the android-ndk to build and the way an android native library build. As consequence obviously if you try to build a part of pjsip without knowning what you are doing exactly, you'll miss the android_dev (java or opensl implementation) and you'll forget to mount this dev in pjmedia supported device... and so obviously pjmedia will cry about the fact there is no dev for android built in your pjmedia library. If you want to do this kind of build, you should first understand how toolchain works and what has been added to pjsip for the android port. Indeed, that's not well documented yet, but Florian (pjsip-jni author) is trying to make things easier for other developers and have a better way to build pjsip-android. Until this is done, you'll have to dive into the code and try to understand how it works. Good entry points are the /jni sub-folder and its source files and the files /build/Android.mk that are added in each module.

     
  • Anonymous

    Anonymous - 2011-07-03

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

    @r3gs... I really appreciate what you pointed and I'will dive into it. Thank you sincerely.

     
  • Anonymous

    Anonymous - 2011-07-15

    Originally posted by: david.ha...@gmail.com

    Hi r3gs, i'm building my own SIP application for a school project and i'm able to make calls to CSipSimple and vice versa by now. But when I try to call another application like Sipdroid it tells me that the codecs are incompatible.

    Now, i've been searching for quite a while but just couldn't fine how/where to change/set other codecs. When I call Sipdroid with CSipSimple it works fine. At the moment I'm still using the libraries from your built, so I couldn't have gone wrong there.

    Could you please point me in the right direction? Thank you

     
  • Anonymous

    Anonymous - 2011-07-15

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

    @david : can you ping me on the developer mailing list group? Will be easier to reply and to help you to debug :)

     
  • Anonymous

    Anonymous - 2011-07-21

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

    hello, guys help me out here.. i have built the .so files and copied them in android csipsimple project folder but when on run get logcat error saying no lib implemented, nothing can be done. Any comments?

     
  • Anonymous

    Anonymous - 2011-07-22

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

    it says 07-22 15:59:52.762: WARN/dalvikvm(321): No implementation found for native Lorg/pjsip/pjsua/pjsuaJNI;.set_use_compact_form (I)V

     
  • Anonymous

    Anonymous - 2011-07-22

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

    @xardo => version of native library and java app must be identical. Sounds your native version is older than the java code. Just do a svn update on native part, rebuild and it will be fine. (set_use_compact_form was recently changed into a configuration struct)

     
  • Anonymous

    Anonymous - 2011-07-27

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

    hi i had checkout the csipsample and import in to the eclipse. but when i implement on the phone it is not working . i mean when i register it shows in active . can i know where i need to add the lib files

     
  • Anonymous

    Anonymous - 2011-07-27

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

    Hi all, i an trying to build the Android app by copying the pjsip libraries from latest nightly apk. I copied the lib folder and its contents to the CsipSimple??? foler of my Java project. But still when i build the Java project, the generated apk do not contain the lib folder and hence the Sip Stack initialisation fails when i launch the apk in my device. Do i need to change any configuration in the java project after i copy teh lib folder from the latest apk to Java project folder?

     
  • Anonymous

    Anonymous - 2011-08-18

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

    If you want to build with webRTC enabled, use the official NDK method.

     
  • Anonymous

    Anonymous - 2011-08-30

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

    Getting error while compiling on all methods mentioned above using offical NDK, Crystal NDk Did anyone successfully compiled the library file. I am getting the following error

    Compile++ arm : webrtc_system_wrappers <= event_posix.cc Compile++ arm : webrtc_system_wrappers <= thread_posix.cc Compile++ arm : webrtc_system_wrappers <= trace_posix.cc Compile++ arm : webrtc_system_wrappers <= rw_lock_posix.cc In file included from apps/pjsip/project/build/..//third_party/webrtc/ system_wrappers/source/rw_lock_posix.cc:11: apps/pjsip/project/build/..//third_party/webrtc/system_wrappers/source/ rw_lock_posix.h:35: error: 'pthread_rwlock_t' does not name a type apps/pjsip/project/build/..//third_party/webrtc/system_wrappers/source/ rw_lock_posix.cc: In constructor 'webrtc::RWLockPosix::RWLockPosix()': apps/pjsip/project/build/..//third_party/webrtc/system_wrappers/source/ rw_lock_posix.cc:14: error: class 'webrtc::RWLockPosix' does not have any field named 'lock' apps/pjsip/project/build/..//third_party/webrtc/system_wrappers/source/ rw_lock_posix.cc: In destructor 'virtual webrtc::RWLockPosix::~RWLockPosix()': apps/pjsip/project/build/..//third_party/webrtc/system_wrappers/source/ rw_lock_posix.cc:20: error: '_lock' was not declared in this scope apps/pjsip/project/build/..//third_party/webrtc/system_wrappers/source/ rw_lock_posix.cc:20: error: 'pthread_rwlock_destroy' was not declared in this scope apps/pjsip/project/build/..//third_party/webrtc/system_wrappers/source/ rw_lock_posix.cc: In member function 'virtual int webrtc::RWLockPosix::Init()': apps/pjsip/project/build/..//third_party/webrtc/system_wrappers/source/ rw_lock_posix.cc:25: error: '_lock' was not declared in this scope apps/pjsip/project/build/..//third_party/webrtc/system_wrappers/source/ rw_lock_posix.cc:25: error: 'pthread_rwlock_init' was not declared in this scope apps/pjsip/project/build/..//third_party/webrtc/system_wrappers/source/ rw_lock_posix.cc: In member function 'virtual void webrtc::RWLockPosix::AcquireLockExclusive?()': apps/pjsip/project/build/..//third_party/webrtc/system_wrappers/source/ rw_lock_posix.cc:30: error: '_lock' was not declared in this scope apps/pjsip/project/build/..//third_party/webrtc/system_wrappers/source/ rw_lock_posix.cc:30: error: 'pthread_rwlock_wrlock' was not declared in this scope apps/pjsip/project/build/..//third_party/webrtc/system_wrappers/source/ rw_lock_posix.cc: In member function 'virtual void webrtc::RWLockPosix::ReleaseLockExclusive?()': apps/pjsip/project/build/..//third_party/webrtc/system_wrappers/source/ rw_lock_posix.cc:35: error: '_lock' was not declared in this scope apps/pjsip/project/build/..//third_party/webrtc/system_wrappers/source/ rw_lock_posix.cc:35: error: 'pthread_rwlock_unlock' was not declared in this scope apps/pjsip/project/build/..//third_party/webrtc/system_wrappers/source/ rw_lock_posix.cc: In member function 'virtual void webrtc::RWLockPosix::AcquireLockShared?()': apps/pjsip/project/build/..//third_party/webrtc/system_wrappers/source/ rw_lock_posix.cc:40: error: '_lock' was not declared in this scope apps/pjsip/project/build/..//third_party/webrtc/system_wrappers/source/ rw_lock_posix.cc:40: error: 'pthread_rwlock_rdlock' was not declared in this scope apps/pjsip/project/build/..//third_party/webrtc/system_wrappers/source/ rw_lock_posix.cc: In member function 'virtual void webrtc::RWLockPosix::ReleaseLockShared?()': apps/pjsip/project/build/..//third_party/webrtc/system_wrappers/source/ rw_lock_posix.cc:45: error: '_lock' was not declared in this scope apps/pjsip/project/build/..//third_party/webrtc/system_wrappers/source/ rw_lock_posix.cc:45: error: 'pthread_rwlock_unlock' was not declared in this scope make: * [out/apps/pjsip/armeabi/objs/webrtc_system_wrappers/ rw_lock_posix.o] Error 1 *

    Thanks sivakumar

     
  • Anonymous

    Anonymous - 2011-09-01

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

    Try to make with "make APP=pjsip TARGET_PLATFORM=android-9" if you want to keep USE_WEBRTC feature enabled. Else, just disable webrtc feature (see the Application.mk file).

     
  • Anonymous

    Anonymous - 2011-09-05

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

    For now speex is mandatory due to the inclusion of speex echo canceller. So, simply re-enable MY_USE_SPEEX and it will build. You can play with flags if you want to disable speex echo canceller (that's probably possible). Now that webrtc echo canceller is there (and default), I should probably take the point to allow speex to be optional. If you want to contribute such a patch, do not hesitate to share (use the developer google group also, would be much more easier ;) ).

    Also, note that anyway, you can at the application level control enabled codecs.

     
  • Anonymous

    Anonymous - 2011-09-22

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

    Hi All, I am following the "How to build instruction" but it creating error when i run the command make APP=pjsip in windows xp using cygwin.i also tried the ndk-build command but not get any succes to see the lib folder(../CSipSimple/libs/armeabi & armeabi-v7a) in CSipSimple with .so file.I am using ndkr5b and r6b both.

    please help me to build the csipsimple project using ndk and cygwin in windows xp.

    thanks in advance..........

    Thanks Vishal Singh

     
  • Anonymous

    Anonymous - 2011-10-01

    Originally posted by: 380c...@gmail.com

    Hello

    Your library is only 1MB Why I compiled more than 4MB libpjsipjni.so Thanks

     
  • Anonymous

    Anonymous - 2011-10-09

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

    anyone compiled this with success? Mine always fails in make APP=pjsip with this problem:

    Fatal error: Invalid -march= option: 'armv5te' make: out/apps/pjsip/armeabi/objs/psjipjni/src//pjsua_jni_addons.o?

     
  • Anonymous

    Anonymous - 2011-11-20

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

    re: my last comment on compilation errors on r1109

    The problem has been solved with r1110. Thankz! Basically, pjsip_android/apps/pjsip/project/build/Android.mk has been updated to point the the correct files/folders.

     
<< < 1 2 3 4 5 6 > >> (Page 3 of 6)

Log in to post a comment.