参考:https://www.jianshu.com/p/22cc698518ad
1、准备工作:下载源码
到官网http://www.pjsip.org下载最新代码
2、在pjlib/include/pj/目录下,建立一个config_site.h的文件
#define PJ_CONFIG_IPHONE 1
#define PJMEDIA_HAS_VIDEO 1
#define PJMEDIA_HAS_VID_TOOLBOX_CODEC 1
#include <pj/config_site_sample.h>
3、编译静态库
1、i386
export DEVPATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer
ARCH="-arch i386" CFLAGS="-O2 -m64 -mios-simulator-version-min=8.0" LDFLAGS="-O2 -m64 -mios-simulator-version-min=8.0" ./configure-iphone
make dep && make clean && make
2、armv7
关闭刚刚的终端,重新回到主目录,依次执行以下命令:
export ARCH="-arch armv7"
./configure-iphone
make dep && make clean && make
3、armv7s
export ARCH="-arch armv7s"
./configure-iphone
make dep && make clean && make
4、arm64
export ARCH="-arch arm64"
./configure-iphone
make dep && make clean && make
4、编译好的静态库在以下文件夹
pjlib/lib
pjlib-util/lib
pjmedia/lib
pjnath/lib
pjsip/lib
third_party/lib
5、合并静态库
lipo -arch arm64 /Users/boboli/Documents/svn/trunk/third_party/lib/libyuv-arm64-apple-darwin_ios.a -arch armv7 /Users/boboli/Documents/svn/trunk/third_party/lib/libyuv-armv7-apple-darwin_ios.a -arch armv7s /Users/boboli/Documents/svn/trunk/third_party/lib/libyuv-armv7s-apple-darwin_ios.a -create -output /Users/boboli/Documents/svn/pjsipLib/libyuv-all-apple-darwin_ios.a