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

Compiling PJSIP for all architectures.

Compiling PJSIP for iOS :

To Specify the target platform iOS, We need to create a file named pjlib/include/pj/config_site.h and add the following pre-processor directives to it.

 
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 using following commands.
make clean
./configure-iphone –enable-opus-codec
make dep
make
The above compilation will generate the library files i.e .a files at different folders of pjproject.
By default, the target architecture is ARMv7. This Architecture is available for iPhone since iPhone 3GS, and all iPad versions.

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

For 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.

For 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 the .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

Hi Guys, I am Venkatesh. I am a programmer and an Open Source enthusiast. I write about programming and technology on this blog.

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