Version 1 (modified by bennylp, 17 years ago) (diff)


Building Application using PJSIP with GNU Tools

This article is a continuation of the Getting Started article as described in


  • This article is only valid with version release or later of the libraries.
  • GNU tools (GNU make, binutils, gcc, and the likes).

Steps for Building Your Application that Uses PJSIP/PJMEDIA

  1. First, build pjproject libraries as described in This normally is accomplished by executing these commands: $ ./configure && make dep && make
  2. Create a directory outside the PJSIP sources for your project and place your source files there.
  3. Create a file named Makefile in your source directory with the following content:
    #Modify this to point to the PJSIP location.
    include $(PJBASE)/build.mak
    CC      = $(APP_CC)
    # If your application is in a file named myapp.cpp or myapp.c
    # this is the line you will need to build the binary.
    all: myapp
    myapp: myapp.cpp
            $(CC) -o $@ $(CPPFLAGS) $(LDFLAGS) $(LDLIBS) $<
            rm -f myapp.o myapp
  4. There few things to note when making the Makefile above:
    1. First, make sure that you replace PJBASE with the location of PJSIP sources in your computer, and
    2. If you notice there are spaces towards the bottom of the file (before $(CC) and rm, these are a single tab, not spaces. This is important, or otherwise make command will fail with "missing separator" error.
    3. Change myapp.cpp to your source filename.
  5. Create myapp.cpp in the same directory as your Makefile. At minimum, it may look like this:
    #include <pjlib.h>
    #include <pjlib-util.h>
    #include <pjmedia.h>
    #include <pjmedia-codec.h>
    #include <pjsip.h>
    #include <pjsip_simple.h>
    #include <pjsip_ua.h>
    #include <pjsua-lib/pjsua.h>
    int main()
            return 0;
  6. Last, run make in your source directory.