blob: 864b831ef14469caf06aeb2a7879175fd44680e1 [file] [log] [blame]
Benny Prijono10a20802006-03-02 21:52:18 +00001
Benny Prijonoc3416832006-09-12 18:58:19 +00002Getting Started: Building and Using PJSIP and PJMEDIA
Benny Prijonoc3416832006-09-12 18:58:19 +00003
Benny Prijono646b7b72006-10-21 18:28:07 +00004 [Last Update: $Date: 2006-10-21 19:14:22 +0100 (Sat, 21 Oct 2006) $]
5
Benny Prijonoabd2ae92006-09-13 11:02:26 +00006 _________________________________________________________________
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 Prijono646b7b72006-10-21 18:28:07 +000014 _________________________________________________________________
Benny Prijonoc3416832006-09-12 18:58:19 +000015
Benny Prijono646b7b72006-10-21 18:28:07 +000016 Building with GNU tools (Linux, *BSD, MacOS X, mingw, etc.)
Benny Prijonoabd2ae92006-09-13 11:02:26 +000017 Generally these should be all that are needed to build the libraries,
18 applications, and samples:
Benny Prijonoc3416832006-09-12 18:58:19 +000019
Benny Prijono646b7b72006-10-21 18:28:07 +000020 $ ./configure
21 $ make dep && make clean && make
Benny Prijonoc3416832006-09-12 18:58:19 +000022
Benny Prijonoabd2ae92006-09-13 11:02:26 +000023 Building Win32 Target with Microsoft Visual Studio
24 Generally we can just do these steps:
Benny Prijonoc3416832006-09-12 18:58:19 +000025
26 1. Open pjsip-apps/build/pjsip_apps.dsw workspace,
27 2. Create an empty pjlib/include/pj/config_site.h, and
28 3. build the pjsua application.
29
30 Building for Windows Mobile
Benny Prijonoabd2ae92006-09-13 11:02:26 +000031 Generally these are all that are needed:
Benny Prijonoc3416832006-09-12 18:58:19 +000032
33 1. Open pjsip-apps/build/wince-evc4/wince_demos.vcw EVC4 workspace,
34 2. Create an empty pjlib/include/pj/config_site.h, and
35 3. build the pjsua_wince application.
36
Benny Prijono646b7b72006-10-21 18:28:07 +000037 Locating Output Binaries/Libraries
38 Libraries will be put in lib directory, and binaries will be put in
39 bin directory, under each projects.
40
41 Running the Applications
42 After successful build, you can try running pjsua application on
43 pjsip-apps/bin directory. PJSUA manual is in
44 http://www.pjsip.org/pjsua.htm.
Benny Prijonoeec4d7c2006-03-09 16:19:20 +000045
46
Benny Prijonoc3416832006-09-12 18:58:19 +000047Table of Contents:
48 _________________________________________________________________
Benny Prijonoeec4d7c2006-03-09 16:19:20 +000049
Benny Prijonoc3416832006-09-12 18:58:19 +000050 1. Getting the Source Distribution
51
52 1.1 Getting the Release tarball
53
54 1.2 Getting from Subversion trunk
55
56 1.3 Source Directories Layout
57
58 2. Build Preparation
59
60 2.1 config_site.h file
61
62 2.2 Disk Space Requirements
63
Benny Prijono646b7b72006-10-21 18:28:07 +000064 3. Building Linux, *nix, *BSD, and MacOS X Targets with GNU Build
65 Systems
Benny Prijonoc3416832006-09-12 18:58:19 +000066
67 3.1 Supported Targets
68
69 3.2 Requirements
70
71 3.3 Running configure
72
73 3.4 Running make
74
75 3.5 Cross Compilation
76
Benny Prijono646b7b72006-10-21 18:28:07 +000077 3.6 Build Customizations
78
Benny Prijonoc3416832006-09-12 18:58:19 +000079 4. Building for Windows Targets with Microsoft Visual Studio
80
81 4.1 Requirements
82
83 4.2 Building the Projects
84
85 4.3 Debugging the Sample Application
86
87 5. Building for Windows Mobile Targets (Windows CE/WinCE/PDA/SmartPhone)
88
89 5.1 Requirements
90
91 5.2 Building the Projects
92
Benny Prijonoabd2ae92006-09-13 11:02:26 +000093 6. Using PJPROJECT with Applications
Benny Prijonoeec4d7c2006-03-09 16:19:20 +000094
95
Benny Prijonoc3416832006-09-12 18:58:19 +000096 Appendix I: Common Problems/Frequently Asked Question (FAQ)
Benny Prijonoeec4d7c2006-03-09 16:19:20 +000097
Benny Prijonoc3416832006-09-12 18:58:19 +000098 I.1 fatal error C1083: Cannot open include file: 'pj/config_site.h':
99 No such file or directory
100
101
1021. Getting the Source Code Distribution
103 _________________________________________________________________
104
Benny Prijonoc3416832006-09-12 18:58:19 +0000105 All libraries (PJLIB, PJLIB-UTIL, PJSIP, PJMEDIA, and PJMEDIA-CODEC) are
106 currently distributed under a single source tree, collectively named as
107 PJPROJECT or just PJ libraries. These libraries can be obtained by either
108 downloading the release tarball or getting them from the Subversion trunk.
109
110
1111.1 Getting the Release tarball
112 _________________________________________________________________
113
114 Getting the released tarball is a convenient way to obtain stable version of
115 PJPROJECT. The tarball may not contain the latest features or bug-fixes, but
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000116 normally it is considered more stable as each will be tested more rigorously
117 before released.
Benny Prijonoc3416832006-09-12 18:58:19 +0000118
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000119 The latest released tarball can be downloaded from the
Benny Prijonoc3416832006-09-12 18:58:19 +0000120 http://www.pjsip.org/download.htm.
121
122
1231.2 Getting from Subversion trunk
124 _________________________________________________________________
125
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000126 PJPROJECT Subversion repository will always contain the latest/most
127 up-to-date version of the sources. Normally the Subversion repository is
128 always kept in a "good" state. However, there's always a chance that things
129 break and the tree doesn't build correctly (particularly for the
130 "not-so-popular" targets), so please consult the mailing list should there
131 be any problems.
Benny Prijonoc3416832006-09-12 18:58:19 +0000132
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000133 Using Subversion also has benefits of keeping the local copy of the source
134 up to date with the main PJ source tree and to easily track the changes made
135 to the local copy, if any.
Benny Prijonoc3416832006-09-12 18:58:19 +0000136
137
138What is Subversion
139
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000140 Subversion (SVN) is Open Source version control system similar to CVS.
141 Subversion homepage is in http://subversion.tigris.org/
Benny Prijonoc3416832006-09-12 18:58:19 +0000142
143
144Getting Subversion Client
145
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000146 A Subversion (SVN) client is needed to download the PJ source files from
147 pjsip.org SVN tree. SVN client binaries can be downloaded from
148 http://subversion.tigris.org/, and the program should be available for
149 Windows, Linux, MacOS X, and many more platforms.
Benny Prijonoc3416832006-09-12 18:58:19 +0000150
151
152Getting the Source for The First Time
153
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000154 Once Subversion client is installed, we can use these commands to initially
Benny Prijonoc3416832006-09-12 18:58:19 +0000155 retrieve the latest sources from the Subversion trunk:
156
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000157
158
Benny Prijonoc3416832006-09-12 18:58:19 +0000159 $ svn co http://svn.pjproject.net/repos/pjproject/trunk pjproject
160 $ cd pjproject
161
162
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000163Keeping The Local Copy Up-to-Date
Benny Prijonoc3416832006-09-12 18:58:19 +0000164
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000165 Once sources have been downloaded, we can keep the local copy up to date by
166 periodically synchronizing the local source with the latest revision from
167 the PJ's Subversion trunk. The mailing list provides best source of
168 information about the availability of new updates in the trunk.
Benny Prijonoc3416832006-09-12 18:58:19 +0000169
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000170 To update the local copy with the latest changes in the main PJ's
171 repository:
172
173
Benny Prijonoc3416832006-09-12 18:58:19 +0000174
175 $ cd pjproject
176 $ svn update
177
178
179Tracking Local and Remote Changes
180
Benny Prijonoc3416832006-09-12 18:58:19 +0000181 To see what files have been changed locally:
182
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000183
184
Benny Prijonoc3416832006-09-12 18:58:19 +0000185 $ cd pjproject
186 $ svn status
187
188 The above command only compares local file against the original local copy,
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000189 so it doesn't require Internet connection while performing the check.
Benny Prijonoc3416832006-09-12 18:58:19 +0000190
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000191 To see both what files have been changed locally and what files have been
192 updated in the PJ's Subversion repository:
193
194
Benny Prijonoc3416832006-09-12 18:58:19 +0000195
196 $ cd pjproject
197 $ svn status -u
198
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000199 Note that this command requires active Internet connection to query the
200 status of PJPROJECT's source repository.
Benny Prijonoc3416832006-09-12 18:58:19 +0000201
202
2031.3 Source Directories Layout
204 _________________________________________________________________
205
206Top-Level Directory Layout
207
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000208 The top-level directories (denoted as $TOP here) in the source distribution
209 contains the following sub-directories:
Benny Prijonoc3416832006-09-12 18:58:19 +0000210
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000211 $TOP/build
Benny Prijonoc3416832006-09-12 18:58:19 +0000212 Contains makefiles that are common for all projects.
213
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000214 $TOP/pjlib
215 Contains header and source files of PJLIB. PJLIB is the base
216 portability and framework library which is used by all other
217 libraries
Benny Prijonoc3416832006-09-12 18:58:19 +0000218
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000219 $TOP/pjlib-util
220 Contains PJLIB-UTIL header and source files. PJLIB-UTIL is an
221 auxiliary library that contains utility functions such as scanner,
222 XML, STUN, MD5 algorithm, getopt() implementation, etc.
Benny Prijonoc3416832006-09-12 18:58:19 +0000223
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000224 $TOP/pjmedia
225 Contains PJMEDIA and PJMEDIA-CODEC header and source files. The
226 sources of various codecs (such as GSM, Speex, and iLBC) can be found
227 under this directory.
Benny Prijonoc3416832006-09-12 18:58:19 +0000228
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000229 $TOP/pjsip
Benny Prijonoc3416832006-09-12 18:58:19 +0000230 Contains PJSIP header and source files.
231
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000232 $TOP/pjsip-apps
233 Contains source code for PJSUA and various sample applications.
Benny Prijonoc3416832006-09-12 18:58:19 +0000234
235
236Individual Directory Inside Each Project
237
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000238 Each library directory further contains these sub-directories:
Benny Prijonoc3416832006-09-12 18:58:19 +0000239
240 bin
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000241 Contains binaries produced by the build process.
Benny Prijonoc3416832006-09-12 18:58:19 +0000242
243 build
244 Contains build scripts/makefiles, project files, project workspace,
245 etc. to build the project. In particular, it contains one Makefile
246 file to build the project with GNU build systems, and a *.dsw
247 workspace file to build the library with Microsoft Visual Studio 6 or
248 later.
249
250 build/output
251 The build/output directory contains the object files and other files
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000252 generated by the build process. To support building multiple targets
253 with a single source tree, each build target will occupy a different
254 subdirectory under this directory.
Benny Prijonoc3416832006-09-12 18:58:19 +0000255
256 build/wince-evc4
257 This directory contains the project/workspace files to build Windows
258 CE/WinCE version of the project using Microsoft Embedded Visual C++
259 4.
260
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000261 build/wince-evc4/output
262 This directory contains the library, executable, and object files
263 generated by Windows Mobile build process.
264
Benny Prijonoc3416832006-09-12 18:58:19 +0000265 docs
266 Contains Doxygen configuration file (doxygen.cfg) to generate online
267 documentation from the source files. The output documentation will be
268 put in this directory as well (for example, docs/html directory for
269 the HTML files).
270
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000271 (to generate Doxygen documentation from the source tree, just run
272 "doxygen docs/doxygen.cfg" in the individual project directory. The
273 generated files will reside in docs directory).
274
Benny Prijonoc3416832006-09-12 18:58:19 +0000275 include
276 Contains the header files for the project.
277
278 lib
279 Contains libraries produced by the build process.
280
281 src
282 Contains the source files of the project.
283
284
2852. Build Preparation
286 _________________________________________________________________
287
Benny Prijono646b7b72006-10-21 18:28:07 +00002882.1 Create config_site.h file
Benny Prijonoc3416832006-09-12 18:58:19 +0000289 _________________________________________________________________
290
Benny Prijono646b7b72006-10-21 18:28:07 +0000291 Before source files can be built, the pjlib/include/pj/config_site.h file
292 must be created (it can just be an empty file).
293
294 Note:
295 When the Makefile based build system is used, this process is taken
296 care by the Makefiles. But when non-Makefile based build system (such
297 as Visual Studio) is used, the config_site.h file must be created
298 manually.
299
300
301What is config_site.h File
302
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000303 The pjlib/include/pj/config_site.h contains local customizations to the
Benny Prijonoc3416832006-09-12 18:58:19 +0000304 libraries.
305
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000306 All customizations should be put in this file instead of modifying PJ's
307 files, because if PJ's files get modified, then those modified files will
308 not be updated the next time the source is synchronized. Or in other case,
309 the local modification may be overwritten with the fresh copy from the SVN.
Benny Prijonoc3416832006-09-12 18:58:19 +0000310
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000311 Putting the local customization to the config_site.h solves this problem,
312 because this file is not included in the version control, so it will never
313 be overwritten by "svn update" command.
Benny Prijonoc3416832006-09-12 18:58:19 +0000314
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000315 Please find list of configuration macros that can be overriden from these
316 files:
Benny Prijono646b7b72006-10-21 18:28:07 +0000317 * PJLIB Configuration (the pjlib/config.h file)
318 * PJLIB-UTIL Configuration (the pjlib-util/config.h file)
319 * PJMEDIA Configuration (the pjmedia/config.h file)
320 * PJSIP Configuration (the pjsip/sip_config.h file)
Benny Prijonoc3416832006-09-12 18:58:19 +0000321
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000322 A sample config_site.h file is also available in
Benny Prijonoc3416832006-09-12 18:58:19 +0000323 pjlib/include/config_site_sample.h.
324
Benny Prijonoc3416832006-09-12 18:58:19 +0000325
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000326Creating config_site.h file
Benny Prijonoc3416832006-09-12 18:58:19 +0000327
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000328 The simplest way is just to create an empty file, to use whetever default
329 values set by the libraries.
330
331 Another way to create the config_site.h file is to write something like the
332 following:
333
Benny Prijonoc3416832006-09-12 18:58:19 +0000334
335 // Uncomment to get minimum footprint (suitable for 1-2 concurrent calls
336 only)
337 //#define PJ_CONFIG_MINIMAL_SIZE
338 // Uncomment to get maximum performance
339 //#define PJ_CONFIG_MAXIMUM_SPEED
340 #include <pj/config_site_sample.h>
341
342
3432.2 Disk Space Requirements
344 _________________________________________________________________
345
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000346 The building process needs:
Benny Prijono646b7b72006-10-21 18:28:07 +0000347 about 50-60 MB of disk space to store the uncompressed source files, and
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000348 * about 30-50 MB of additional space for building each target
Benny Prijonoc3416832006-09-12 18:58:19 +0000349
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000350 (Visual Studio Debug and Release are considered as separate targets)
Benny Prijonoc3416832006-09-12 18:58:19 +0000351
352
3533. Building Linux, *nix, *BSD, and MacOS X Targets with GNU Build Systems
354 _________________________________________________________________
355
3563.1 Supported Targets
357 _________________________________________________________________
358
359 The new, autoconf based GNU build system can be used to build the
360 libraries/applications for the following targets:
361 * Linux/uC-Linux (i386, Opteron, Itanium, MIPS, PowerPC, etc.),
362 * MacOS X (PowerPC),
363 * mingw (i386),
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000364 * FreeBSD and maybe other BSD's (i386, Opteron, etc.),
365 * RTEMS with cross compilation (ARM, powerpc),
Benny Prijonoc3416832006-09-12 18:58:19 +0000366 * etc.
367
368
3693.2 Requirements
370 _________________________________________________________________
371
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000372 In order to use PJ's GNU build system, these typical GNU tools are needed:
373 * GNU make (other make will not work),
374 * GNU binutils for the target, and
375 * GNU gcc for the target.
Benny Prijonoc3416832006-09-12 18:58:19 +0000376
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000377 In addition, the appropriate "SDK" must be installed for the particular
378 target (this could just be a libc and the appropriate system abstraction
379 library such as Posix).
380
381 The build system is known to work on the following hosts:
382 * Linux, many types of distributions.
383 * MacOS X 10.2
384 * mingw (Win2K, XP)
385 * FreeBSD (must use gmake instead of make)
386
387 Building Win32 applications with cygwin is currently not supported (there is
388 some Windows header conflicts), but cross-compilations might just work.
Benny Prijonoc3416832006-09-12 18:58:19 +0000389
390
3913.3 Running configure
392 _________________________________________________________________
393
394Using Default Settings
395
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000396 Run "./configure" without any options to let the script detect the
Benny Prijonoc3416832006-09-12 18:58:19 +0000397 appropriate settings for the host:
398
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000399
400
Benny Prijonoc3416832006-09-12 18:58:19 +0000401 $ cd pjproject
402 $ ./configure
403 ...
404
405 Notes:
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000406 The default settings build the libraries in "release" mode, with
407 default CFLAGS set to "-O2 -DNDEBUG". To change the default CFLAGS,
408 we can use the usual "./configure CFLAGS='-g'" construct.
Benny Prijonoc3416832006-09-12 18:58:19 +0000409
410 Features Customization
411
412 With the new autoconf based build system, most configuration/customization
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000413 can be specified as configure arguments. The list of customizable features
414 can be viewed by running "./configure --help" command:
415
416
Benny Prijonoc3416832006-09-12 18:58:19 +0000417
418 $ cd pjproject
419 $ ./configure --help
420 ...
421 Optional Features:
422 --disable-floating-point Disable floating point where possible
423 --disable-sound Exclude sound (i.e. use null sound)
424 --disable-small-filter Exclude small filter in resampling
425 --disable-large-filter Exclude large filter in resampling
426 --disable-g711-plc Exclude G.711 Annex A PLC
427 --disable-speex-aec Exclude Speex Acoustic Echo Canceller/AEC
428 --disable-g711-codec Exclude G.711 codecs from the build
429 --disable-l16-codec Exclude Linear/L16 codec family from the build
430 --disable-gsm-codec Exclude GSM codec in the build
431 --disable-speex-codec Exclude Speex codecs in the build
432 --disable-ilbc-codec Exclude iLBC codec in the build
433 ...
434
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000435 Configuring Debug Version and Other Customizations
Benny Prijonoc3416832006-09-12 18:58:19 +0000436
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000437 The configure script accepts standard customization, which details can be
438 obtained by executing ./configure --help.
Benny Prijonoc3416832006-09-12 18:58:19 +0000439
Benny Prijono646b7b72006-10-21 18:28:07 +0000440 Below is an example of specifying CFLAGS in configure:
Benny Prijonoc3416832006-09-12 18:58:19 +0000441
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000442
443
Benny Prijono646b7b72006-10-21 18:28:07 +0000444 $ ./configure CFLAGS="-O3 -DNDEBUG -msoft-float -fno-builtin"
Benny Prijonoc3416832006-09-12 18:58:19 +0000445 ...
446
447
448 3.4 Cross Compilation
449 _________________________________________________________________
450
Benny Prijono646b7b72006-10-21 18:28:07 +0000451 Cross compilation should be supported, using the usual autoconf syntax:
Benny Prijonoc3416832006-09-12 18:58:19 +0000452
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000453
454
Benny Prijono646b7b72006-10-21 18:28:07 +0000455 $ ./configure --host=arm-elf-linux
Benny Prijonoc3416832006-09-12 18:58:19 +0000456 ...
457
Benny Prijono646b7b72006-10-21 18:28:07 +0000458 Since cross-compilation is not tested as often as the "normal" build, please
459 watch for the ./configure output for incorrect settings (well ideally this
460 should be done for normal build too).
461
462 Please refer to Porting Guide for further information about porting PJ
463 software.
464
Benny Prijonoc3416832006-09-12 18:58:19 +0000465
466 3.5 Running make
467 _________________________________________________________________
468
469 Once the configure script completes successfully, start the build process by
470 invoking these commands:
471
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000472
473
Benny Prijonoc3416832006-09-12 18:58:19 +0000474 $ cd pjproject
475 $ make dep
476 $ make
477
478 Note:
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000479 gmake may need to be specified instead of make for some hosts, to
480 invoke GNU make instead of the native make.
481
Benny Prijonoc3416832006-09-12 18:58:19 +0000482
483 Description of all make targets supported by the Makefile's:
484
485 all
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000486 The default (or first) target to build the libraries/binaries.
Benny Prijonoc3416832006-09-12 18:58:19 +0000487
488 dep, depend
489 Build dependencies rule from the source files.
490
491 clean
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000492 Clean the object files for current target, but keep the output
493 library/binary files intact.
Benny Prijonoc3416832006-09-12 18:58:19 +0000494
495 distclean, realclean
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000496 Remove all generated files (object, libraries, binaries, and
497 dependency files) for current target.
Benny Prijonoc3416832006-09-12 18:58:19 +0000498
499
500 Note:
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000501 make can be invoked either in the top-level PJ directory or in build
502 directory under each project to build only the particular project.
Benny Prijonoc3416832006-09-12 18:58:19 +0000503
504
Benny Prijono646b7b72006-10-21 18:28:07 +0000505 3.6 Build Customizations
506 _________________________________________________________________
507
508 Build features can be customized by specifying the options when running
509 ./configure as described in Running Configure above.
510
511 In addition, additional CFLAGS and LDFLAGS options can be put in user.mak
512 file in PJ root directory (this file may need to be created if it doesn't
513 exist). Below is a sample of user.mak file contents:
514
515
516
517 export CFLAGS += -msoft-float -fno-builtin
518 export LDFLAGS +=
519
520
Benny Prijonoc3416832006-09-12 18:58:19 +00005214. Building for Windows Targets with Microsoft Visual Studio
522 _________________________________________________________________
523
524 4.1 Requirements
525 _________________________________________________________________
526
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000527 The Microsoft Visual Studio based project files can be used with one of the
528 following:
Benny Prijonoc3416832006-09-12 18:58:19 +0000529
530 * Microsoft Visual Studio 6,
531 * Microsoft Visual Studio .NET 2002,
532 * Microsoft Visual Studio .NET 2003,
Benny Prijono646b7b72006-10-21 18:28:07 +0000533 * Microsoft Visual C++ Express 2005 with Platform SDK,
534 * DirectX SDK is needed if PJMEDIA DirectSound sound backend is explicitly
535 choosen (default is using PortAudio, which uses DirectSound via run-time
536 bindings, so DirectX SDK is not needed)
Benny Prijonoc3416832006-09-12 18:58:19 +0000537
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000538 For the host, the following are required:
539 * Windows NT, 2000, XP, 2003, or later ,
540 * Windows 95/98 should work too, but this has not been tested,
541 * Sufficient amount of RAM for the build process.
Benny Prijonoc3416832006-09-12 18:58:19 +0000542
543
544 4.2 Building the Projects
545 _________________________________________________________________
546
547 Follow the steps below to build the libraries/application using Visual
548 Studio:
549 1. Open Visual Studio 6 workspace file pjsip-apps/build/pjsip_apps.dsw. If
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000550 later version of Visual Studio is being used, it should convert the
Benny Prijonoc3416832006-09-12 18:58:19 +0000551 workspace file and project files into the new formats.
552 2. Set pjsua as Active Project.
553 3. Select Debug or Release build as appropriate.
554 4. Build the project. This will build pjsua application and all libraries
555 needed by pjsua.
556 5. After successful build, the pjsua application will be placed in
557 pjsip-apps/bin directory, and the libraries in lib directory under each
558 projects.
559
560 To build the samples:
561 1. (Still using the same workspace)
562 2. Set samples project as Active Project
563 3. Select Debug or Release build as appropriate.
564 4. Build the project. This will build all sample applications and all
565 libraries needed.
566 5. After successful build, the sample applications will be placed in
567 pjsip-apps/bin/samples directory, and the libraries in lib directory
568 under each projects.
569
570 4.3 Debugging the Sample Application
571 _________________________________________________________________
572
573 The sample applications are build using Samples.mak makefile, therefore it
574 is difficult to setup debugging session in Visual Studio for these
575 applications. To solve this issue, the pjsip_apps workspace contain one
576 project called sample_debug which can be used to debug the sample
577 application.
578
579 To setup debugging using sample_debug project:
580 1. (Still using pjsip_apps workspace)
581 2. Set sample_debug project as Active Project
582 3. Edit debug.c file inside this project.
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000583 4. Modify the #include line to include the particular sample application to
584 debug
Benny Prijonoc3416832006-09-12 18:58:19 +0000585 5. Select Debug build.
586 6. Build and debug the project.
587
588
5895. Building for Windows Mobile Targets (Windows CE/WinCE/PDA/SmartPhone)
590 _________________________________________________________________
591
592 PJ supports building SIP and media stacks and applications for Windows
593 Mobile targets. A very simple WinCE SIP user agent (with media) application
594 is provided just as proof of concept that the port works.
595
596 5.1 Requirements
597 _________________________________________________________________
598
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000599 One of the following development tools is needed to build SIP and media
600 components for Windows Mobile:
Benny Prijonoc3416832006-09-12 18:58:19 +0000601 * Microsoft Embedded Visual C++ 4 with appropriate SDKs, or
602 * Microsoft Visual Studio 2005 for Windows Mobile with appropriate SDKs.
603
604 Note that VS2005 is not directly supported (as I don't have the tools), but
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000605 it is reported to work (I assumed that VS2005 for Windows Mobile can import
606 EVC4 workspace file).
Benny Prijonoc3416832006-09-12 18:58:19 +0000607
608 5.2 Building the Projects
609 _________________________________________________________________
610
611 The Windows Mobile port is included in the main source distribution. Please
612 follow the following steps to build the WinCE libraries and sample
613 application:
614 1. Open pjsip-apps/build/wince-evc4/wince_demos.vcw workspace file. If
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000615 later version of EVC4 is being used, this may cause the workspace file
616 to be converted to the appropriate format.
Benny Prijonoc3416832006-09-12 18:58:19 +0000617 2. Select pjsua_wince project as the Active Project.
618 3. Select the appropriate SDK (for example Pocket PC 2003 SDK or SmartPhone
619 2003 SDK)
620 4. Select the appropriate configuration (for example, Win32 (WCE Emulator
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000621 Debug) to debug the program in emulator, or other configurations such as
622 ARMV4, MIPS, SH3, SH4, or whatever suitable for the device)
Benny Prijonoc3416832006-09-12 18:58:19 +0000623 5. Select the appropriate device (Emulator or the actual Device).
624 6. Build the project. This will build the sample WinCE application and all
625 libraries (SIP, Media, etc.) needed by this application.
626
627 Notes
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000628
629 + If the config_site.h includes config_site_sample.h file, then
630 there are certain configuration in config_site_sample.h that get
631 activated for Windows CE targets. Please make sure that these
632 configurations are suitable for the application.
633 + The libraries, binaries and object files produced by the build
634 process are located under build/wince-evc4/output directory of each
635 projects.
Benny Prijonoc3416832006-09-12 18:58:19 +0000636
637
Benny Prijonoabd2ae92006-09-13 11:02:26 +00006386. Using PJPROJECT with Applications
Benny Prijonoc3416832006-09-12 18:58:19 +0000639 _________________________________________________________________
640
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000641 Regardless of the build system being used, the following tasks are normally
642 needed to be done in order to build application to use PJSIP and PJMEDIA:
643 1. Put these include directories in the include search path:
Benny Prijonoc3416832006-09-12 18:58:19 +0000644 + pjlib/include
645 + pjlib-util/include
646 + pjmedia/include
647 + pjsip/include
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000648 2. Put these library directories in the library search path:
Benny Prijonoc3416832006-09-12 18:58:19 +0000649 + pjlib/lib
650 + pjlib-util/lib
651 + pjmedia/lib
652 + pjsip/lib
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000653 3. Include the relevant PJ header files in the application source file. For
654 example, using these would include ALL APIs exported by PJ:
Benny Prijonoc3416832006-09-12 18:58:19 +0000655
656 #include <pjlib.h>
657 #include <pjlib-util.h>
658 #include <pjsip.h>
659 #include <pjsip_ua.h>
660 #include <pjsip_simple.h>
661 #include <pjsua.h>
662 #include <pjmedia.h>
663 #include <pjmedia-codec.h>
664 (Note: the documentation of the relevant libraries should say which
665 header files should be included to get the declaration of the APIs).
666 4. Declare the OS macros.
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000667 + For Windows applications built with Visual Studio, we need to
668 declare PJ_WIN32=1 macro in the project settings (declaring the
669 macro in the source file may not be sufficient).
670 + For Windows Mobile applications build with Visual C++, we need to
671 declare PJ_WIN32_WINCE=1 macro in the project settings.
672 + For GNU build system/autoconf based build system, we need to
673 declare PJ_AUTOCONF=1 macro when compiling the applications.
Benny Prijonoc3416832006-09-12 18:58:19 +0000674 (Note: the old PJ build system requires declaring the target processor
675 with PJ_M_XXX=1 macro, but this has been made obsolete. The target
676 processor will be detected from compiler's predefined macro by
677 pjlib/config.h file).
678 5. Link with the appropriate PJ libraries. The following libraries will
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000679 need to be included in the library link specifications:
Benny Prijonoc3416832006-09-12 18:58:19 +0000680
681 pjlib
682 Base library used by all libraries.
683
684 pjlib-util
685 Auxiliary library containing scanner, XML, STUN, MD5, getopt,
686 etc, used by the SIP and media stack.
687
688 pjsip
689 SIP core stack library.
690
691 pjsip-ua
692 SIP user agent library containing INVITE session, call
693 transfer, client registration, etc.
694
695 pjsip-simple
696 SIP SIMPLE library for base event framework, presence, instant
697 messaging, etc.
698
699 pjsua
700 High level SIP UA library, combining SIP and media stack into
701 high-level easy to use API.
702
703 pjmedia
704 The media framework.
705
706 pjmedia-codec
707 Container library for various codecs such as GSM, Speex, and
708 iLBC.
709
710
711 Note: the actual library names will be appended with the target name and the
712 build configuration. For example:
713
714 For Visual Studio builds
715 The actual library names will look like
716 pjlib-i386-win32-vc6-debug.lib,
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000717 pjlib-i386-win32-vc6-release.lib, etc., depending on whether we
718 are building the Debug or Release version of the library.
719
720 An easier way to link with the libraries is to include PJ
721 project files in the workspace, and to configure project
722 dependencies so that the application depends on the PJ
723 libraries. This way, we don't need to manually add each PJ
724 libraries to the input library file specification, since VS
725 will automatically link the dependency libraries with the
726 application.
727
728 For Windows Mobile builds
729 Unfortunately the PJ libraries built for Windows Mobile will
730 not be placed in the usual lib directory, but rather under the
731 output directory under build/wince-evc4 project directory.
732
733 An easier way to link with the libraries is to include PJ
734 project files in the workspace, and to configure project
735 dependencies so that the application depends on the PJ
736 libraries. This way, we don't need to manually add each PJ
737 libraries to the input library file specification, since VS
738 will automatically link the dependency libraries with the
739 application.
Benny Prijonoc3416832006-09-12 18:58:19 +0000740
741 For GNU builds
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000742 Application's Makefile can get the PJ library suffix by
743 including PJ's build.mak file from the root PJ directory (the
744 suffix is contained in TARGET_NAME variable). For example, to
745 link with PJLIB and PJMEDIA, we can use this syntax in the
746 LDFLAGS: "-lpj-$(TARGET_NAME) -lpjmedia-$(TARGET_NAME)"
Benny Prijonoc3416832006-09-12 18:58:19 +0000747
748
Benny Prijono646b7b72006-10-21 18:28:07 +0000749 6. Link with system spesific libraries:
750
751 Windows
752 Add (among other things): wsock32.lib, ws2_32.lib, ole32.lib,
753 dsound.lib
754
755 Linux, *nix, *BSD
756 Add (among other things): '-lpthread -lm' (at least).
757
758 MacOS X
759 Add (among other things): '-framework CoreAudio -lpthread -lm'.
760
761
Benny Prijonoc3416832006-09-12 18:58:19 +0000762Appendix I: Common Problems/Frequently Asked Question (FAQ)
763 _________________________________________________________________
764
765 I.1 fatal error C1083: Cannot open include file: 'pj/config_site.h': No such
766 file or directory
767
Benny Prijonoabd2ae92006-09-13 11:02:26 +0000768 This error normally occurs when the config_site.h file has not been created.
769 This file needs to be created manually (an empty file is sufficient). Please
770 follow the Build Preparation instructions above to create this file.
Benny Prijonoc3416832006-09-12 18:58:19 +0000771
772
773
774
775
776
Benny Prijono646b7b72006-10-21 18:28:07 +0000777
778
779 _________________________________________________________________
780
781 Feedback:
782 Thanks for using PJ libraries and for reading this document. Please
783 send feedbacks or general comments to <bennylp at pjsip dot org>.
Benny Prijonoeec4d7c2006-03-09 16:19:20 +0000784