Benny Prijono | 10a2080 | 2006-03-02 21:52:18 +0000 | [diff] [blame] | 1 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 2 | Getting Started: Building and Using PJSIP and PJMEDIA |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 3 | |
Benny Prijono | 81d89ea | 2007-02-02 20:49:33 +0000 | [diff] [blame] | 4 | [Last Update: $Date: 2007-02-02 20:42:44 +0000 (Fri, 02 Feb 2007) $] |
Benny Prijono | 646b7b7 | 2006-10-21 18:28:07 +0000 | [diff] [blame] | 5 | |
Benny Prijono | 81d89ea | 2007-02-02 20:49:33 +0000 | [diff] [blame] | 6 | Print Friendly Page |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 7 | _________________________________________________________________ |
| 8 | |
| 9 | This article describes how to download, customize, build, and use the open |
| 10 | source PJSIP and PJMEDIA SIP and media stack. The online (and HTML) version |
| 11 | of this file can be downloaded from http://www.pjsip.org/using.htm |
Benny Prijono | db419fd | 2006-03-05 11:54:33 +0000 | [diff] [blame] | 12 | |
Benny Prijono | eec4d7c | 2006-03-09 16:19:20 +0000 | [diff] [blame] | 13 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 14 | Quick Info |
Benny Prijono | 646b7b7 | 2006-10-21 18:28:07 +0000 | [diff] [blame] | 15 | _________________________________________________________________ |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 16 | |
Benny Prijono | 646b7b7 | 2006-10-21 18:28:07 +0000 | [diff] [blame] | 17 | Building with GNU tools (Linux, *BSD, MacOS X, mingw, etc.) |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 18 | Generally these should be all that are needed to build the libraries, |
| 19 | applications, and samples: |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 20 | |
Benny Prijono | 81d89ea | 2007-02-02 20:49:33 +0000 | [diff] [blame] | 21 | $ ./configure |
| 22 | $ make dep && make clean && make |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 23 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 24 | Building Win32 Target with Microsoft Visual Studio |
| 25 | Generally we can just do these steps: |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 26 | |
Benny Prijono | 81d89ea | 2007-02-02 20:49:33 +0000 | [diff] [blame] | 27 | 1. Visual Studio 6: open pjproject.dsw workspace, |
| 28 | 2. Visual Studio 2005: open pjproject-vs8.sln solution, |
| 29 | 3. Create an empty pjlib/include/pj/config_site.h, and |
| 30 | 4. build the pjsua application. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 31 | |
| 32 | Building for Windows Mobile |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 33 | Generally these are all that are needed: |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 34 | |
| 35 | 1. Open pjsip-apps/build/wince-evc4/wince_demos.vcw EVC4 workspace, |
| 36 | 2. Create an empty pjlib/include/pj/config_site.h, and |
| 37 | 3. build the pjsua_wince application. |
| 38 | |
Benny Prijono | 81d89ea | 2007-02-02 20:49:33 +0000 | [diff] [blame] | 39 | Invoking Older Build System (e.g. for RTEMS) |
| 40 | Generally these should be all that are needed to build the libraries, |
| 41 | applications, and samples: |
| 42 | |
| 43 | $ ./configure-legacy |
| 44 | $ make dep && make clean && make |
| 45 | |
Benny Prijono | 646b7b7 | 2006-10-21 18:28:07 +0000 | [diff] [blame] | 46 | Locating Output Binaries/Libraries |
| 47 | Libraries will be put in lib directory, and binaries will be put in |
| 48 | bin directory, under each projects. |
| 49 | |
| 50 | Running the Applications |
| 51 | After successful build, you can try running pjsua application on |
Benny Prijono | 81d89ea | 2007-02-02 20:49:33 +0000 | [diff] [blame] | 52 | pjsip-apps/bin directory. PJSUA manual can be found in |
| 53 | http://www.pjsip.org/pjsua.htm page. |
Benny Prijono | eec4d7c | 2006-03-09 16:19:20 +0000 | [diff] [blame] | 54 | |
| 55 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 56 | Table of Contents: |
| 57 | _________________________________________________________________ |
Benny Prijono | eec4d7c | 2006-03-09 16:19:20 +0000 | [diff] [blame] | 58 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 59 | 1. Getting the Source Distribution |
| 60 | |
| 61 | 1.1 Getting the Release tarball |
| 62 | |
| 63 | 1.2 Getting from Subversion trunk |
| 64 | |
| 65 | 1.3 Source Directories Layout |
| 66 | |
| 67 | 2. Build Preparation |
| 68 | |
| 69 | 2.1 config_site.h file |
| 70 | |
| 71 | 2.2 Disk Space Requirements |
| 72 | |
Benny Prijono | 646b7b7 | 2006-10-21 18:28:07 +0000 | [diff] [blame] | 73 | 3. Building Linux, *nix, *BSD, and MacOS X Targets with GNU Build |
| 74 | Systems |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 75 | |
| 76 | 3.1 Supported Targets |
| 77 | |
| 78 | 3.2 Requirements |
| 79 | |
| 80 | 3.3 Running configure |
| 81 | |
| 82 | 3.4 Running make |
| 83 | |
| 84 | 3.5 Cross Compilation |
| 85 | |
Benny Prijono | 646b7b7 | 2006-10-21 18:28:07 +0000 | [diff] [blame] | 86 | 3.6 Build Customizations |
| 87 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 88 | 4. Building for Windows Targets with Microsoft Visual Studio |
| 89 | |
| 90 | 4.1 Requirements |
| 91 | |
| 92 | 4.2 Building the Projects |
| 93 | |
| 94 | 4.3 Debugging the Sample Application |
| 95 | |
| 96 | 5. Building for Windows Mobile Targets (Windows CE/WinCE/PDA/SmartPhone) |
| 97 | |
| 98 | 5.1 Requirements |
| 99 | |
| 100 | 5.2 Building the Projects |
| 101 | |
Benny Prijono | 81d89ea | 2007-02-02 20:49:33 +0000 | [diff] [blame] | 102 | 6. Older PJLIB Build System for Non-Autoconf Targets (e.g. RTEMS) |
| 103 | |
| 104 | 6.1 Supported Targets |
| 105 | |
| 106 | 6.2 Invoking the Build System |
| 107 | |
| 108 | 7. Running the Applications |
| 109 | |
| 110 | 7.1 pjsua |
| 111 | |
| 112 | 7.2 Sample Applications |
| 113 | |
| 114 | 7.3 pjlib-test |
| 115 | |
| 116 | 7.4 pjsip-test |
| 117 | |
| 118 | 8. Using PJPROJECT with Applications |
Benny Prijono | eec4d7c | 2006-03-09 16:19:20 +0000 | [diff] [blame] | 119 | |
| 120 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 121 | Appendix I: Common Problems/Frequently Asked Question (FAQ) |
Benny Prijono | eec4d7c | 2006-03-09 16:19:20 +0000 | [diff] [blame] | 122 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 123 | I.1 fatal error C1083: Cannot open include file: 'pj/config_site.h': |
| 124 | No such file or directory |
| 125 | |
| 126 | |
| 127 | 1. Getting the Source Code Distribution |
| 128 | _________________________________________________________________ |
| 129 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 130 | All libraries (PJLIB, PJLIB-UTIL, PJSIP, PJMEDIA, and PJMEDIA-CODEC) are |
| 131 | currently distributed under a single source tree, collectively named as |
| 132 | PJPROJECT or just PJ libraries. These libraries can be obtained by either |
| 133 | downloading the release tarball or getting them from the Subversion trunk. |
| 134 | |
| 135 | |
| 136 | 1.1 Getting the Release tarball |
| 137 | _________________________________________________________________ |
| 138 | |
| 139 | Getting the released tarball is a convenient way to obtain stable version of |
| 140 | PJPROJECT. The tarball may not contain the latest features or bug-fixes, but |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 141 | normally it is considered more stable as each will be tested more rigorously |
| 142 | before released. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 143 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 144 | The latest released tarball can be downloaded from the |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 145 | http://www.pjsip.org/download.htm. |
| 146 | |
| 147 | |
| 148 | 1.2 Getting from Subversion trunk |
| 149 | _________________________________________________________________ |
| 150 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 151 | PJPROJECT Subversion repository will always contain the latest/most |
| 152 | up-to-date version of the sources. Normally the Subversion repository is |
| 153 | always kept in a "good" state. However, there's always a chance that things |
| 154 | break and the tree doesn't build correctly (particularly for the |
| 155 | "not-so-popular" targets), so please consult the mailing list should there |
| 156 | be any problems. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 157 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 158 | Using Subversion also has benefits of keeping the local copy of the source |
| 159 | up to date with the main PJ source tree and to easily track the changes made |
| 160 | to the local copy, if any. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 161 | |
| 162 | |
| 163 | What is Subversion |
| 164 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 165 | Subversion (SVN) is Open Source version control system similar to CVS. |
| 166 | Subversion homepage is in http://subversion.tigris.org/ |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 167 | |
| 168 | |
| 169 | Getting Subversion Client |
| 170 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 171 | A Subversion (SVN) client is needed to download the PJ source files from |
| 172 | pjsip.org SVN tree. SVN client binaries can be downloaded from |
| 173 | http://subversion.tigris.org/, and the program should be available for |
| 174 | Windows, Linux, MacOS X, and many more platforms. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 175 | |
| 176 | |
| 177 | Getting the Source for The First Time |
| 178 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 179 | Once Subversion client is installed, we can use these commands to initially |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 180 | retrieve the latest sources from the Subversion trunk: |
| 181 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 182 | |
| 183 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 184 | $ svn co http://svn.pjproject.net/repos/pjproject/trunk pjproject |
| 185 | $ cd pjproject |
| 186 | |
| 187 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 188 | Keeping The Local Copy Up-to-Date |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 189 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 190 | Once sources have been downloaded, we can keep the local copy up to date by |
| 191 | periodically synchronizing the local source with the latest revision from |
| 192 | the PJ's Subversion trunk. The mailing list provides best source of |
| 193 | information about the availability of new updates in the trunk. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 194 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 195 | To update the local copy with the latest changes in the main PJ's |
| 196 | repository: |
| 197 | |
| 198 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 199 | |
| 200 | $ cd pjproject |
| 201 | $ svn update |
| 202 | |
| 203 | |
| 204 | Tracking Local and Remote Changes |
| 205 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 206 | To see what files have been changed locally: |
| 207 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 208 | |
| 209 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 210 | $ cd pjproject |
| 211 | $ svn status |
| 212 | |
| 213 | The above command only compares local file against the original local copy, |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 214 | so it doesn't require Internet connection while performing the check. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 215 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 216 | To see both what files have been changed locally and what files have been |
| 217 | updated in the PJ's Subversion repository: |
| 218 | |
| 219 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 220 | |
| 221 | $ cd pjproject |
| 222 | $ svn status -u |
| 223 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 224 | Note that this command requires active Internet connection to query the |
| 225 | status of PJPROJECT's source repository. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 226 | |
| 227 | |
| 228 | 1.3 Source Directories Layout |
| 229 | _________________________________________________________________ |
| 230 | |
| 231 | Top-Level Directory Layout |
| 232 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 233 | The top-level directories (denoted as $TOP here) in the source distribution |
| 234 | contains the following sub-directories: |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 235 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 236 | $TOP/build |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 237 | Contains makefiles that are common for all projects. |
| 238 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 239 | $TOP/pjlib |
| 240 | Contains header and source files of PJLIB. PJLIB is the base |
| 241 | portability and framework library which is used by all other |
| 242 | libraries |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 243 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 244 | $TOP/pjlib-util |
| 245 | Contains PJLIB-UTIL header and source files. PJLIB-UTIL is an |
| 246 | auxiliary library that contains utility functions such as scanner, |
| 247 | XML, STUN, MD5 algorithm, getopt() implementation, etc. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 248 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 249 | $TOP/pjmedia |
| 250 | Contains PJMEDIA and PJMEDIA-CODEC header and source files. The |
| 251 | sources of various codecs (such as GSM, Speex, and iLBC) can be found |
| 252 | under this directory. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 253 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 254 | $TOP/pjsip |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 255 | Contains PJSIP header and source files. |
| 256 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 257 | $TOP/pjsip-apps |
| 258 | Contains source code for PJSUA and various sample applications. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 259 | |
| 260 | |
| 261 | Individual Directory Inside Each Project |
| 262 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 263 | Each library directory further contains these sub-directories: |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 264 | |
| 265 | bin |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 266 | Contains binaries produced by the build process. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 267 | |
| 268 | build |
| 269 | Contains build scripts/makefiles, project files, project workspace, |
| 270 | etc. to build the project. In particular, it contains one Makefile |
| 271 | file to build the project with GNU build systems, and a *.dsw |
| 272 | workspace file to build the library with Microsoft Visual Studio 6 or |
| 273 | later. |
| 274 | |
| 275 | build/output |
| 276 | The build/output directory contains the object files and other files |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 277 | generated by the build process. To support building multiple targets |
| 278 | with a single source tree, each build target will occupy a different |
| 279 | subdirectory under this directory. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 280 | |
| 281 | build/wince-evc4 |
| 282 | This directory contains the project/workspace files to build Windows |
| 283 | CE/WinCE version of the project using Microsoft Embedded Visual C++ |
| 284 | 4. |
| 285 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 286 | build/wince-evc4/output |
| 287 | This directory contains the library, executable, and object files |
| 288 | generated by Windows Mobile build process. |
| 289 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 290 | docs |
| 291 | Contains Doxygen configuration file (doxygen.cfg) to generate online |
| 292 | documentation from the source files. The output documentation will be |
| 293 | put in this directory as well (for example, docs/html directory for |
| 294 | the HTML files). |
| 295 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 296 | (to generate Doxygen documentation from the source tree, just run |
| 297 | "doxygen docs/doxygen.cfg" in the individual project directory. The |
| 298 | generated files will reside in docs directory). |
| 299 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 300 | include |
| 301 | Contains the header files for the project. |
| 302 | |
| 303 | lib |
| 304 | Contains libraries produced by the build process. |
| 305 | |
| 306 | src |
| 307 | Contains the source files of the project. |
| 308 | |
| 309 | |
| 310 | 2. Build Preparation |
| 311 | _________________________________________________________________ |
| 312 | |
Benny Prijono | 646b7b7 | 2006-10-21 18:28:07 +0000 | [diff] [blame] | 313 | 2.1 Create config_site.h file |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 314 | _________________________________________________________________ |
| 315 | |
Benny Prijono | 646b7b7 | 2006-10-21 18:28:07 +0000 | [diff] [blame] | 316 | Before source files can be built, the pjlib/include/pj/config_site.h file |
| 317 | must be created (it can just be an empty file). |
| 318 | |
| 319 | Note: |
| 320 | When the Makefile based build system is used, this process is taken |
| 321 | care by the Makefiles. But when non-Makefile based build system (such |
| 322 | as Visual Studio) is used, the config_site.h file must be created |
| 323 | manually. |
| 324 | |
| 325 | |
| 326 | What is config_site.h File |
| 327 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 328 | The pjlib/include/pj/config_site.h contains local customizations to the |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 329 | libraries. |
| 330 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 331 | All customizations should be put in this file instead of modifying PJ's |
| 332 | files, because if PJ's files get modified, then those modified files will |
| 333 | not be updated the next time the source is synchronized. Or in other case, |
| 334 | the local modification may be overwritten with the fresh copy from the SVN. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 335 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 336 | Putting the local customization to the config_site.h solves this problem, |
| 337 | because this file is not included in the version control, so it will never |
| 338 | be overwritten by "svn update" command. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 339 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 340 | Please find list of configuration macros that can be overriden from these |
| 341 | files: |
Benny Prijono | 646b7b7 | 2006-10-21 18:28:07 +0000 | [diff] [blame] | 342 | * PJLIB Configuration (the pjlib/config.h file) |
| 343 | * PJLIB-UTIL Configuration (the pjlib-util/config.h file) |
| 344 | * PJMEDIA Configuration (the pjmedia/config.h file) |
| 345 | * PJSIP Configuration (the pjsip/sip_config.h file) |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 346 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 347 | A sample config_site.h file is also available in |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 348 | pjlib/include/config_site_sample.h. |
| 349 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 350 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 351 | Creating config_site.h file |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 352 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 353 | The simplest way is just to create an empty file, to use whetever default |
| 354 | values set by the libraries. |
| 355 | |
| 356 | Another way to create the config_site.h file is to write something like the |
| 357 | following: |
| 358 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 359 | |
| 360 | // Uncomment to get minimum footprint (suitable for 1-2 concurrent calls |
| 361 | only) |
| 362 | //#define PJ_CONFIG_MINIMAL_SIZE |
| 363 | // Uncomment to get maximum performance |
| 364 | //#define PJ_CONFIG_MAXIMUM_SPEED |
| 365 | #include <pj/config_site_sample.h> |
| 366 | |
| 367 | |
| 368 | 2.2 Disk Space Requirements |
| 369 | _________________________________________________________________ |
| 370 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 371 | The building process needs: |
Benny Prijono | 646b7b7 | 2006-10-21 18:28:07 +0000 | [diff] [blame] | 372 | about 50-60 MB of disk space to store the uncompressed source files, and |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 373 | * about 30-50 MB of additional space for building each target |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 374 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 375 | (Visual Studio Debug and Release are considered as separate targets) |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 376 | |
| 377 | |
| 378 | 3. Building Linux, *nix, *BSD, and MacOS X Targets with GNU Build Systems |
| 379 | _________________________________________________________________ |
| 380 | |
| 381 | 3.1 Supported Targets |
| 382 | _________________________________________________________________ |
| 383 | |
| 384 | The new, autoconf based GNU build system can be used to build the |
| 385 | libraries/applications for the following targets: |
| 386 | * Linux/uC-Linux (i386, Opteron, Itanium, MIPS, PowerPC, etc.), |
| 387 | * MacOS X (PowerPC), |
| 388 | * mingw (i386), |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 389 | * FreeBSD and maybe other BSD's (i386, Opteron, etc.), |
| 390 | * RTEMS with cross compilation (ARM, powerpc), |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 391 | * etc. |
| 392 | |
| 393 | |
| 394 | 3.2 Requirements |
| 395 | _________________________________________________________________ |
| 396 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 397 | In order to use PJ's GNU build system, these typical GNU tools are needed: |
| 398 | * GNU make (other make will not work), |
| 399 | * GNU binutils for the target, and |
| 400 | * GNU gcc for the target. |
Benny Prijono | 81d89ea | 2007-02-02 20:49:33 +0000 | [diff] [blame] | 401 | * OpenSSL header files/libraries (optional) if TLS support is wanted. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 402 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 403 | In addition, the appropriate "SDK" must be installed for the particular |
| 404 | target (this could just be a libc and the appropriate system abstraction |
| 405 | library such as Posix). |
| 406 | |
| 407 | The build system is known to work on the following hosts: |
| 408 | * Linux, many types of distributions. |
| 409 | * MacOS X 10.2 |
| 410 | * mingw (Win2K, XP) |
| 411 | * FreeBSD (must use gmake instead of make) |
| 412 | |
Benny Prijono | 81d89ea | 2007-02-02 20:49:33 +0000 | [diff] [blame] | 413 | Building Win32 applications with Cygwin is currently not supported by the |
| 414 | autoconf script (there is some Windows header conflicts), but one can still |
| 415 | use the old configure script by calling ./configure-legacy. More over, |
| 416 | cross-compilations might also work with Cygwin. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 417 | |
| 418 | |
| 419 | 3.3 Running configure |
| 420 | _________________________________________________________________ |
| 421 | |
| 422 | Using Default Settings |
| 423 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 424 | Run "./configure" without any options to let the script detect the |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 425 | appropriate settings for the host: |
| 426 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 427 | |
| 428 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 429 | $ cd pjproject |
| 430 | $ ./configure |
| 431 | ... |
| 432 | |
| 433 | Notes: |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 434 | The default settings build the libraries in "release" mode, with |
| 435 | default CFLAGS set to "-O2 -DNDEBUG". To change the default CFLAGS, |
| 436 | we can use the usual "./configure CFLAGS='-g'" construct. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 437 | |
| 438 | Features Customization |
| 439 | |
| 440 | With the new autoconf based build system, most configuration/customization |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 441 | can be specified as configure arguments. The list of customizable features |
| 442 | can be viewed by running "./configure --help" command: |
| 443 | |
| 444 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 445 | |
| 446 | $ cd pjproject |
| 447 | $ ./configure --help |
| 448 | ... |
| 449 | Optional Features: |
Benny Prijono | 81d89ea | 2007-02-02 20:49:33 +0000 | [diff] [blame] | 450 | --disable-floating-point Disable floating point where possible |
| 451 | --disable-sound Exclude sound (i.e. use null sound) |
| 452 | --disable-small-filter Exclude small filter in resampling |
| 453 | --disable-large-filter Exclude large filter in resampling |
| 454 | --disable-g711-plc Exclude G.711 Annex A PLC |
| 455 | --disable-speex-aec Exclude Speex Acoustic Echo Canceller/AEC |
| 456 | --disable-g711-codec Exclude G.711 codecs from the build |
| 457 | --disable-l16-codec Exclude Linear/L16 codec family from the build |
| 458 | --disable-gsm-codec Exclude GSM codec in the build |
| 459 | --disable-speex-codec Exclude Speex codecs in the build |
| 460 | --disable-ilbc-codec Exclude iLBC codec in the build |
| 461 | --disable-tls Force excluding TLS support (default is autodetected based on |
| 462 | OpenSSL availability) |
| 463 | ... |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 464 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 465 | Configuring Debug Version and Other Customizations |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 466 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 467 | The configure script accepts standard customization, which details can be |
| 468 | obtained by executing ./configure --help. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 469 | |
Benny Prijono | 646b7b7 | 2006-10-21 18:28:07 +0000 | [diff] [blame] | 470 | Below is an example of specifying CFLAGS in configure: |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 471 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 472 | |
| 473 | |
Benny Prijono | 646b7b7 | 2006-10-21 18:28:07 +0000 | [diff] [blame] | 474 | $ ./configure CFLAGS="-O3 -DNDEBUG -msoft-float -fno-builtin" |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 475 | ... |
| 476 | |
Benny Prijono | 81d89ea | 2007-02-02 20:49:33 +0000 | [diff] [blame] | 477 | Configuring TLS Support |
| 478 | |
| 479 | By default, TLS support is configured based on the availability of OpenSSL |
| 480 | header files and libraries. If OpenSSL is available at the default include |
| 481 | and library path locations, TLS will be enabled by the configure script. |
| 482 | |
| 483 | You can explicitly disable TLS support by giving the configure script |
| 484 | --disable-tls option. |
| 485 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 486 | |
| 487 | 3.4 Cross Compilation |
| 488 | _________________________________________________________________ |
| 489 | |
Benny Prijono | 646b7b7 | 2006-10-21 18:28:07 +0000 | [diff] [blame] | 490 | Cross compilation should be supported, using the usual autoconf syntax: |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 491 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 492 | |
| 493 | |
Benny Prijono | 646b7b7 | 2006-10-21 18:28:07 +0000 | [diff] [blame] | 494 | $ ./configure --host=arm-elf-linux |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 495 | ... |
| 496 | |
Benny Prijono | 646b7b7 | 2006-10-21 18:28:07 +0000 | [diff] [blame] | 497 | Since cross-compilation is not tested as often as the "normal" build, please |
| 498 | watch for the ./configure output for incorrect settings (well ideally this |
| 499 | should be done for normal build too). |
| 500 | |
| 501 | Please refer to Porting Guide for further information about porting PJ |
| 502 | software. |
| 503 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 504 | |
| 505 | 3.5 Running make |
| 506 | _________________________________________________________________ |
| 507 | |
| 508 | Once the configure script completes successfully, start the build process by |
| 509 | invoking these commands: |
| 510 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 511 | |
| 512 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 513 | $ cd pjproject |
| 514 | $ make dep |
| 515 | $ make |
| 516 | |
| 517 | Note: |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 518 | gmake may need to be specified instead of make for some hosts, to |
| 519 | invoke GNU make instead of the native make. |
| 520 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 521 | |
| 522 | Description of all make targets supported by the Makefile's: |
| 523 | |
| 524 | all |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 525 | The default (or first) target to build the libraries/binaries. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 526 | |
| 527 | dep, depend |
| 528 | Build dependencies rule from the source files. |
| 529 | |
| 530 | clean |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 531 | Clean the object files for current target, but keep the output |
| 532 | library/binary files intact. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 533 | |
| 534 | distclean, realclean |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 535 | Remove all generated files (object, libraries, binaries, and |
| 536 | dependency files) for current target. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 537 | |
| 538 | |
| 539 | Note: |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 540 | make can be invoked either in the top-level PJ directory or in build |
| 541 | directory under each project to build only the particular project. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 542 | |
| 543 | |
Benny Prijono | 646b7b7 | 2006-10-21 18:28:07 +0000 | [diff] [blame] | 544 | 3.6 Build Customizations |
| 545 | _________________________________________________________________ |
| 546 | |
| 547 | Build features can be customized by specifying the options when running |
| 548 | ./configure as described in Running Configure above. |
| 549 | |
| 550 | In addition, additional CFLAGS and LDFLAGS options can be put in user.mak |
| 551 | file in PJ root directory (this file may need to be created if it doesn't |
| 552 | exist). Below is a sample of user.mak file contents: |
| 553 | |
| 554 | |
| 555 | |
| 556 | export CFLAGS += -msoft-float -fno-builtin |
| 557 | export LDFLAGS += |
| 558 | |
| 559 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 560 | 4. Building for Windows Targets with Microsoft Visual Studio |
| 561 | _________________________________________________________________ |
| 562 | |
| 563 | 4.1 Requirements |
| 564 | _________________________________________________________________ |
| 565 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 566 | The Microsoft Visual Studio based project files can be used with one of the |
| 567 | following: |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 568 | |
| 569 | * Microsoft Visual Studio 6, |
| 570 | * Microsoft Visual Studio .NET 2002, |
| 571 | * Microsoft Visual Studio .NET 2003, |
Benny Prijono | 81d89ea | 2007-02-02 20:49:33 +0000 | [diff] [blame] | 572 | * Microsoft Visual C++ 2005 (including Express edition), |
| 573 | |
| 574 | In addition, the following SDK's are needed: |
| 575 | * Platform SDK, if you're using Visual Studio 2005 Express (tested with |
| 576 | Platform SDK for Windows Server 2003 SP1), |
| 577 | * DirectX SDK (tested with DirectX version 8 and 9), |
| 578 | * OpenSSL development kit would be needed if TLS support is wanted, or |
| 579 | otherwise this is optional. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 580 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 581 | For the host, the following are required: |
| 582 | * Windows NT, 2000, XP, 2003, or later , |
| 583 | * Windows 95/98 should work too, but this has not been tested, |
Benny Prijono | 81d89ea | 2007-02-02 20:49:33 +0000 | [diff] [blame] | 584 | * Sufficient amount of RAM for the build process (at least 256MB). |
| 585 | |
| 586 | |
| 587 | Enabling TLS Support with OpenSSL |
| 588 | |
| 589 | If TLS support is wanted, then OpenSSL SDK must be installed in the |
| 590 | development host. |
| 591 | |
| 592 | To install OpenSSL SDK from the Win32 binary distribution: |
| 593 | 1. Install OpenSSL SDK to any folder (e.g. C:\OpenSSL) |
| 594 | 2. Add OpenSSL DLL location to the system PATH. |
| 595 | 3. Add OpenSSL include path to Visual Studio includes search directory. |
| 596 | Make sure that OpenSSL header files can be accessed from the program |
| 597 | with #include <openssl/ssl.h> construct. |
| 598 | 4. Add OpenSSL library path to Visual Studio library search directory. Make |
| 599 | sure the following libraries are accessible: |
| 600 | + For Debug build: libeay32MTd and ssleay32MTd. |
| 601 | + For Release build: libeay32MT and ssleay32MT. |
| 602 | |
| 603 | Then to enable TLS transport support in PJSIP, just add |
| 604 | |
| 605 | #define PJSIP_HAS_TLS_TRANSPORT 1 |
| 606 | |
| 607 | in your pj/config_site.h. When this macro is defined, OpenSSL libraries will |
| 608 | be automatically linked to the application via the #pragma construct in |
| 609 | sip_transport_tls_ossl.c file. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 610 | |
| 611 | |
| 612 | 4.2 Building the Projects |
| 613 | _________________________________________________________________ |
| 614 | |
| 615 | Follow the steps below to build the libraries/application using Visual |
| 616 | Studio: |
Benny Prijono | 81d89ea | 2007-02-02 20:49:33 +0000 | [diff] [blame] | 617 | 1. For Visual Studio 6: open pjproject.dsw workspace file. |
| 618 | 2. For Visual Studio 8 (VS 2005): open pjproject-vs8.sln solution file. |
| 619 | 3. Set pjsua as Active Project. |
| 620 | 4. Select Debug or Release build as appropriate. |
| 621 | 5. Build the project. This will build pjsua application and all libraries |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 622 | needed by pjsua. |
Benny Prijono | 81d89ea | 2007-02-02 20:49:33 +0000 | [diff] [blame] | 623 | 6. After successful build, the pjsua application will be placed in |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 624 | pjsip-apps/bin directory, and the libraries in lib directory under each |
| 625 | projects. |
| 626 | |
| 627 | To build the samples: |
| 628 | 1. (Still using the same workspace) |
| 629 | 2. Set samples project as Active Project |
| 630 | 3. Select Debug or Release build as appropriate. |
| 631 | 4. Build the project. This will build all sample applications and all |
| 632 | libraries needed. |
| 633 | 5. After successful build, the sample applications will be placed in |
| 634 | pjsip-apps/bin/samples directory, and the libraries in lib directory |
| 635 | under each projects. |
| 636 | |
| 637 | 4.3 Debugging the Sample Application |
| 638 | _________________________________________________________________ |
| 639 | |
| 640 | The sample applications are build using Samples.mak makefile, therefore it |
| 641 | is difficult to setup debugging session in Visual Studio for these |
| 642 | applications. To solve this issue, the pjsip_apps workspace contain one |
| 643 | project called sample_debug which can be used to debug the sample |
| 644 | application. |
| 645 | |
| 646 | To setup debugging using sample_debug project: |
| 647 | 1. (Still using pjsip_apps workspace) |
| 648 | 2. Set sample_debug project as Active Project |
| 649 | 3. Edit debug.c file inside this project. |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 650 | 4. Modify the #include line to include the particular sample application to |
| 651 | debug |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 652 | 5. Select Debug build. |
| 653 | 6. Build and debug the project. |
| 654 | |
| 655 | |
| 656 | 5. Building for Windows Mobile Targets (Windows CE/WinCE/PDA/SmartPhone) |
| 657 | _________________________________________________________________ |
| 658 | |
| 659 | PJ supports building SIP and media stacks and applications for Windows |
| 660 | Mobile targets. A very simple WinCE SIP user agent (with media) application |
| 661 | is provided just as proof of concept that the port works. |
| 662 | |
| 663 | 5.1 Requirements |
| 664 | _________________________________________________________________ |
| 665 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 666 | One of the following development tools is needed to build SIP and media |
| 667 | components for Windows Mobile: |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 668 | * Microsoft Embedded Visual C++ 4 with appropriate SDKs, or |
| 669 | * Microsoft Visual Studio 2005 for Windows Mobile with appropriate SDKs. |
| 670 | |
| 671 | Note that VS2005 is not directly supported (as I don't have the tools), but |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 672 | it is reported to work (I assumed that VS2005 for Windows Mobile can import |
| 673 | EVC4 workspace file). |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 674 | |
| 675 | 5.2 Building the Projects |
| 676 | _________________________________________________________________ |
| 677 | |
| 678 | The Windows Mobile port is included in the main source distribution. Please |
| 679 | follow the following steps to build the WinCE libraries and sample |
| 680 | application: |
| 681 | 1. Open pjsip-apps/build/wince-evc4/wince_demos.vcw workspace file. If |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 682 | later version of EVC4 is being used, this may cause the workspace file |
| 683 | to be converted to the appropriate format. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 684 | 2. Select pjsua_wince project as the Active Project. |
| 685 | 3. Select the appropriate SDK (for example Pocket PC 2003 SDK or SmartPhone |
| 686 | 2003 SDK) |
| 687 | 4. Select the appropriate configuration (for example, Win32 (WCE Emulator |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 688 | Debug) to debug the program in emulator, or other configurations such as |
| 689 | ARMV4, MIPS, SH3, SH4, or whatever suitable for the device) |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 690 | 5. Select the appropriate device (Emulator or the actual Device). |
| 691 | 6. Build the project. This will build the sample WinCE application and all |
| 692 | libraries (SIP, Media, etc.) needed by this application. |
| 693 | |
| 694 | Notes |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 695 | |
| 696 | + If the config_site.h includes config_site_sample.h file, then |
| 697 | there are certain configuration in config_site_sample.h that get |
| 698 | activated for Windows CE targets. Please make sure that these |
| 699 | configurations are suitable for the application. |
| 700 | + The libraries, binaries and object files produced by the build |
| 701 | process are located under build/wince-evc4/output directory of each |
| 702 | projects. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 703 | |
| 704 | |
Benny Prijono | 81d89ea | 2007-02-02 20:49:33 +0000 | [diff] [blame] | 705 | 6. Older PJLIB Build System for Non-Autoconf Targets (e.g. RTEMS) |
| 706 | _________________________________________________________________ |
| 707 | |
| 708 | The old PJLIB build system can still be used for building PJ libraries, for |
| 709 | example for RTEMS target. Please see the Porting PJLIB page in PJLIB |
| 710 | Reference documentation for information on how to support new target using |
| 711 | this build system. |
| 712 | |
| 713 | 6.1 Supported Targets |
| 714 | _________________________________________________________________ |
| 715 | |
| 716 | The older build system supports building PJ libraries for the following |
| 717 | operating systems: |
| 718 | * RTEMS |
| 719 | * Linux |
| 720 | * MacOS X |
| 721 | * Cygwin and Mingw |
| 722 | |
| 723 | And it supports the following target architectures: |
| 724 | * i386, x86_64, itanium |
| 725 | * ARM |
| 726 | * mips |
| 727 | * powerpc |
| 728 | * mpc860 |
| 729 | * etc. |
| 730 | |
| 731 | For other targets, specific files need to be added to the build system, |
| 732 | please see the Porting PJLIB page in PJLIB Reference documentation for |
| 733 | details. |
| 734 | |
| 735 | 6.2 Invoking the Build System |
| 736 | _________________________________________________________________ |
| 737 | |
| 738 | To invoke the older build system, run the following: |
| 739 | |
| 740 | |
| 741 | |
| 742 | $ cd pjproject |
| 743 | $ ./configure-legacy |
| 744 | $ make dep && make clean && make |
| 745 | |
| 746 | |
| 747 | |
| 748 | 7. Running the Applications |
| 749 | _________________________________________________________________ |
| 750 | |
| 751 | Upon successful build, the output libraries (PJLIB, PJLIB-UTIL, PJMEDIA, |
| 752 | PJSIP, etc.) are put under ./lib sub-directory under each project directory. |
| 753 | In addition, some applications may also be built, and such applications will |
| 754 | be put in ./bin sub-directory under each project directory. |
| 755 | |
| 756 | |
| 757 | 7.1 pjsua |
| 758 | _________________________________________________________________ |
| 759 | |
| 760 | pjsua is the reference implementation for both PJSIP and PJMEDIA stack, and |
| 761 | is the main target of the build system. Upon successful build, pjsua |
| 762 | application will be put in pjsip-apps/bin directory. |
| 763 | |
| 764 | pjsua manual can be found in pjsua Manual Page. |
| 765 | |
| 766 | |
| 767 | 7.2 Sample Applications |
| 768 | _________________________________________________________________ |
| 769 | |
| 770 | Sample applications will be built with the Makefile build system. For Visual |
| 771 | Studio, you have to build the samples manually by selecting and building the |
| 772 | Samples project inside pjsip-apps/build/pjsip_apps.dsw project workspace. |
| 773 | |
| 774 | Upon successful build, the sample applications are put in |
| 775 | pjsip-apps/bin/samples directory. |
| 776 | |
| 777 | The sample applications are described in PJMEDIA Samples Page and |
| 778 | PJSIP Samples Page in the website. |
| 779 | |
| 780 | |
| 781 | 7.3 pjlib-test |
| 782 | _________________________________________________________________ |
| 783 | |
| 784 | pjlib-test contains comprehensive tests for testing PJLIB functionality. |
| 785 | This application will only be built when the Makefile build system is used; |
| 786 | with Visual Studio, one has to open pjlib.dsw project in pjlib/build |
| 787 | directory to build this application. |
| 788 | |
| 789 | If you're porting PJLIB to new target, it is recommended to run this |
| 790 | application to make sure that all functionalities works as expected. |
| 791 | |
| 792 | |
| 793 | 7.4 pjsip-test |
| 794 | _________________________________________________________________ |
| 795 | |
| 796 | pjsip-test contains codes for testing various SIP functionalities in PJSIP |
| 797 | and also to benchmark static performance metrics such as message parsing per |
| 798 | second. |
| 799 | |
| 800 | |
| 801 | |
| 802 | 8. Using PJPROJECT with Applications |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 803 | _________________________________________________________________ |
| 804 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 805 | Regardless of the build system being used, the following tasks are normally |
| 806 | needed to be done in order to build application to use PJSIP and PJMEDIA: |
| 807 | 1. Put these include directories in the include search path: |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 808 | + pjlib/include |
| 809 | + pjlib-util/include |
| 810 | + pjmedia/include |
| 811 | + pjsip/include |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 812 | 2. Put these library directories in the library search path: |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 813 | + pjlib/lib |
| 814 | + pjlib-util/lib |
| 815 | + pjmedia/lib |
| 816 | + pjsip/lib |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 817 | 3. Include the relevant PJ header files in the application source file. For |
| 818 | example, using these would include ALL APIs exported by PJ: |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 819 | |
| 820 | #include <pjlib.h> |
| 821 | #include <pjlib-util.h> |
| 822 | #include <pjsip.h> |
| 823 | #include <pjsip_ua.h> |
| 824 | #include <pjsip_simple.h> |
| 825 | #include <pjsua.h> |
| 826 | #include <pjmedia.h> |
| 827 | #include <pjmedia-codec.h> |
| 828 | (Note: the documentation of the relevant libraries should say which |
| 829 | header files should be included to get the declaration of the APIs). |
| 830 | 4. Declare the OS macros. |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 831 | + For Windows applications built with Visual Studio, we need to |
| 832 | declare PJ_WIN32=1 macro in the project settings (declaring the |
| 833 | macro in the source file may not be sufficient). |
| 834 | + For Windows Mobile applications build with Visual C++, we need to |
| 835 | declare PJ_WIN32_WINCE=1 macro in the project settings. |
| 836 | + For GNU build system/autoconf based build system, we need to |
| 837 | declare PJ_AUTOCONF=1 macro when compiling the applications. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 838 | (Note: the old PJ build system requires declaring the target processor |
| 839 | with PJ_M_XXX=1 macro, but this has been made obsolete. The target |
| 840 | processor will be detected from compiler's predefined macro by |
| 841 | pjlib/config.h file). |
| 842 | 5. Link with the appropriate PJ libraries. The following libraries will |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 843 | need to be included in the library link specifications: |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 844 | |
| 845 | pjlib |
| 846 | Base library used by all libraries. |
| 847 | |
| 848 | pjlib-util |
| 849 | Auxiliary library containing scanner, XML, STUN, MD5, getopt, |
| 850 | etc, used by the SIP and media stack. |
| 851 | |
| 852 | pjsip |
| 853 | SIP core stack library. |
| 854 | |
| 855 | pjsip-ua |
| 856 | SIP user agent library containing INVITE session, call |
| 857 | transfer, client registration, etc. |
| 858 | |
| 859 | pjsip-simple |
| 860 | SIP SIMPLE library for base event framework, presence, instant |
| 861 | messaging, etc. |
| 862 | |
| 863 | pjsua |
| 864 | High level SIP UA library, combining SIP and media stack into |
| 865 | high-level easy to use API. |
| 866 | |
| 867 | pjmedia |
| 868 | The media framework. |
| 869 | |
| 870 | pjmedia-codec |
| 871 | Container library for various codecs such as GSM, Speex, and |
| 872 | iLBC. |
| 873 | |
| 874 | |
| 875 | Note: the actual library names will be appended with the target name and the |
| 876 | build configuration. For example: |
| 877 | |
| 878 | For Visual Studio builds |
| 879 | The actual library names will look like |
| 880 | pjlib-i386-win32-vc6-debug.lib, |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 881 | pjlib-i386-win32-vc6-release.lib, etc., depending on whether we |
| 882 | are building the Debug or Release version of the library. |
| 883 | |
| 884 | An easier way to link with the libraries is to include PJ |
| 885 | project files in the workspace, and to configure project |
| 886 | dependencies so that the application depends on the PJ |
| 887 | libraries. This way, we don't need to manually add each PJ |
| 888 | libraries to the input library file specification, since VS |
| 889 | will automatically link the dependency libraries with the |
| 890 | application. |
| 891 | |
| 892 | For Windows Mobile builds |
| 893 | Unfortunately the PJ libraries built for Windows Mobile will |
| 894 | not be placed in the usual lib directory, but rather under the |
| 895 | output directory under build/wince-evc4 project directory. |
| 896 | |
| 897 | An easier way to link with the libraries is to include PJ |
| 898 | project files in the workspace, and to configure project |
| 899 | dependencies so that the application depends on the PJ |
| 900 | libraries. This way, we don't need to manually add each PJ |
| 901 | libraries to the input library file specification, since VS |
| 902 | will automatically link the dependency libraries with the |
| 903 | application. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 904 | |
| 905 | For GNU builds |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 906 | Application's Makefile can get the PJ library suffix by |
| 907 | including PJ's build.mak file from the root PJ directory (the |
| 908 | suffix is contained in TARGET_NAME variable). For example, to |
| 909 | link with PJLIB and PJMEDIA, we can use this syntax in the |
| 910 | LDFLAGS: "-lpj-$(TARGET_NAME) -lpjmedia-$(TARGET_NAME)" |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 911 | |
| 912 | |
Benny Prijono | 646b7b7 | 2006-10-21 18:28:07 +0000 | [diff] [blame] | 913 | 6. Link with system spesific libraries: |
| 914 | |
| 915 | Windows |
| 916 | Add (among other things): wsock32.lib, ws2_32.lib, ole32.lib, |
| 917 | dsound.lib |
| 918 | |
| 919 | Linux, *nix, *BSD |
| 920 | Add (among other things): '-lpthread -lm' (at least). |
| 921 | |
| 922 | MacOS X |
| 923 | Add (among other things): '-framework CoreAudio -lpthread -lm'. |
| 924 | |
| 925 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 926 | Appendix I: Common Problems/Frequently Asked Question (FAQ) |
| 927 | _________________________________________________________________ |
| 928 | |
| 929 | I.1 fatal error C1083: Cannot open include file: 'pj/config_site.h': No such |
| 930 | file or directory |
| 931 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 932 | This error normally occurs when the config_site.h file has not been created. |
| 933 | This file needs to be created manually (an empty file is sufficient). Please |
| 934 | follow the Build Preparation instructions above to create this file. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 935 | |
| 936 | |
| 937 | |
| 938 | |
| 939 | |
| 940 | |
Benny Prijono | 646b7b7 | 2006-10-21 18:28:07 +0000 | [diff] [blame] | 941 | |
| 942 | |
| 943 | _________________________________________________________________ |
| 944 | |
| 945 | Feedback: |
| 946 | Thanks for using PJ libraries and for reading this document. Please |
| 947 | send feedbacks or general comments to <bennylp at pjsip dot org>. |
Benny Prijono | eec4d7c | 2006-03-09 16:19:20 +0000 | [diff] [blame] | 948 | |