Compiling PJSIP for Different Architectures | Compiling PJSIP for IOS , ARMv7, ARMv7s , ARM 64, i386, x86_64 Architectures | PJSIP Compilation in MAC

Spread the love

Compiling PJSIP for IOS :

To specify the target platform is iOS, we need to create a file: pjlib/include/pj/config_site.h, and set it’s content as:

vim pjlib/include/pj/config_site.h
#define PJ_CONFIG_MACOS 1
#define PJ_CONFIG_IPHONE 1
// #define PJSIP_HAS_TLS_TRANSPORT 1

#include <pj/config_site_sample.h>

Now compile the pjproject by using following commands.

make clean
./configure-iphone –enable-opus-codec
make dep
make
Now we have .a files on different different folders of pjproject.

By default, the target architecture is armv7. This architecture is available for iPhone since iPhone 3GS, and all iPad.

However, besides this, for iPhone 5, iPhone 5c, and iPad 4, we have armv7s. And for iPhone 5s and iPad air, we have arm64.

If you want to get the max out of the device, you could specify the specific architecture by setting the ARCH variable.  

For ARMV7S Architecture :

make distclean && make clean
ARCH=’-arch armv7s’ ./configure-iphone –enable-opus-codec
make dep
make


For ARM64 Architecture :

make distclean && make clean
ARCH=’-arch arm64′ ./configure-iphone –enable-opus-codec
make dep
make

To compile i386 architecture :

make distclean
make clean
export DEVPATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/
export ARCH=”-arch i386″ CFLAGS=”-O2 -m32 -mios-simulator-version-min=5.0″ LDFLAGS=”-O2 -m32 -mios-simulator-version-min=5.0″
./configure-iphone –enable-opus-codec
make dep
make
Note : Do not use make clean and make distclean after two export functions.. clean may removes devpath and architecture it will result it to error or default architecture compilation.

To compile x86_64 architecture :

make distclean
make clean
export DEVPATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/
export ARCH=”-arch x86_64″ CFLAGS=”-O2 -m32 -mios-simulator-version-min=5.0″ LDFLAGS=”-O2 -m32 -mios-simulator-version-min=5.0″
./configure-iphone –enable-opus-codec
make dep
make
Note : Do not use make clean and make distclean after two export functions.. clean may removes devpath and architecture it will result it to error or default architecture compilation.

Testing Architecture of .a Files :


To test the compiled .a files are build for proper architecture use this command
xcrun -sdk iphoneos lipo -info <.a file >

Result may like this :

input file pjproject-2.3/third_party/lib/libopuscodec-arm-apple-darwin9.a is not a fat file
Non-fat file: pjproject-2.3/third_party/lib/libopuscodec-arm-apple-darwin9.a is architecture: x86_64
here x86_64 is the .a file architecture.

Related Posts :

  1. Adding Opus Codec to PJSIP
  2. C program to Convert Temperature.
  3. C program to understand type conversation.
  4. finding Largest of two numbers using conditional operator in C.
  5. C program to calculate the simple Interest,
  6. 100 + More C programs


Venkatesh Macha

Hi Guys, I am Venkatesh Macha. I am a programmer and an Open Source enthusiast, Presently working as a Software Engineer. Apart from that, I love to explore new technologies and things.

You may also like...

1 Response

  1. Very Good Document

    Small Change in document

    Change this line
    ARCH='-arch armv64' ./configure-iphone –enable-opus-codec
    to
    ARCH='-arch arm64' ./configure-iphone –enable-opus-codec

    Because the architecture is arm64 not armv64.

Leave a Reply