blob: 1b2685b2394775231089b4370d670e4081d23f4e [file] [log] [blame]
Benny Prijono10a20802006-03-02 21:52:18 +00001
Benny Prijonoc3416832006-09-12 18:58:19 +00002
3Getting Started: Building and Using PJSIP and PJMEDIA
Benny Prijonoc3416832006-09-12 18:58:19 +00004
Benny Prijonoabd2ae92006-09-13 11:02:26 +00005 [Last Update: Sept 13, 2006]
6 _________________________________________________________________
7
8 This article describes how to download, customize, build, and use the open
9 source PJSIP and PJMEDIA SIP and media stack. The online (and HTML) version
10 of this file can be downloaded from http://www.pjsip.org/using.htm
Benny Prijonodb419fd2006-03-05 11:54:33 +000011
Benny Prijonoeec4d7c2006-03-09 16:19:20 +000012
Benny Prijonoabd2ae92006-09-13 11:02:26 +000013Quick Info
Benny Prijonoc3416832006-09-12 18:58:19 +000014
15 Building with GNU tools
Benny Prijonoabd2ae92006-09-13 11:02:26 +000016 Generally these should be all that are needed to build the libraries,
17 applications, and samples:
Benny Prijonoc3416832006-09-12 18:58:19 +000018
19 $ ./configure
20 $ make dep && make clean && make
21
Benny Prijonoabd2ae92006-09-13 11:02:26 +000022 Building Win32 Target with Microsoft Visual Studio
23 Generally we can just do these steps:
Benny Prijonoc3416832006-09-12 18:58:19 +000024
25 1. Open pjsip-apps/build/pjsip_apps.dsw workspace,
26 2. Create an empty pjlib/include/pj/config_site.h, and
27 3. build the pjsua application.
28
29 Building for Windows Mobile
Benny Prijonoabd2ae92006-09-13 11:02:26 +000030 Generally these are all that are needed:
Benny Prijonoc3416832006-09-12 18:58:19 +000031
32 1. Open pjsip-apps/build/wince-evc4/wince_demos.vcw EVC4 workspace,
33 2. Create an empty pjlib/include/pj/config_site.h, and
34 3. build the pjsua_wince application.
35
Benny Prijonoabd2ae92006-09-13 11:02:26 +000036 With Visual Studio for Win32 target and the GNU build systems, the output
37 libraries will be put in lib directory under each projects, and the output
38 binaries will be put in bin directory under each projects.
Benny Prijonoeec4d7c2006-03-09 16:19:20 +000039
40
Benny Prijonoc3416832006-09-12 18:58:19 +000041Table of Contents:
42 _________________________________________________________________
Benny Prijonoeec4d7c2006-03-09 16:19:20 +000043
Benny Prijonoc3416832006-09-12 18:58:19 +000044 1. Getting the Source Distribution
45
46 1.1 Getting the Release tarball
47
48 1.2 Getting from Subversion trunk
49
50 1.3 Source Directories Layout
51
52 2. Build Preparation
53
54 2.1 config_site.h file
55
56 2.2 Disk Space Requirements
57
58 3. Building Linux, *nix, *BSD, and MacOS X Targets with GNU Build Systems
59
60 3.1 Supported Targets
61
62 3.2 Requirements
63
64 3.3 Running configure
65
66 3.4 Running make
67
68 3.5 Cross Compilation
69
70 4. Building for Windows Targets with Microsoft Visual Studio
71
72 4.1 Requirements
73
74 4.2 Building the Projects
75
76 4.3 Debugging the Sample Application
77
78 5. Building for Windows Mobile Targets (Windows CE/WinCE/PDA/SmartPhone)
79
80 5.1 Requirements
81
82 5.2 Building the Projects
83
Benny Prijonoabd2ae92006-09-13 11:02:26 +000084 6. Using PJPROJECT with Applications
Benny Prijonoeec4d7c2006-03-09 16:19:20 +000085
86
Benny Prijonoc3416832006-09-12 18:58:19 +000087 Appendix I: Common Problems/Frequently Asked Question (FAQ)
Benny Prijonoeec4d7c2006-03-09 16:19:20 +000088
Benny Prijonoc3416832006-09-12 18:58:19 +000089 I.1 fatal error C1083: Cannot open include file: 'pj/config_site.h':
90 No such file or directory
91
92
931. Getting the Source Code Distribution
94 _________________________________________________________________
95
Benny Prijonoc3416832006-09-12 18:58:19 +000096 All libraries (PJLIB, PJLIB-UTIL, PJSIP, PJMEDIA, and PJMEDIA-CODEC) are
97 currently distributed under a single source tree, collectively named as
98 PJPROJECT or just PJ libraries. These libraries can be obtained by either
99 downloading the release tarball or getting them from the Subversion trunk.
100
101
1021.1 Getting the Release tarball
103 _________________________________________________________________
104
105 Getting the released tarball is a convenient way to obtain stable version of
106 PJPROJECT. The tarball may not contain the latest features or bug-fixes, but
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000107 normally it is considered more stable as each will be tested more rigorously
108 before released.
Benny Prijonoc3416832006-09-12 18:58:19 +0000109
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000110 The latest released tarball can be downloaded from the
Benny Prijonoc3416832006-09-12 18:58:19 +0000111 http://www.pjsip.org/download.htm.
112
113
1141.2 Getting from Subversion trunk
115 _________________________________________________________________
116
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000117 PJPROJECT Subversion repository will always contain the latest/most
118 up-to-date version of the sources. Normally the Subversion repository is
119 always kept in a "good" state. However, there's always a chance that things
120 break and the tree doesn't build correctly (particularly for the
121 "not-so-popular" targets), so please consult the mailing list should there
122 be any problems.
Benny Prijonoc3416832006-09-12 18:58:19 +0000123
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000124 Using Subversion also has benefits of keeping the local copy of the source
125 up to date with the main PJ source tree and to easily track the changes made
126 to the local copy, if any.
Benny Prijonoc3416832006-09-12 18:58:19 +0000127
128
129What is Subversion
130
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000131 Subversion (SVN) is Open Source version control system similar to CVS.
132 Subversion homepage is in http://subversion.tigris.org/
Benny Prijonoc3416832006-09-12 18:58:19 +0000133
134
135Getting Subversion Client
136
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000137 A Subversion (SVN) client is needed to download the PJ source files from
138 pjsip.org SVN tree. SVN client binaries can be downloaded from
139 http://subversion.tigris.org/, and the program should be available for
140 Windows, Linux, MacOS X, and many more platforms.
Benny Prijonoc3416832006-09-12 18:58:19 +0000141
142
143Getting the Source for The First Time
144
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000145 Once Subversion client is installed, we can use these commands to initially
Benny Prijonoc3416832006-09-12 18:58:19 +0000146 retrieve the latest sources from the Subversion trunk:
147
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000148
149
Benny Prijonoc3416832006-09-12 18:58:19 +0000150 $ svn co http://svn.pjproject.net/repos/pjproject/trunk pjproject
151 $ cd pjproject
152
153
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000154Keeping The Local Copy Up-to-Date
Benny Prijonoc3416832006-09-12 18:58:19 +0000155
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000156 Once sources have been downloaded, we can keep the local copy up to date by
157 periodically synchronizing the local source with the latest revision from
158 the PJ's Subversion trunk. The mailing list provides best source of
159 information about the availability of new updates in the trunk.
Benny Prijonoc3416832006-09-12 18:58:19 +0000160
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000161 To update the local copy with the latest changes in the main PJ's
162 repository:
163
164
Benny Prijonoc3416832006-09-12 18:58:19 +0000165
166 $ cd pjproject
167 $ svn update
168
169
170Tracking Local and Remote Changes
171
Benny Prijonoc3416832006-09-12 18:58:19 +0000172 To see what files have been changed locally:
173
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000174
175
Benny Prijonoc3416832006-09-12 18:58:19 +0000176 $ cd pjproject
177 $ svn status
178
179 The above command only compares local file against the original local copy,
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000180 so it doesn't require Internet connection while performing the check.
Benny Prijonoc3416832006-09-12 18:58:19 +0000181
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000182 To see both what files have been changed locally and what files have been
183 updated in the PJ's Subversion repository:
184
185
Benny Prijonoc3416832006-09-12 18:58:19 +0000186
187 $ cd pjproject
188 $ svn status -u
189
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000190 Note that this command requires active Internet connection to query the
191 status of PJPROJECT's source repository.
Benny Prijonoc3416832006-09-12 18:58:19 +0000192
193
1941.3 Source Directories Layout
195 _________________________________________________________________
196
197Top-Level Directory Layout
198
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000199 The top-level directories (denoted as $TOP here) in the source distribution
200 contains the following sub-directories:
Benny Prijonoc3416832006-09-12 18:58:19 +0000201
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000202 $TOP/build
Benny Prijonoc3416832006-09-12 18:58:19 +0000203 Contains makefiles that are common for all projects.
204
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000205 $TOP/pjlib
206 Contains header and source files of PJLIB. PJLIB is the base
207 portability and framework library which is used by all other
208 libraries
Benny Prijonoc3416832006-09-12 18:58:19 +0000209
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000210 $TOP/pjlib-util
211 Contains PJLIB-UTIL header and source files. PJLIB-UTIL is an
212 auxiliary library that contains utility functions such as scanner,
213 XML, STUN, MD5 algorithm, getopt() implementation, etc.
Benny Prijonoc3416832006-09-12 18:58:19 +0000214
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000215 $TOP/pjmedia
216 Contains PJMEDIA and PJMEDIA-CODEC header and source files. The
217 sources of various codecs (such as GSM, Speex, and iLBC) can be found
218 under this directory.
Benny Prijonoc3416832006-09-12 18:58:19 +0000219
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000220 $TOP/pjsip
Benny Prijonoc3416832006-09-12 18:58:19 +0000221 Contains PJSIP header and source files.
222
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000223 $TOP/pjsip-apps
224 Contains source code for PJSUA and various sample applications.
Benny Prijonoc3416832006-09-12 18:58:19 +0000225
226
227Individual Directory Inside Each Project
228
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000229 Each library directory further contains these sub-directories:
Benny Prijonoc3416832006-09-12 18:58:19 +0000230
231 bin
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000232 Contains binaries produced by the build process.
Benny Prijonoc3416832006-09-12 18:58:19 +0000233
234 build
235 Contains build scripts/makefiles, project files, project workspace,
236 etc. to build the project. In particular, it contains one Makefile
237 file to build the project with GNU build systems, and a *.dsw
238 workspace file to build the library with Microsoft Visual Studio 6 or
239 later.
240
241 build/output
242 The build/output directory contains the object files and other files
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000243 generated by the build process. To support building multiple targets
244 with a single source tree, each build target will occupy a different
245 subdirectory under this directory.
Benny Prijonoc3416832006-09-12 18:58:19 +0000246
247 build/wince-evc4
248 This directory contains the project/workspace files to build Windows
249 CE/WinCE version of the project using Microsoft Embedded Visual C++
250 4.
251
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000252 build/wince-evc4/output
253 This directory contains the library, executable, and object files
254 generated by Windows Mobile build process.
255
Benny Prijonoc3416832006-09-12 18:58:19 +0000256 docs
257 Contains Doxygen configuration file (doxygen.cfg) to generate online
258 documentation from the source files. The output documentation will be
259 put in this directory as well (for example, docs/html directory for
260 the HTML files).
261
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000262 (to generate Doxygen documentation from the source tree, just run
263 "doxygen docs/doxygen.cfg" in the individual project directory. The
264 generated files will reside in docs directory).
265
Benny Prijonoc3416832006-09-12 18:58:19 +0000266 include
267 Contains the header files for the project.
268
269 lib
270 Contains libraries produced by the build process.
271
272 src
273 Contains the source files of the project.
274
275
2762. Build Preparation
277 _________________________________________________________________
278
2792.1 config_site.h file
280 _________________________________________________________________
281
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000282 The pjlib/include/pj/config_site.h contains local customizations to the
Benny Prijonoc3416832006-09-12 18:58:19 +0000283 libraries.
284
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000285 All customizations should be put in this file instead of modifying PJ's
286 files, because if PJ's files get modified, then those modified files will
287 not be updated the next time the source is synchronized. Or in other case,
288 the local modification may be overwritten with the fresh copy from the SVN.
Benny Prijonoc3416832006-09-12 18:58:19 +0000289
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000290 Putting the local customization to the config_site.h solves this problem,
291 because this file is not included in the version control, so it will never
292 be overwritten by "svn update" command.
Benny Prijonoc3416832006-09-12 18:58:19 +0000293
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000294 Please find list of configuration macros that can be overriden from these
295 files:
Benny Prijonoc3416832006-09-12 18:58:19 +0000296 * pjlib/config.h file
297 * pjmedia/config.h file
298 * pjsip/sip_config.h file
299
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000300 A sample config_site.h file is also available in
Benny Prijonoc3416832006-09-12 18:58:19 +0000301 pjlib/include/config_site_sample.h.
302
Benny Prijonoc3416832006-09-12 18:58:19 +0000303
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000304Creating config_site.h file
Benny Prijonoc3416832006-09-12 18:58:19 +0000305
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000306 The simplest way is just to create an empty file, to use whetever default
307 values set by the libraries.
308
309 Another way to create the config_site.h file is to write something like the
310 following:
311
Benny Prijonoc3416832006-09-12 18:58:19 +0000312
313 // Uncomment to get minimum footprint (suitable for 1-2 concurrent calls
314 only)
315 //#define PJ_CONFIG_MINIMAL_SIZE
316 // Uncomment to get maximum performance
317 //#define PJ_CONFIG_MAXIMUM_SPEED
318 #include <pj/config_site_sample.h>
319
320
3212.2 Disk Space Requirements
322 _________________________________________________________________
323
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000324 The building process needs:
325 * about 50-60 MB of disk space to store the uncompressed source files, and
326 * about 30-50 MB of additional space for building each target
Benny Prijonoc3416832006-09-12 18:58:19 +0000327
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000328 (Visual Studio Debug and Release are considered as separate targets)
Benny Prijonoc3416832006-09-12 18:58:19 +0000329
330
3313. Building Linux, *nix, *BSD, and MacOS X Targets with GNU Build Systems
332 _________________________________________________________________
333
3343.1 Supported Targets
335 _________________________________________________________________
336
337 The new, autoconf based GNU build system can be used to build the
338 libraries/applications for the following targets:
339 * Linux/uC-Linux (i386, Opteron, Itanium, MIPS, PowerPC, etc.),
340 * MacOS X (PowerPC),
341 * mingw (i386),
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000342 * FreeBSD and maybe other BSD's (i386, Opteron, etc.),
343 * RTEMS with cross compilation (ARM, powerpc),
Benny Prijonoc3416832006-09-12 18:58:19 +0000344 * etc.
345
346
3473.2 Requirements
348 _________________________________________________________________
349
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000350 In order to use PJ's GNU build system, these typical GNU tools are needed:
351 * GNU make (other make will not work),
352 * GNU binutils for the target, and
353 * GNU gcc for the target.
Benny Prijonoc3416832006-09-12 18:58:19 +0000354
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000355 In addition, the appropriate "SDK" must be installed for the particular
356 target (this could just be a libc and the appropriate system abstraction
357 library such as Posix).
358
359 The build system is known to work on the following hosts:
360 * Linux, many types of distributions.
361 * MacOS X 10.2
362 * mingw (Win2K, XP)
363 * FreeBSD (must use gmake instead of make)
364
365 Building Win32 applications with cygwin is currently not supported (there is
366 some Windows header conflicts), but cross-compilations might just work.
Benny Prijonoc3416832006-09-12 18:58:19 +0000367
368
3693.3 Running configure
370 _________________________________________________________________
371
372Using Default Settings
373
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000374 Run "./configure" without any options to let the script detect the
Benny Prijonoc3416832006-09-12 18:58:19 +0000375 appropriate settings for the host:
376
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000377
378
Benny Prijonoc3416832006-09-12 18:58:19 +0000379 $ cd pjproject
380 $ ./configure
381 ...
382
383 Notes:
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000384 The default settings build the libraries in "release" mode, with
385 default CFLAGS set to "-O2 -DNDEBUG". To change the default CFLAGS,
386 we can use the usual "./configure CFLAGS='-g'" construct.
Benny Prijonoc3416832006-09-12 18:58:19 +0000387
388 Features Customization
389
390 With the new autoconf based build system, most configuration/customization
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000391 can be specified as configure arguments. The list of customizable features
392 can be viewed by running "./configure --help" command:
393
394
Benny Prijonoc3416832006-09-12 18:58:19 +0000395
396 $ cd pjproject
397 $ ./configure --help
398 ...
399 Optional Features:
400 --disable-floating-point Disable floating point where possible
401 --disable-sound Exclude sound (i.e. use null sound)
402 --disable-small-filter Exclude small filter in resampling
403 --disable-large-filter Exclude large filter in resampling
404 --disable-g711-plc Exclude G.711 Annex A PLC
405 --disable-speex-aec Exclude Speex Acoustic Echo Canceller/AEC
406 --disable-g711-codec Exclude G.711 codecs from the build
407 --disable-l16-codec Exclude Linear/L16 codec family from the build
408 --disable-gsm-codec Exclude GSM codec in the build
409 --disable-speex-codec Exclude Speex codecs in the build
410 --disable-ilbc-codec Exclude iLBC codec in the build
411 ...
412
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000413 Configuring Debug Version and Other Customizations
Benny Prijonoc3416832006-09-12 18:58:19 +0000414
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000415 The configure script accepts standard customization, which details can be
416 obtained by executing ./configure --help.
Benny Prijonoc3416832006-09-12 18:58:19 +0000417
418 For example, to build the libraries/application in debug mode:
419
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000420
421
Benny Prijonoc3416832006-09-12 18:58:19 +0000422 $ ./configure CFLAGS="-g"
423 ...
424
425
426 3.4 Cross Compilation
427 _________________________________________________________________
428
429 (.. to be completed)
430
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000431
432
Benny Prijonoc3416832006-09-12 18:58:19 +0000433 $ ./configure --target=powerpc-linux-unknown
434 ...
435
436
437 3.5 Running make
438 _________________________________________________________________
439
440 Once the configure script completes successfully, start the build process by
441 invoking these commands:
442
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000443
444
Benny Prijonoc3416832006-09-12 18:58:19 +0000445 $ cd pjproject
446 $ make dep
447 $ make
448
449 Note:
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000450 gmake may need to be specified instead of make for some hosts, to
451 invoke GNU make instead of the native make.
452
Benny Prijonoc3416832006-09-12 18:58:19 +0000453
454 Description of all make targets supported by the Makefile's:
455
456 all
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000457 The default (or first) target to build the libraries/binaries.
Benny Prijonoc3416832006-09-12 18:58:19 +0000458
459 dep, depend
460 Build dependencies rule from the source files.
461
462 clean
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000463 Clean the object files for current target, but keep the output
464 library/binary files intact.
Benny Prijonoc3416832006-09-12 18:58:19 +0000465
466 distclean, realclean
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000467 Remove all generated files (object, libraries, binaries, and
468 dependency files) for current target.
Benny Prijonoc3416832006-09-12 18:58:19 +0000469
470
471 Note:
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000472 make can be invoked either in the top-level PJ directory or in build
473 directory under each project to build only the particular project.
Benny Prijonoc3416832006-09-12 18:58:19 +0000474
475
4764. Building for Windows Targets with Microsoft Visual Studio
477 _________________________________________________________________
478
479 4.1 Requirements
480 _________________________________________________________________
481
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000482 The Microsoft Visual Studio based project files can be used with one of the
483 following:
Benny Prijonoc3416832006-09-12 18:58:19 +0000484
485 * Microsoft Visual Studio 6,
486 * Microsoft Visual Studio .NET 2002,
487 * Microsoft Visual Studio .NET 2003,
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000488 * Microsoft Visual C++ Express 2005 with Platform SDK and DirectX SDK,
Benny Prijonoc3416832006-09-12 18:58:19 +0000489
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000490 For the host, the following are required:
491 * Windows NT, 2000, XP, 2003, or later ,
492 * Windows 95/98 should work too, but this has not been tested,
493 * Sufficient amount of RAM for the build process.
Benny Prijonoc3416832006-09-12 18:58:19 +0000494
495
496 4.2 Building the Projects
497 _________________________________________________________________
498
499 Follow the steps below to build the libraries/application using Visual
500 Studio:
501 1. Open Visual Studio 6 workspace file pjsip-apps/build/pjsip_apps.dsw. If
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000502 later version of Visual Studio is being used, it should convert the
Benny Prijonoc3416832006-09-12 18:58:19 +0000503 workspace file and project files into the new formats.
504 2. Set pjsua as Active Project.
505 3. Select Debug or Release build as appropriate.
506 4. Build the project. This will build pjsua application and all libraries
507 needed by pjsua.
508 5. After successful build, the pjsua application will be placed in
509 pjsip-apps/bin directory, and the libraries in lib directory under each
510 projects.
511
512 To build the samples:
513 1. (Still using the same workspace)
514 2. Set samples project as Active Project
515 3. Select Debug or Release build as appropriate.
516 4. Build the project. This will build all sample applications and all
517 libraries needed.
518 5. After successful build, the sample applications will be placed in
519 pjsip-apps/bin/samples directory, and the libraries in lib directory
520 under each projects.
521
522 4.3 Debugging the Sample Application
523 _________________________________________________________________
524
525 The sample applications are build using Samples.mak makefile, therefore it
526 is difficult to setup debugging session in Visual Studio for these
527 applications. To solve this issue, the pjsip_apps workspace contain one
528 project called sample_debug which can be used to debug the sample
529 application.
530
531 To setup debugging using sample_debug project:
532 1. (Still using pjsip_apps workspace)
533 2. Set sample_debug project as Active Project
534 3. Edit debug.c file inside this project.
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000535 4. Modify the #include line to include the particular sample application to
536 debug
Benny Prijonoc3416832006-09-12 18:58:19 +0000537 5. Select Debug build.
538 6. Build and debug the project.
539
540
5415. Building for Windows Mobile Targets (Windows CE/WinCE/PDA/SmartPhone)
542 _________________________________________________________________
543
544 PJ supports building SIP and media stacks and applications for Windows
545 Mobile targets. A very simple WinCE SIP user agent (with media) application
546 is provided just as proof of concept that the port works.
547
548 5.1 Requirements
549 _________________________________________________________________
550
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000551 One of the following development tools is needed to build SIP and media
552 components for Windows Mobile:
Benny Prijonoc3416832006-09-12 18:58:19 +0000553 * Microsoft Embedded Visual C++ 4 with appropriate SDKs, or
554 * Microsoft Visual Studio 2005 for Windows Mobile with appropriate SDKs.
555
556 Note that VS2005 is not directly supported (as I don't have the tools), but
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000557 it is reported to work (I assumed that VS2005 for Windows Mobile can import
558 EVC4 workspace file).
Benny Prijonoc3416832006-09-12 18:58:19 +0000559
560 5.2 Building the Projects
561 _________________________________________________________________
562
563 The Windows Mobile port is included in the main source distribution. Please
564 follow the following steps to build the WinCE libraries and sample
565 application:
566 1. Open pjsip-apps/build/wince-evc4/wince_demos.vcw workspace file. If
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000567 later version of EVC4 is being used, this may cause the workspace file
568 to be converted to the appropriate format.
Benny Prijonoc3416832006-09-12 18:58:19 +0000569 2. Select pjsua_wince project as the Active Project.
570 3. Select the appropriate SDK (for example Pocket PC 2003 SDK or SmartPhone
571 2003 SDK)
572 4. Select the appropriate configuration (for example, Win32 (WCE Emulator
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000573 Debug) to debug the program in emulator, or other configurations such as
574 ARMV4, MIPS, SH3, SH4, or whatever suitable for the device)
Benny Prijonoc3416832006-09-12 18:58:19 +0000575 5. Select the appropriate device (Emulator or the actual Device).
576 6. Build the project. This will build the sample WinCE application and all
577 libraries (SIP, Media, etc.) needed by this application.
578
579 Notes
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000580
581 + If the config_site.h includes config_site_sample.h file, then
582 there are certain configuration in config_site_sample.h that get
583 activated for Windows CE targets. Please make sure that these
584 configurations are suitable for the application.
585 + The libraries, binaries and object files produced by the build
586 process are located under build/wince-evc4/output directory of each
587 projects.
Benny Prijonoc3416832006-09-12 18:58:19 +0000588
589
Benny Prijonoabd2ae92006-09-13 11:02:26 +00005906. Using PJPROJECT with Applications
Benny Prijonoc3416832006-09-12 18:58:19 +0000591 _________________________________________________________________
592
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000593 Regardless of the build system being used, the following tasks are normally
594 needed to be done in order to build application to use PJSIP and PJMEDIA:
595 1. Put these include directories in the include search path:
Benny Prijonoc3416832006-09-12 18:58:19 +0000596 + pjlib/include
597 + pjlib-util/include
598 + pjmedia/include
599 + pjsip/include
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000600 2. Put these library directories in the library search path:
Benny Prijonoc3416832006-09-12 18:58:19 +0000601 + pjlib/lib
602 + pjlib-util/lib
603 + pjmedia/lib
604 + pjsip/lib
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000605 3. Include the relevant PJ header files in the application source file. For
606 example, using these would include ALL APIs exported by PJ:
Benny Prijonoc3416832006-09-12 18:58:19 +0000607
608 #include <pjlib.h>
609 #include <pjlib-util.h>
610 #include <pjsip.h>
611 #include <pjsip_ua.h>
612 #include <pjsip_simple.h>
613 #include <pjsua.h>
614 #include <pjmedia.h>
615 #include <pjmedia-codec.h>
616 (Note: the documentation of the relevant libraries should say which
617 header files should be included to get the declaration of the APIs).
618 4. Declare the OS macros.
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000619 + For Windows applications built with Visual Studio, we need to
620 declare PJ_WIN32=1 macro in the project settings (declaring the
621 macro in the source file may not be sufficient).
622 + For Windows Mobile applications build with Visual C++, we need to
623 declare PJ_WIN32_WINCE=1 macro in the project settings.
624 + For GNU build system/autoconf based build system, we need to
625 declare PJ_AUTOCONF=1 macro when compiling the applications.
Benny Prijonoc3416832006-09-12 18:58:19 +0000626 (Note: the old PJ build system requires declaring the target processor
627 with PJ_M_XXX=1 macro, but this has been made obsolete. The target
628 processor will be detected from compiler's predefined macro by
629 pjlib/config.h file).
630 5. Link with the appropriate PJ libraries. The following libraries will
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000631 need to be included in the library link specifications:
Benny Prijonoc3416832006-09-12 18:58:19 +0000632
633 pjlib
634 Base library used by all libraries.
635
636 pjlib-util
637 Auxiliary library containing scanner, XML, STUN, MD5, getopt,
638 etc, used by the SIP and media stack.
639
640 pjsip
641 SIP core stack library.
642
643 pjsip-ua
644 SIP user agent library containing INVITE session, call
645 transfer, client registration, etc.
646
647 pjsip-simple
648 SIP SIMPLE library for base event framework, presence, instant
649 messaging, etc.
650
651 pjsua
652 High level SIP UA library, combining SIP and media stack into
653 high-level easy to use API.
654
655 pjmedia
656 The media framework.
657
658 pjmedia-codec
659 Container library for various codecs such as GSM, Speex, and
660 iLBC.
661
662
663 Note: the actual library names will be appended with the target name and the
664 build configuration. For example:
665
666 For Visual Studio builds
667 The actual library names will look like
668 pjlib-i386-win32-vc6-debug.lib,
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000669 pjlib-i386-win32-vc6-release.lib, etc., depending on whether we
670 are building the Debug or Release version of the library.
671
672 An easier way to link with the libraries is to include PJ
673 project files in the workspace, and to configure project
674 dependencies so that the application depends on the PJ
675 libraries. This way, we don't need to manually add each PJ
676 libraries to the input library file specification, since VS
677 will automatically link the dependency libraries with the
678 application.
679
680 For Windows Mobile builds
681 Unfortunately the PJ libraries built for Windows Mobile will
682 not be placed in the usual lib directory, but rather under the
683 output directory under build/wince-evc4 project directory.
684
685 An easier way to link with the libraries is to include PJ
686 project files in the workspace, and to configure project
687 dependencies so that the application depends on the PJ
688 libraries. This way, we don't need to manually add each PJ
689 libraries to the input library file specification, since VS
690 will automatically link the dependency libraries with the
691 application.
Benny Prijonoc3416832006-09-12 18:58:19 +0000692
693 For GNU builds
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000694 Application's Makefile can get the PJ library suffix by
695 including PJ's build.mak file from the root PJ directory (the
696 suffix is contained in TARGET_NAME variable). For example, to
697 link with PJLIB and PJMEDIA, we can use this syntax in the
698 LDFLAGS: "-lpj-$(TARGET_NAME) -lpjmedia-$(TARGET_NAME)"
Benny Prijonoc3416832006-09-12 18:58:19 +0000699
700
701Appendix I: Common Problems/Frequently Asked Question (FAQ)
702 _________________________________________________________________
703
704 I.1 fatal error C1083: Cannot open include file: 'pj/config_site.h': No such
705 file or directory
706
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000707 This error normally occurs when the config_site.h file has not been created.
708 This file needs to be created manually (an empty file is sufficient). Please
709 follow the Build Preparation instructions above to create this file.
Benny Prijonoc3416832006-09-12 18:58:19 +0000710
711
712
713
714
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000715 Thanks for using PJ libraries and for reading this document. Please
716 send feedbacks or general comments to <bennylp at pjsip dot org>.
Benny Prijonoc3416832006-09-12 18:58:19 +0000717
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000718 Benny Prijono
Benny Prijonoeec4d7c2006-03-09 16:19:20 +0000719