Recent Changes - Search:

Documents

Download

Building

Support

Wiki Stuff

edit SideBar

Building PTLib on Windows

Contents

  1. Introduction
  2. Prerequisites
  3. Download and install the PTLib source code
  4. Open the solution file
  5. Install GNU bison
  6. Configure directories
  7. Install optional packages
  8. Build the PTLIB Static project
  9. Build the PTLIB DLL project
  10. Tailoring the configure search path
  11. Notes on Windows Mobile

1. Introduction

This document provides instructions building PTLib with Visual Studio on Windows.

Note that older compilers and operating systems are rarely checked, they may work, they may not.

2. Prerequisites

You will need the following:

  • At least Visual Studio 2010 or Visual C++ 2010 Express Edition. Visual Studio 2013 is the current version used by the developers.
  • If using SVN download, Tortoise SVN is highly recommended.
  • There are a number of optional downloads for extra features, for example OpenSSL. PTLib will automatically detect if these are installed and compile the system accordingly.

3. Download and install the PTLib source code

Download and extract the PTLib source code. For the purposes of this document, the directory that contains PTLib will be indicated as installdir\PTLIB

The PTLib source may be downloaded as a ZIP file from the SourceForge download page or you may download it using Subversion

4. Open the solution file

If you are using Visual Studio 2013, open the ptlib_2013.sln solution file.

If you are using Visual Studio 2012, open the ptlib_2012.sln solution file.

If you are using Visual Studio 2010, open the ptlib_2010.sln solution file.

The solution contains the following projects:

  • configure
  • Hello World DLL
  • MergeSym
  • PTLib DLL
  • PTLib Static

5. Install GNU bison

As of PTLib 2.12.7, bison is no longer required to build the system. However, it is required if you wish to change the date parsing sub-system. Which is unlikely.

For versions prior to PTLib 2.12.7, the latest pre-compiled binaries for bison should be used, subject to the following caveats:

  • Do *NOT* use the default install directory of "C:\Program Files\GnuWin32", or any directory containing spaces, as this will cause problems. Why on earth GNU have a default that does not work is beyond us. We recommend using C:\Tools instead.
  • Add the directory C:\Tools\bin to the PATH environment variable before running Visual Studio.

6. Configure directories

While not always necessary, it may be useful to add the following directories to environment variables:

  • Add installdir\PTLIB\LIB to the PATH environment variable
  • Add installdir\PTLIB\INCLUDE to the INCLUDE environment variable
  • Add installdir\PTLIB\LIB to the LIB environment variable

The exact location for setting this varies on the version of Windows, but generally is it in Control Panel, System, Advanced system settings, Advanced tab, Environment Variables button.

7. Install optional packages

The PTLib build process will automatically detect many packages that are installed on the host system. Before starting the build process, select and install the packages from the list below that are needed:

  • OpenSSL - Provides support for encryption and authentication. We recommend using a pre-packaged binary distribution such as the one available from Shining Light Productions
  • Expat - Provides support for XML. This library must be available if Voice XML (VXML) and XMPP functions are required. We recommend using a pre-packaged binary such as the ones available from the Expat SourceForge site.
  • OpenLDAP - Provides support for the LDAP protocol as used by ILS and other network services. OpenLDAP requires OpenSSL to be installed. Detailed build instructions for OpenLDAP can be found here, or you can use use these precompiled binaries
  • SDL - Provides for support for fast drawing of video into windows. See the SDL home page for more information.
  • libjpeg - Provides for support for using static JPEG images as video source. Source code, and precompiled binaries for Windows are available
  • For Windows 8 - Microsoft Windows Software Development Kit - Needed for features such as IPV6 and DNS resolver support.
  • For Windows 7 and earlier - Microsoft Windows Software Development Kit - Provides several features such as IPv6, DNS resolver (for the resolution of DNS MX and SRV records), Direct Show video camera support and text-to-speech functions. There are a number of incompatibility issues with an SDK earlier than version 6.1, it can be made to work, but is really hard and could not be automated. It is much easier just to install the later version. For correct operation, the include and lib directories for the SDK should be added to the the Visual Studio directory configuration, as described above, before the standard MSVC directories.

8. Build the PTLib Static project

Build the PTLib Static project to create a static code library containing all of the PTLib code. In Release mode, this will build the ptlibs.lib file. In Debug mode, this will build the ptlibsd.lib file.

