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 | |
| 3 | Getting Started: Building and Using PJSIP and PJMEDIA |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 4 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 5 | [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 Prijono | db419fd | 2006-03-05 11:54:33 +0000 | [diff] [blame] | 11 | |
Benny Prijono | eec4d7c | 2006-03-09 16:19:20 +0000 | [diff] [blame] | 12 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 13 | Quick Info |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 14 | |
| 15 | Building with GNU tools |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 16 | Generally these should be all that are needed to build the libraries, |
| 17 | applications, and samples: |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 18 | |
| 19 | $ ./configure |
| 20 | $ make dep && make clean && make |
| 21 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 22 | Building Win32 Target with Microsoft Visual Studio |
| 23 | Generally we can just do these steps: |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 24 | |
| 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 Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 30 | Generally these are all that are needed: |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 31 | |
| 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 Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 36 | 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 Prijono | eec4d7c | 2006-03-09 16:19:20 +0000 | [diff] [blame] | 39 | |
| 40 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 41 | Table of Contents: |
| 42 | _________________________________________________________________ |
Benny Prijono | eec4d7c | 2006-03-09 16:19:20 +0000 | [diff] [blame] | 43 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 44 | 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 Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 84 | 6. Using PJPROJECT with Applications |
Benny Prijono | eec4d7c | 2006-03-09 16:19:20 +0000 | [diff] [blame] | 85 | |
| 86 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 87 | Appendix I: Common Problems/Frequently Asked Question (FAQ) |
Benny Prijono | eec4d7c | 2006-03-09 16:19:20 +0000 | [diff] [blame] | 88 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 89 | I.1 fatal error C1083: Cannot open include file: 'pj/config_site.h': |
| 90 | No such file or directory |
| 91 | |
| 92 | |
| 93 | 1. Getting the Source Code Distribution |
| 94 | _________________________________________________________________ |
| 95 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 96 | 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 | |
| 102 | 1.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 Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 107 | normally it is considered more stable as each will be tested more rigorously |
| 108 | before released. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 109 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 110 | The latest released tarball can be downloaded from the |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 111 | http://www.pjsip.org/download.htm. |
| 112 | |
| 113 | |
| 114 | 1.2 Getting from Subversion trunk |
| 115 | _________________________________________________________________ |
| 116 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 117 | 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 Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 123 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 124 | 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 Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 127 | |
| 128 | |
| 129 | What is Subversion |
| 130 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 131 | Subversion (SVN) is Open Source version control system similar to CVS. |
| 132 | Subversion homepage is in http://subversion.tigris.org/ |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 133 | |
| 134 | |
| 135 | Getting Subversion Client |
| 136 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 137 | 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 Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 141 | |
| 142 | |
| 143 | Getting the Source for The First Time |
| 144 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 145 | Once Subversion client is installed, we can use these commands to initially |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 146 | retrieve the latest sources from the Subversion trunk: |
| 147 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 148 | |
| 149 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 150 | $ svn co http://svn.pjproject.net/repos/pjproject/trunk pjproject |
| 151 | $ cd pjproject |
| 152 | |
| 153 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 154 | Keeping The Local Copy Up-to-Date |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 155 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 156 | 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 Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 160 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 161 | To update the local copy with the latest changes in the main PJ's |
| 162 | repository: |
| 163 | |
| 164 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 165 | |
| 166 | $ cd pjproject |
| 167 | $ svn update |
| 168 | |
| 169 | |
| 170 | Tracking Local and Remote Changes |
| 171 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 172 | To see what files have been changed locally: |
| 173 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 174 | |
| 175 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 176 | $ cd pjproject |
| 177 | $ svn status |
| 178 | |
| 179 | The above command only compares local file against the original local copy, |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 180 | so it doesn't require Internet connection while performing the check. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 181 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 182 | 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 Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 186 | |
| 187 | $ cd pjproject |
| 188 | $ svn status -u |
| 189 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 190 | Note that this command requires active Internet connection to query the |
| 191 | status of PJPROJECT's source repository. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 192 | |
| 193 | |
| 194 | 1.3 Source Directories Layout |
| 195 | _________________________________________________________________ |
| 196 | |
| 197 | Top-Level Directory Layout |
| 198 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 199 | The top-level directories (denoted as $TOP here) in the source distribution |
| 200 | contains the following sub-directories: |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 201 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 202 | $TOP/build |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 203 | Contains makefiles that are common for all projects. |
| 204 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 205 | $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 Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 209 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 210 | $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 Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 214 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 215 | $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 Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 219 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 220 | $TOP/pjsip |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 221 | Contains PJSIP header and source files. |
| 222 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 223 | $TOP/pjsip-apps |
| 224 | Contains source code for PJSUA and various sample applications. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 225 | |
| 226 | |
| 227 | Individual Directory Inside Each Project |
| 228 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 229 | Each library directory further contains these sub-directories: |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 230 | |
| 231 | bin |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 232 | Contains binaries produced by the build process. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 233 | |
| 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 Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 243 | 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 Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 246 | |
| 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 Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 252 | build/wince-evc4/output |
| 253 | This directory contains the library, executable, and object files |
| 254 | generated by Windows Mobile build process. |
| 255 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 256 | 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 Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 262 | (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 Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 266 | 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 | |
| 276 | 2. Build Preparation |
| 277 | _________________________________________________________________ |
| 278 | |
| 279 | 2.1 config_site.h file |
| 280 | _________________________________________________________________ |
| 281 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 282 | The pjlib/include/pj/config_site.h contains local customizations to the |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 283 | libraries. |
| 284 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 285 | 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 Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 289 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 290 | 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 Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 293 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 294 | Please find list of configuration macros that can be overriden from these |
| 295 | files: |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 296 | * pjlib/config.h file |
| 297 | * pjmedia/config.h file |
| 298 | * pjsip/sip_config.h file |
| 299 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 300 | A sample config_site.h file is also available in |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 301 | pjlib/include/config_site_sample.h. |
| 302 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 303 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 304 | Creating config_site.h file |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 305 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 306 | 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 Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 312 | |
| 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 | |
| 321 | 2.2 Disk Space Requirements |
| 322 | _________________________________________________________________ |
| 323 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 324 | 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 Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 327 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 328 | (Visual Studio Debug and Release are considered as separate targets) |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 329 | |
| 330 | |
| 331 | 3. Building Linux, *nix, *BSD, and MacOS X Targets with GNU Build Systems |
| 332 | _________________________________________________________________ |
| 333 | |
| 334 | 3.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 Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 342 | * FreeBSD and maybe other BSD's (i386, Opteron, etc.), |
| 343 | * RTEMS with cross compilation (ARM, powerpc), |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 344 | * etc. |
| 345 | |
| 346 | |
| 347 | 3.2 Requirements |
| 348 | _________________________________________________________________ |
| 349 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 350 | 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 Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 354 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 355 | 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 Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 367 | |
| 368 | |
| 369 | 3.3 Running configure |
| 370 | _________________________________________________________________ |
| 371 | |
| 372 | Using Default Settings |
| 373 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 374 | Run "./configure" without any options to let the script detect the |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 375 | appropriate settings for the host: |
| 376 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 377 | |
| 378 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 379 | $ cd pjproject |
| 380 | $ ./configure |
| 381 | ... |
| 382 | |
| 383 | Notes: |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 384 | 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 Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 387 | |
| 388 | Features Customization |
| 389 | |
| 390 | With the new autoconf based build system, most configuration/customization |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 391 | can be specified as configure arguments. The list of customizable features |
| 392 | can be viewed by running "./configure --help" command: |
| 393 | |
| 394 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 395 | |
| 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 Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 413 | Configuring Debug Version and Other Customizations |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 414 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 415 | The configure script accepts standard customization, which details can be |
| 416 | obtained by executing ./configure --help. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 417 | |
| 418 | For example, to build the libraries/application in debug mode: |
| 419 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 420 | |
| 421 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 422 | $ ./configure CFLAGS="-g" |
| 423 | ... |
| 424 | |
| 425 | |
| 426 | 3.4 Cross Compilation |
| 427 | _________________________________________________________________ |
| 428 | |
| 429 | (.. to be completed) |
| 430 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 431 | |
| 432 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 433 | $ ./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 Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 443 | |
| 444 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 445 | $ cd pjproject |
| 446 | $ make dep |
| 447 | $ make |
| 448 | |
| 449 | Note: |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 450 | gmake may need to be specified instead of make for some hosts, to |
| 451 | invoke GNU make instead of the native make. |
| 452 | |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 453 | |
| 454 | Description of all make targets supported by the Makefile's: |
| 455 | |
| 456 | all |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 457 | The default (or first) target to build the libraries/binaries. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 458 | |
| 459 | dep, depend |
| 460 | Build dependencies rule from the source files. |
| 461 | |
| 462 | clean |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 463 | Clean the object files for current target, but keep the output |
| 464 | library/binary files intact. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 465 | |
| 466 | distclean, realclean |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 467 | Remove all generated files (object, libraries, binaries, and |
| 468 | dependency files) for current target. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 469 | |
| 470 | |
| 471 | Note: |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 472 | 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 Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 474 | |
| 475 | |
| 476 | 4. Building for Windows Targets with Microsoft Visual Studio |
| 477 | _________________________________________________________________ |
| 478 | |
| 479 | 4.1 Requirements |
| 480 | _________________________________________________________________ |
| 481 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 482 | The Microsoft Visual Studio based project files can be used with one of the |
| 483 | following: |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 484 | |
| 485 | * Microsoft Visual Studio 6, |
| 486 | * Microsoft Visual Studio .NET 2002, |
| 487 | * Microsoft Visual Studio .NET 2003, |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 488 | * Microsoft Visual C++ Express 2005 with Platform SDK and DirectX SDK, |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 489 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 490 | 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 Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 494 | |
| 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 Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 502 | later version of Visual Studio is being used, it should convert the |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 503 | 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 Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 535 | 4. Modify the #include line to include the particular sample application to |
| 536 | debug |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 537 | 5. Select Debug build. |
| 538 | 6. Build and debug the project. |
| 539 | |
| 540 | |
| 541 | 5. 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 Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 551 | One of the following development tools is needed to build SIP and media |
| 552 | components for Windows Mobile: |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 553 | * 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 Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 557 | it is reported to work (I assumed that VS2005 for Windows Mobile can import |
| 558 | EVC4 workspace file). |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 559 | |
| 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 Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 567 | later version of EVC4 is being used, this may cause the workspace file |
| 568 | to be converted to the appropriate format. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 569 | 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 Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 573 | Debug) to debug the program in emulator, or other configurations such as |
| 574 | ARMV4, MIPS, SH3, SH4, or whatever suitable for the device) |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 575 | 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 Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 580 | |
| 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 Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 588 | |
| 589 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 590 | 6. Using PJPROJECT with Applications |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 591 | _________________________________________________________________ |
| 592 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 593 | 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 Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 596 | + pjlib/include |
| 597 | + pjlib-util/include |
| 598 | + pjmedia/include |
| 599 | + pjsip/include |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 600 | 2. Put these library directories in the library search path: |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 601 | + pjlib/lib |
| 602 | + pjlib-util/lib |
| 603 | + pjmedia/lib |
| 604 | + pjsip/lib |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 605 | 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 Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 607 | |
| 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 Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 619 | + 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 Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 626 | (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 Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 631 | need to be included in the library link specifications: |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 632 | |
| 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 Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 669 | 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 Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 692 | |
| 693 | For GNU builds |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 694 | 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 Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 699 | |
| 700 | |
| 701 | Appendix 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 Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 707 | 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 Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 710 | |
| 711 | |
| 712 | |
| 713 | |
| 714 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 715 | Thanks for using PJ libraries and for reading this document. Please |
| 716 | send feedbacks or general comments to <bennylp at pjsip dot org>. |
Benny Prijono | c341683 | 2006-09-12 18:58:19 +0000 | [diff] [blame] | 717 | |
Benny Prijono | abd2ae9 | 2006-09-13 11:02:26 +0000 | [diff] [blame] | 718 | Benny Prijono |
Benny Prijono | eec4d7c | 2006-03-09 16:19:20 +0000 | [diff] [blame] | 719 | |