用于iphone模拟器的PJSIP编译

时间:2012-03-08 04:32:21

标签: iphone pjsip

我正在尝试为iphone模拟器编译pjsip并收到错误:

../include/pj/config_site_sample.h:322:1: warning: this is the location of the previous definition
../src/pj/activesock.c: In function ‘activesock_create_iphone_os_stream’:
../src/pj/activesock.c:146: error: ‘kCFStreamNetworkServiceType’ is unavailable (declared at /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/Frameworks/CFNetwork.framework/Headers/CFSocketStream.h:256)
../src/pj/activesock.c:147: error: ‘kCFStreamNetworkServiceTypeVoIP’ is unavailable (declared at /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/Frameworks/CFNetwork.framework/Headers/CFSocketStream.h:259)

请帮忙。

1 个答案:

答案 0 :(得分:2)

为了他人的利益:使用来自trunk的最新pjsip。 在configure_iphone

中将以下行更改为i686
for archpath in `ls -d ${SDKPATH}/usr/lib/gcc/arm-apple-darwin*`; do

for archpath in `ls -d ${SDKPATH}/usr/lib/gcc/i686-apple-darwin*`; do

并使用以下行

创建config_site.h(pjlib / include / pj)
#define PJ_CONFIG_IPHONE 1
#include <pj/config_site_sample.h>

确保您拥有正确的sdk和arch设置。我使用下面的那些。

export CFLAGS="-O2 -m32 -miphoneos-version-min=4.0" LDFLAGS="-O2 -m32" 
export IPHONESDK=iPhoneSimulator4.2.sdk 
export DEVPATH=/Developer/Platforms/iPhoneSimulator.platform/Developer 
export ARCH="-arch i686" 

另外,build / rules.mak包含无效空格而不是制表符(检查最后几行)是很奇怪的。用制表符替换空格并执行

$ rm pjlib/build/.pjlib* 
$ rm pjnath/build/.pjnath* 

现在终于我把它编译好了。