Note that the first step of the build is the execution of the configure program which searches for optional components that may be installed on the host system.

IMPORTANT TIP: If configure finds options in directories not belonging to other compilers, such as Cygwin, MSys, MSVC 6, or the wrong version of VS.net, then please read section 10 "Tailoring the configure search path" below on how to tailor the configure search path

The compiler output will be similar to the below (it will vary depending on options or build environment).

        ------ Build started: Project: PTLib, Configuration: Release Win32 ------
        Configuring Build Options
        Located Open LDAP at D:\openldap\
        Located Expat XML at D:\expat\
        Located Speech API at D:\Program Files\Microsoft Speech SDK 5.1\
        Searching C:\
        Searching D:\
        Located Cyrus SASL at D:\cyrus-sasl-2.1.12\
        Located Open SSL at D:\openssl-0.9.7\
        Located DNS Resolver at D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\
        Located IPv6 Support at D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\
        Located QoS Support at D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\
        Searching E:\
        Byte Order set to PLITTLE_ENDIAN
        Semaphore Support enabled
        DNS Resolver enabled
        Cyrus SASL enabled
        Open LDAP enabled
        Open SSL enabled
        Expat XML enabled
        Speech API enabled
        IPv6 Support enabled
        QoS Support enabled
        Simple DirectMedia Layer disabled
        Memory check switch read enabled
        Configuration completed.
        Performing Custom Build Step
        ../common/getdate.y contains 8 shift/reduce conflicts and 18 reduce/reduce conflicts.
        Compiling...
        assert.cxx
        Compiling...
        notifier_ext.cxx
        mail.cxx

            ...lines deleted...

        Generating Code...
        getdate_tab.c
        Creating library...
        Build log was saved at "file://d:\ptlib\Lib\Debug\BuildLog.htm"
        Console - 0 error(s), 1 warning(s)

        ---------------------- Done ----------------------
        Build: 1 succeeded, 0 failed, 0 skipped

9. Build the PTLib DLL project

Build the PTLib DLL project to create a DLL code library containing all of the PTLib code. In Release mode, this will build the ptlib.dll file. In Debug mode, this will build the ptlibd.dll file.

NOTE: the Release version of the MergeSym project must be built "before" building PTLib DLL. Generally this will happen automatically through the solution dependencies, however if this does not occur and you get an error such as:


    'MergeSym' is not recognized as an internal or external command, operable program or batch file.

then right click on MergeSym project and build it manually.

The compiler output will be similar to the below (it will vary depending on options or build environment).

        ------ Build started: Project: MergeSym, Configuration: Release Win32 ------
        Compiling...
        MergeSym.cxx
        Linking...
        Copying symbol merge utility to ptlib/lib directory.
        Build log was saved at "file://d:\ptlib\tools\MergeSym\Release\BuildLog.htm"
        MergeSym - 0 error(s), 0 warning(s)

        ------ Build started: Project: PTLib, Configuration: Release Win32 ------
        Performing Custom Build Step
        MergeSym version 1.4.0 on Windows 2000 by Equivalence
        No changes to symbols.
        Compiling...
        dllmain.cxx
        Compiling resources...
        Linking...
        Creating library .\..\..\..\Lib/PTLib.lib and object .\..\..\..\Lib/PTLib.exp
        Extracting debug symbols
        REBASE: Total Size of mapping 0x00000000000d0000
        REBASE: Range 0x0000000010000000 -0x00000000100d0000
        Build log was saved at "file://d:\ptlib\Lib\Release\BuildLog.htm"
        PTLib - 0 error(s), 0 warning(s)

        ---------------------- Done ----------------------
        Build: 3 succeeded, 0 failed, 0 skipped

10. Tailoring the configure search path

Occasionally, configure will incorrectly identify the location of installed packages, leading to compilation problems.

The most common reason is having multiple versions of Visual Studio installed at the same time, or using Cygwin headers, or using libraries from the Windows Mobile version of Visual Studio.

If you have compilation errors, check the .../ptlib/include/ptbuildopts.h file and look for where there are lines starting with #pragma include_alias(), the path included in that command should look sensible.

This problem is solved by setting environment variable VSNET2010_PTLIB_CONFIGURE_EXCLUDE_DIRS to identify paths that should not be searched.

Edit - History - Print - Recent Changes - Search
Page last modified on June 08, 2015, at 09:25 PM