My favorites | Sign in
Project Logo
                
Search
for
Updated May 31, 2009 by scott.williamson
Labels: Featured
BuildPJsipSDK21  
This page describes how to build pjsip-1.0 on the iPhone SDK 2.x

Introduction

This is to help one build pjsip 1.0 on OS X 10.5.5 with the iPhone SDK 2.x using the sound code from the siphon project.

Note

ipodsound.c does not work with the 3.0 SDK beta. The sound api probably has changes and the source will need to be ported.

To have this work with other versions of the iPhone SDK (maybe) try changing the occurrences of /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS 2.1 .sdk to whichever version you have downloaded.

i.e. /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS 2.2 .sdk

Details

Put the ipodsound.c file file into pjmedia/source/pjmedia directory. You can get a copy from the downloads section of this site.

Set the path to include the arm tools in the SDK

export PATH=$PATH:/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/

Setup symbolic links for gcc like cross compile

cd /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/
ln -s ar arm-apple-darwin9-ar
ln -s cpp arm-apple-darwin9-cpp 
ln -s arm-apple-darwin9-g++-4.0.1 arm-apple-darwin9-g++
ln -s arm-apple-darwin9-gcc-4.0.1 arm-apple-darwin9-gcc
ln -s ld arm-apple-darwin9-ld
ln -s ranlib arm-apple-darwin9-ranlib

Edit aconfigure.ac and add this at line 398:

arm-apple-darwin*)
        LIBS="$LIBS -framework CoreAudio -framework CoreFoundation -framework AudioToolbox"
        ac_pjmedia_snd=ipod
        AC_MSG_RESULT([Checking sound device backend... AudioQueue])
        ;;

Edit build/cc-gcc.mak

export RANLIB = $(CROSS_COMPILE)ranlib -o

Edit the following build/rules.mak

$(LIB): $(OBJDIRS) $(OBJS) $($(APP)_EXTRA_DEP)
	if test ! -d $(LIBDIR); then $(subst @@,$(subst /,$(HOST_PSEP),$(LIBDIR)),$(HOST_MKDIR)); fi
	$(AR) $(LIB) $(OBJS)
	$(RANLIB) -static $(LIB) $(OBJS)

Add this to config.h file in pjmedia/include/pjmedia:

/** Constant for AudioQueue sound backend. */
#define PJMEDIA_SOUND_IPOD_SOUND            4

Copy a header that is missing in the device includes

cp /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.1.sdk/usr/include/netinet/in_systm.h \
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.1.sdk/usr/include/netinet/in_systm.h

Edit os-auto.mak.in pjmedia/build and add

#
# iPod/iPhone
#
ifeq ($(AC_PJMEDIA_SND),ipod)
export SOUND_OBJS = ipodsound.o
export CFLAGS += -DPJMEDIA_SOUND_IMPLEMENTATION=PJMEDIA_SOUND_IPOD_SOUND
endif

Comment out the media tests build target in pjmedia/build/makefile 109:

TARGETS := pjmedia pjmedia-codec pjsdp #pjmedia-test

Generate configuration script

autoconf aconfigure.ac > aconfigure

aconfigure with these options seem to work

./aconfigure --host=arm-apple-darwin9 --disable-ssl --disable-speex-aec \
--disable-speex-codec --disable-l16-codec --disable-g722-codec \
--disable-ilbc-codec CFLAGS="-arch armv6 -pipe -O0 -isysroot \
 /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.1.sdk \
-I/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.1.sdk/usr/include/gcc/darwin/4.0" \
LDFLAGS="-isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.1.sdk \
-L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/IphoneOS2.1.sdk/usr/lib" \
CPP=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin9-cpp \
AR=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin9-ar \
RANLIB=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin9-ranlib \
CC=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin9-gcc

now to setup link in xcode...


Comment by mwahal, Dec 27, 2008

I followed the instructions to the dot. This is what I get when I run ./aconfigure

aconfigure:2409: checking for C compiler default output file name aconfigure:2431: /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin9-gcc -arch armv6 -pipe -O0 -isysroot \ /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.1.sdk -I/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.1.sdk/usr/include/gcc/darwin/4.0 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.1.sdk -L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/IphoneOS2.1.sdk/usr/lib conftest.c >&5 ld: in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.1.sdk, can't map file, errno=22 collect2: ld returned 1 exit status

Any ideas ?

Thanks Mudit

Comment by mwahal, Dec 27, 2008

Never mind -- fixed it -- in the aconfigure line -- you need to add a new line after -pipe -O0 -isysroot \

Now, the make dep succeeds but the make fails in the end.

ld: in ../lib/libpj-arm-apple-darwin9.a, archive has no table of contents -rw-r--r-- 1 mwahal 1000 205648 Dec 27 10:27 ./pjlib/lib/libpj-arm-apple-darwin9.a ./pjlib/lib/libpj-arm-apple-darwin9.a: current ar archive

