SipXtapi Windows Build Environment

From SipXtapi

Jump to: navigation, search
Important note: This page is work in progress. The idea is to describe the build process for sipXtapi and sipXezPhone on Windows in detail based on the new code in sipXtapi branch. Help is appreciated.

Contents

Setup the Build Environment for Microsoft Windows

The following description on how to setup a build environment for sipXtapi and sipXezPhone should apply to different versions of the Microsoft Windows operating system, in particular Windows XP Professional and Windows Server 2003.

Installing Microsoft Visual Studio

Microsoft has released different versions of their Integrated Development Environment (IDE) Visual Studio. The Microsoft Express Editions of Visual Studio are free and can be downloaded from their Web site. We used Visual C++ 2005 Express (VC8).

An alternative option is to use Visual Studio .NET 2003. However, there seem to be a few suddle differences.

Installing the Microsoft Platform SDK

The Microsoft Platform SDK includes all the header files, libraries and other developers resources required to develop applications for Microsoft Windows. The platform SDK is not part of Visual C++ Express and therefore needs to be installed separately. It can be downloaded for free.

Installing the Platform SDK with Visual Studio C++ 2005 (VC8) is a manual process. The following copies the instructions from the VS help page (I did not pay for it so I am not complaining):

From the Tools menu in Visual Studio, select Options. The Options dialog box appears. From the Options dialog box, expand the Projects and Solutions node and select VC++ Directories. In that section, add the following paths to the appropriate subsection:

Executable files: C:\Program Files\Microsoft SDK\Bin
Include files: C:\Program Files\Microsoft SDK\include
Library files: C:\Program Files\Microsoft SDK\lib

Update the corewin_express.vsprops file (found in C:\Program Files\Microsoft Visual Studio 8\VC\VCProjectDefaults) and change the string that reads:

AdditionalDependencies="kernel32.lib"   to:

AdditionalDependencies="kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib 
shell32.lib ole32.lib oleaut32.lib uuid.lib"

Now re-start Visual Studio.

Installing DirectX SDK

Microsoft DirectX is used for video support. In order to build sipXtacklib DirectX has to be installed even if building "Debug_NoVideo" (this is most likely a bug in the build system). The DirectX SDK can be downloaded from Microsoft for free.

Installing Subversion

Subversion is required to check out the sipXtapi / sipXezPhone code from the SIPfoundry repository. Tortoise SVN integrates subversion into Microsoft Explorer and allows working with subversion in a GUI environment. Be aware that it may slow down access via explorer to directories under svn souce control.

Alternatively, you could install command line version to subversion. Get latest svn-win32-1.3.* package here. You could download either .exe or .zip version. Don't forget to add path to svn.exe to Windows PATH environment variable.

Installing Dependencies

Required Software

To compile bare sipXtapi libraries without TLS and Speex support you need only

  • PCRE - Perl Compatible Regular Expression Library

To compile sipXtapi with TLS support you also need

  • NSPR - Netscape Portable Runtime
  • NSS - Network Security Services

To compile sipXtapi with Speex codec support you also need

  • Speex development libraries

To compile sipXtapi with GSM codec under Windows you do not need any additional libraries. libgsm sources now included in sipXmediaLib (sipXmediaLib/contrib/libgsm).

To build sipXezPhone you also need

  • wxWidgets - Open-source, platform independent GUI library

Installing NSPR

Version 4.4.1 seems to work for me. Pre-built binaries may be downloaded from here.

See section titled Installing NSS for further instructions.

Installing NSS

Version 3.9.1 seems to work for me. Pre-built binaries may be downloaded from here.

Extract the libraries to a folder of your choice. Then update your Visual Studio project properties under Configuration Properties->C/C++->General->Additional Include Directories and under Configuration Properties->Linker->General->Additional Library Directories to reflect the location you placed the library.

Installing PCRE

Tested version: 6.4 (the sipXpbx project requires version 4.5 or greater and recently switched to using the latest version supported by the respective platform).

You will need the following PCRE packages/files:

 pcre-6.4-*.exe : PCRE runtime environment and PCRE development package

You can download them directly from gnuwin32:

 http://gnuwin32.sourceforge.net/packages/pcre.htm

After the PCRE installation add the PCRE paths to your MSVC environment (assuming installation into C:\Program Files\GnuWin32):

Additional "Include files":

  C:\Program Files\GnuWin32\include

Additional "Library files":

  C:\Program Files\GnuWin32\lib

In MSVC, select "Options" from the "Tools" menu, select the "Projects" folder, select "VC++ Directories", and then select either "Include files" or "Library files" from the right-aligned dropdown list.

Installing wxWidgets

wxWidgets (formerly known as wxWindows) is an open source, cross-platform library of basic elements for building a graphical user interface (GUI). Installing wxWidgets means installing the source code of the library and then build it in Visual Studio. The project files are included and the following describes how to install and built it.

Note: wxWidgets is used to build the GUI of sipXezPhone. You only need it if you want to compile sipXezPhone.

Install wxWidgets Archive:

The wxWidgets library is available from http://www.wxwidgets.org/. The current version of wxWidgets is 2.6.3 and that is what we use here. Download the Setup.exe installer. sipXezPhone can also be built with version 2.4.2 of wxWidgets.

By default, the wxWidget Setup.exe installs the libraries in the wxWidgets-2.6.3 folder.

Configure the wxWidgets Library:

wxWidgets can be built in different ways. For more information refer to the INSTALL-MSW.txt file. The respective configuration is included in the file setup.h. On Linux this file gets created by the configure process. On Windows you edit this by hand. You can either add the respective directory that includes the correct setup.h file to the include path in Visual Studio or copy the file as indicated below:

There is one important post-installation step for installing wxWidgets:

     copy setup.h from \wxWindows-2.4.2\include\wx\msw
                    to \wxWindows-2.4.2\include\wx


Building wxWidgets:

Open build\msw\wx.dsw in Visual Studio. This project file includes configurations for static compilation or DLL compilation, and each of these available in Unicode/ANSI, Debug/Release and wxUniversal or native variations.

Build all projects in the workspace by right clicking on Solution wx. Add the include and lib directories to the Visual Studio path.

Installing Speex libraries

Speex is an Open Source/Free Software patent-free audio compression format designed for speech.

You need Speex sources or development binaries to enable Speex support in sipXtapi. Get them here. sipXtapi is known to work with Speex 1.2.x. Speex library file "libspeex.lib" should be placed to "sipXmediaLib\contrib\libspeex\lib" directory and Speex includes (along with "speex" subdirectory) should be placed to "sipXmediaLib\contrib\libspeex\include" directory.

Important note: For Speex version 1.2beta1 official precompiled Windows binaries are not compatible with sipXtapi libraries!

You should compile libspeex by your own in order to use it with sipXtapi: unpack Speex sources to temporary directory and copy "include" and "libspeex" directories to "sipXmediaLib\contrib\libspeex". DO NOT copy "win32" directory from original source package, as it contains brocken project files. Then, open "sipXmediaLib\contrib\libspeex\win32\VS2003\libspeex\libspeex.sln" (for Visual Studio 2003) or "sipXmediaLib\contrib\libspeex\win32\libspeex\libspeex.dsw" (for Visual Studio 6), choose apropriate configuration and compile it.

Note: Speex support is enabled by default. To disable it remove HAVE_SPEEX preprocessor definition from sipXtackLib, sipXmediaLib and sipXmediaAdapter project files.

Optional: Installing cppunit Test Framework

The source for cppunit can be downloaded from Sourceforge.

Unpack it to CPPUnit directory at the same level where sipXcallLib, sipXmediaLib, etc are located.
(with 1.12.0 release, unpack the cppunit-1.12.0 directory, then rename it to CPPUnit)

Open the src/CppUnitLibraries.dsw workspace and build cppunit or cppunit_dll. Once the build completes successfully the libraries are created in the lib directory.

You can now try and build sipXtapiTest.

Getting the sipXtapi / sipXezPhone Source Code

sipXtapi documentation and development has moved servers.

Please see SipXtapi Branches

Building sipXtapi

Open "sipXcallLib\sipXtapi.sln" in Visual Studio and select the appropriate build configuration from the pull-down menu in the top navigation bar. Now uild the sipXtapi project. You should end up building sipXtapi.dll (release build) or sipXtapid.dll (debug build) as well as the dependent .libs. If you are not sure about the right build configuration setting choose Debug_NoVideo.

Note: VC6 users: sipXtapi.dll is not generated in your environment. Instead, once port, sdp, tack, media, and call libs are built, you can just have your app link to those separate libs for the functionality you need -- they provide everything that sipXtapi.dll would provide. Also take look at buildmsvs6.bat.

Note: eVC build: Take look at this script for an idea build_evc4.bat.

Note: sipXezPhone.exe is not included in the default build.

Adding Environment Variables

At runtime, the softphone needs to be able to find the pcre3.dll, located at "c:\Program Files\GnuWin32\bin" for default installation. Copy it to the folder containing your executable or add path to it to your Windows PATH environment variable. From a command prompt, this can be added by entering the following:

 PATH=%PATH%;c:\Program Files\GnuWin32\bin

Launching sipXezPhone

After a build, sipXezPhone.exe will be created in the sipXcallLib\examples\sipXezPhone directory. The working directory for sipXezPhone must have in it the sipXtapi.dll. Either copy the sipXtapi.dll to the directory containing sipXezPhone.exe, or point your working directory to sipXtapi's build directory.


Troubleshooting: Build Problems

warning C49996: 'strncpy' : was declared deprecated

This warning can safely be ignored or disabled. To disable this warning in Visual Studio, right click on the affected project(s) and choose properties. Then add the following definitions under Configuration Properties->C/C++->Preprocessor->Preprocessor Definitions.

 _CRT_SECURE_NO_DEPRECATE
 _CRT_NONSTDC_NO_DEPRECATE


RTTI must be enabled

Many of the projects are starting to use the dynamic_cast<>() mechanism to provide runtime type checking. RTTI must be enabled on all projects using dynamic_cast<>() and related functionality. By default, almost all of the sipX WIN32 projects now enable RTTI.

Failing to enable RTTI results in odd crashes/exceptions. Generally "rtti" or "RTDynamicCast" is found in the stack trace.


wxWidgets Unresolved Externals and MSVC 6.0

If your wxWidgets library was not compiled with the /MT compile flag (multi-threaded), you may experience 'unresoved external' link errors such as: unresolved external symbol __ftol2

Rebuild wxWidgets with the following command lines:

nmake -f makefile.vc clean FINAL=1
nmake -f makefile.vc FINAL=1 CRTFLAG=/MD    (for the multithreaded DLL)

Troubleshooting: Runtime Problems

A STATUS_DLL_NOT_FOUND failure at start-up can be displayed if the application cannot find sipXtapi.dll or sipXtapid.dll (for debug).

You can:

  1. Set the working directory of sipXezPhone to the folder containing the sipXtapi.dll or sipXtapid.dll.
  2. Copy the sipXtapi.dll or sipXtapid.dll to the same folder as the sipXezPhone.exe
  3. Add the folder containing sipXtapid.dll and/or sipXtapi.dll to your path.
Personal tools