Comment by mwahal, Dec 27, 2008

If I remove -static from the changes in build/rules.mak, then everything compiles ok.

Comment by ashish.p.d, Jan 30, 2009

Hello, i'm able to compile everything properly it also runs. but the only problem is i'm getting one way voice. am not able to hear on iphone. i have a apple dev license so i have build an app. can anyone give me some idea. thanks in advance

Comment by scott.williamson, Jan 30, 2009

one way audio usually is a NAT related issue, try using STUN to have the user agent try to correct this. The option is --stun-srv=name Set STUN server host or domain. See the documentation for pjsua

Comment by mwahal, Feb 12, 2009

scott,

can you please edit/fix this line

./aconfigure --host=arm-apple-darwin9 --disable-ssl --disable-speex-aec \ --disable-speex-codec --disable-l16-codec --disable-g722-codec \ --disable-ilbc-codec CFLAGS="-arch armv6 -pipe -O0 -isysroot \ /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.1.sdk \

---- please add a new line after -isysroot and before /Developer

Thanks Mudit

Comment by mwahal, Feb 12, 2009

-pipe -O0 -isysroot \ /Developer/Platforms

Comment by scott.williamson, Feb 12, 2009

Thanks mwahal.

Comment by densvc, Feb 16, 2009

Configurations for current target have been written to 'build.mak', and 'os-auto.mak' in various build directories, and pjlib/include/pj/compat/os_auto.h.

Further customizations can be put in:

- 'user.mak' - 'pjlib/include/pj/config_site.h'

The next step now is to run 'make dep' and 'make'.

ssts-macbook:pjproject sst$ sudo make dep for dir in pjlib pjlib-util pjnath third_party pjmedia pjsip pjsip-apps; do \

if make -C $dir/build dep; then \
true; \
else \
exit 1; \
fi; \
done
make -f /Users/sst/iphonedev/iphonedev2/pjproject/build/rules.mak APP=PJLIB app=pjlib depend .pjlib-arm-apple-darwin9.depend:1: missing separator. Stop. make1?: depend? Error 2 make: dep? Error 1

When i complie , i got an eror same that . Someone know " How to slove this problem"
Thank (:
Comment by densvc, Feb 19, 2009

Hi I made a simple application run from xcode on ipod touch device first i test dial function it work and next test receive incoming call function

This debug log from xcode debug console when program initialize

17:26:51.805 os_core_unix.c pjlib 1.0.1 for POSIX initialized

  1. :26:51.818 sip_endpoint.c Creating endpoint instance...
  2. :26:51.823 pjlib select() I/O Queue created (0x1a1094)
  3. :26:51.823 sip_endpoint.c Module "mod-msg-print" registered
  4. :26:51.823 sip_transport. Transport manager created.

When i make call from x-lite to this sip account i got error message in debug console Assertion failed: (cport->rx_buf_count <= cport->rx_buf_cap), function read_port, file ../src/pjmedia/conference.c, line 1403.

How to slove this problem Thanks

Comment by scott.williamson, Feb 19, 2009

densvc, care to share your Xcode project? I might be able to help then. Other than that I think you are missing (or the API is broken) for the ...iPhoneOS2.1.sdk/usr/include/netinet/in_systm.h library.

Comment by densvc, Feb 19, 2009

scoott, thank you for your fast reply i will send you the simple project by gmail. if i use iphonesdk 2.0 you think that is problem

because my device firmware 2.0.1.

Comment by nandan.mehra, Mar 05, 2009

hi densvc can you share the xcode project .i will very thankful to you .if you share plz send it my gmail account :nandan.mehra@gmail.com

i have build pjproject 1.0.1 and then keep all the lib and include file as the process which has given but when i compiled Makefile using make which is under the setting folder that is giving an error missing separator. Stop.

can some one solve my problem which is highly appropriate.... one more thing can someone send me the source code of siphon which has devloped in xcode .. thanks in advance

Comment by sahajankhan, Mar 20, 2009

Hi densvc,

Are you able to fix the problem i.e jlib-arm-apple-darwin9.depend:1: missing separator..

Currently I am trying to build the pjsip library and encountered the same problem...

I will be really thankful ,if you/anyone help me on this topic..

Thanks

Comment by prasannavigneshr, Mar 20, 2009

Hi densvc & sahajankhan,

Help Me... :(

I am also getting the same error while compile the source.

make -f /Users/sst/iphonedev/iphonedev2/pjproject/build/rules.mak APP=PJLIB app=pjlib depend .pjlib-arm-apple-darwin9.depend:1: missing separator. Stop. make1?: depend? Error 2 make: dep? Error 1

Thanks

Comment by maelle.saiag, Mar 23, 2009

Hi,

I try to compile with pjproject1.1 but in the config.h in pjmedia/include/pjmedia, there is not the definition of the constants for sound backend. So I don't know if I have to add the line : / Constant for AudioQueue? sound backend. / #define PJMEDIA_SOUND_IPOD_SOUND 4

Thanks

Comment by emmanuelgranatello, Mar 23, 2009

/Hi densvc & sahajankhan,

Help Me... :(

I am also getting the same error while compile the source.

make -f /Users/sst/iphonedev/iphonedev2/pjproject/build/rules.mak APP=PJLIB app=pjlib depend .pjlib-arm-apple-darwin9.depend:1: missing separator. Stop. make1?: depend? Error 2 make: dep? Error 1

Thanks /

I have the same problem. :( there is some solution?

Comment by scott.williamson, Mar 23, 2009

Hi All,

It should be noted that the above instructions are probably out of date. I will look into build instructions for current revs of pjproject, but until then these instructions are probably only good for pjproject-1.0 NOT the current version.

Comment by emmanuelgranatello, Mar 23, 2009

Thanks Scott !!!

Comment by maelle.saiag, Mar 23, 2009

Thanks Scott!

How many time do you think you need to make instructions for revs of pjproject ? Do you want help ?

For the last versions, I just try to compile with pjproject-1.0.1 and pjproject-1.0 and I have the same error as densvc, sahajankhan, emmanuelgranatello, ...

Comment by maelle.saiag, Mar 23, 2009

I find the solution : it's when we copy/put $(LIB): $(OBJDIRS) $(OBJS) $($(APP)EXTRA_DEP)

if test ! -d $(LIBDIR); then $(subst @@,$(subst /,$(HOST_PSEP),$(LIBDIR)),$(HOST_MKDIR)); fi $(AR) $(LIB) $(OBJS) $(RANLIB) -static $(LIB) $(OBJS)

It put space instead of tab. Now I suppose it compile correctly but my Terminal have crash during the make. I will try tomorrow ;)

Comment by emmanuelgranatello, Mar 24, 2009

Sorry, how do link the files ".a" in Xcode? I have problems when linking! :(

Comment by maelle.saiag, Mar 24, 2009

See http://code.google.com/p/voiphone/wiki/XcodeBuildLink, you have to create a new project, open info of your target and what you need to add is in the XcodeBuildLink. Don't forget to adjust the paths.

Comment by emmanuelgranatello, Mar 24, 2009

thanks.... gives me problems when I use any function!

during linking ... error is like below... "pjsua_create",referenced from:

Comment by maelle.saiag, Mar 24, 2009

Do you work on your device or with the simulator ? I haved the same error with the simulator but it compile with the device.

Comment by emmanuelgranatello, Mar 24, 2009

tnks. ... work only in device? i try it on simulator :( I don't have an iphone ! :(

Comment by maelle.saiag, Mar 24, 2009

I think it could work on simulator but you have to change some elements. I don't know exacly what you have to change. But I think that you have to change the export path, change the links for gcc with the simulator path, and change the options of the aconfigure with the simulator path.

Good luck ;)

Comment by emmanuelgranatello, Mar 24, 2009

thanks! I will try!

Comment by emmanuelgranatello, Mar 26, 2009

someone can to make it run on the simulator?

Comment by dxluong, Apr 03, 2009

Work with Simulator, but sound must be disable >"<

In the ./aconfigure command, I change all "iPhoneOS" to "iPhoneSimulator" and "-arch armv6" to "-arch i386", then compile. Everything linked correctly in Xcode (Simulator) except the reference to ipodsound.

I have to use --disable-sound to make Xcode (Simulator) correctly link and compile.

Anyone try this and have a solution?

Comment by rahulvaishnav23, May 30, 2009

Hi all,

Please let me know how to compile Pjsip in iPhoneOS 3.0 ? Even they don't provide netinet/in_systm.h file. So how could i compile by using above code. I had succefully compiled library for IphoneOs? 2.2 what i do now please let me know.

Comment by itm.crazy, Jun 23, 2009

hello all,

following setting carefully, I have run ./aconfigure & make dep but when I am running make I am getting this result. please let me know how to solve this error

for dir in pjlib pjlib-util pjnath third_party pjmedia pjsip pjsip-apps; do \

if make -C $dir/build all; then \
true; \
else \
exit 1; \
fi; \
done
make -f /Users/advantal/Nikhil/sip/pjproject-1.0.2/build/rules.mak APP=PJLIB app=pjlib ../lib/libpj-i386-apple-darwin9.6.1.a if test ! -d ../lib; then ; fi /bin/sh: -c: line 0: syntax error near unexpected token `;' /bin/sh: -c: line 0: `if test ! -d ../lib; then ; fi' make2?: ../lib/libpj-i386-apple-darwin9.6.1.a? Error 2 make1?: pjlib? Error 2 make: all? Error 1


Sign in to add a comment
Hosted by Google Code