<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >Building with Visual C++ 2005</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REV="MADE" HREF="mailto:pgsql-docs@postgresql.org"><LINK REL="HOME" TITLE="PostgreSQL 8.4.12 Documentation" HREF="index.html"><LINK REL="UP" TITLE="Installation from Source Code on Windows" HREF="install-win32.html"><LINK REL="PREVIOUS" TITLE="Installation from Source Code on Windows" HREF="install-win32.html"><LINK REL="NEXT" TITLE="Building libpq with Visual C++ or Borland C++" HREF="install-win32-libpq.html"><LINK REL="STYLESHEET" TYPE="text/css" HREF="stylesheet.css"><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"><META NAME="creation" CONTENT="2012-05-31T23:30:11"></HEAD ><BODY CLASS="SECT1" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="5" ALIGN="center" VALIGN="bottom" >PostgreSQL 8.4.12 Documentation</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="top" ><A HREF="install-win32.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="10%" ALIGN="left" VALIGN="top" ><A HREF="install-win32.html" >Fast Backward</A ></TD ><TD WIDTH="60%" ALIGN="center" VALIGN="bottom" >Chapter 16. Installation from Source Code on <SPAN CLASS="PRODUCTNAME" >Windows</SPAN ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="top" ><A HREF="install-win32.html" >Fast Forward</A ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="top" ><A HREF="install-win32-libpq.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="SECT1" ><H1 CLASS="SECT1" ><A NAME="INSTALL-WIN32-FULL" >16.1. Building with <SPAN CLASS="PRODUCTNAME" >Visual C++ 2005</SPAN ></A ></H1 ><P > The tools for building using <SPAN CLASS="PRODUCTNAME" >Visual C++ 2005</SPAN >, are in the <TT CLASS="FILENAME" >src/tools/msvc</TT > directory. When building, make sure there are no tools from <SPAN CLASS="PRODUCTNAME" >MinGW</SPAN > or <SPAN CLASS="PRODUCTNAME" >Cygwin</SPAN > present in your system PATH. Also, make sure you have all the required Visual C++ tools available in the PATH, usually by starting a <SPAN CLASS="APPLICATION" >Visual Studio Command Prompt</SPAN > and running the commands from there. All commands should be run from the <TT CLASS="FILENAME" >src\tools\msvc</TT > directory. </P ><P > Before you build, edit the file <TT CLASS="FILENAME" >config.pl</TT > to reflect the configuration options you want set, including the paths to libraries used. If you need to set any other environment variables, create a file called <TT CLASS="FILENAME" >buildenv.pl</TT > and put the required commands there. For example, to add the path for bison when it's not in the PATH, create a file containing: </P><PRE CLASS="SCREEN" > $ENV{PATH}=$ENV{PATH} . ';c:\some\where\bison\bin'; </PRE ><P> </P ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="AEN23279" >16.1.1. Requirements</A ></H2 ><P > PostgreSQL will build using either the professional versions (any edition) or the free Express edition of <SPAN CLASS="PRODUCTNAME" >Visual Studio 2005</SPAN >. The following additional products are required to build the complete package. Use the <TT CLASS="FILENAME" >config.pl</TT > file to specify which directories the libraries are available in. <P ></P ></P><DIV CLASS="VARIABLELIST" ><DL ><DT ><SPAN CLASS="PRODUCTNAME" >ActiveState Perl</SPAN ></DT ><DD ><P > ActiveState Perl is required to run the build generation scripts. MinGW or Cygwin Perl will not work. It must also be present in the PATH. Binaries can be downloaded from <A HREF="http://www.activestate.com" TARGET="_top" >http://www.activestate.com</A > (Note: version 5.8 or later is required, the free Standard Distribution is sufficient). </P ></DD ><DT ><SPAN CLASS="PRODUCTNAME" >ActiveState TCL</SPAN ></DT ><DD ><P > Required for building <SPAN CLASS="APPLICATION" >PL/TCL</SPAN > (Note: version 8.4 is required, the free Standard Distribution is sufficient). </P ></DD ><DT ><SPAN CLASS="PRODUCTNAME" >Bison</SPAN > and <SPAN CLASS="PRODUCTNAME" >Flex</SPAN ></DT ><DD ><P > Bison and Flex are required to build from Git, but not required when building from a release file. Note that only Bison 1.875 or versions 2.2 and later will work. Bison and Flex can be downloaded from <A HREF="http://gnuwin32.sourceforge.net" TARGET="_top" >http://gnuwin32.sourceforge.net</A >. </P ></DD ><DT ><SPAN CLASS="PRODUCTNAME" >Diff</SPAN ></DT ><DD ><P > Diff is required to run the regression tests, and can be downloaded from <A HREF="http://gnuwin32.sourceforge.net" TARGET="_top" >http://gnuwin32.sourceforge.net</A >. </P ></DD ><DT ><SPAN CLASS="PRODUCTNAME" >Gettext</SPAN ></DT ><DD ><P > Gettext is required to build with NLS support, and can be downloaded from <A HREF="http://gnuwin32.sourceforge.net" TARGET="_top" >http://gnuwin32.sourceforge.net</A >. Note that binaries, dependencies and developer files are all needed. </P ></DD ><DT ><SPAN CLASS="PRODUCTNAME" >Microsoft Platform SDK</SPAN ></DT ><DD ><P > It is recommended that you upgrade to the latest available version of the <SPAN CLASS="PRODUCTNAME" >Microsoft Platform SDK</SPAN >, available for download from <A HREF="http://www.microsoft.com/downloads/" TARGET="_top" >http://www.microsoft.com/downloads/</A >. </P ></DD ><DT ><SPAN CLASS="PRODUCTNAME" >MIT Kerberos</SPAN ></DT ><DD ><P > Required for Kerberos authentication support. MIT Kerberos can be downloaded from <A HREF="http://web.mit.edu/Kerberos/dist/index.html" TARGET="_top" >http://web.mit.edu/Kerberos/dist/index.html</A >. </P ></DD ><DT ><SPAN CLASS="PRODUCTNAME" >libxml2</SPAN > and <SPAN CLASS="PRODUCTNAME" >libxslt</SPAN ></DT ><DD ><P > Required for XML support. Binaries can be downloaded from <A HREF="http://zlatkovic.com/pub/libxml" TARGET="_top" >http://zlatkovic.com/pub/libxml</A > or source from <A HREF="http://xmlsoft.org" TARGET="_top" >http://xmlsoft.org</A >. Note that libxml2 requires iconv, which is available from the same download location. </P ></DD ><DT ><SPAN CLASS="PRODUCTNAME" >openssl</SPAN ></DT ><DD ><P > Required for SSL support. Binaries can be downloaded from <A HREF="http://www.slproweb.com/products/Win32OpenSSL.html" TARGET="_top" >http://www.slproweb.com/products/Win32OpenSSL.html</A > or source from <A HREF="http://www.openssl.org" TARGET="_top" >http://www.openssl.org</A >. </P ></DD ><DT ><SPAN CLASS="PRODUCTNAME" >ossp-uuid</SPAN ></DT ><DD ><P > Required for UUID-OSSP support (contrib only). Source can be downloaded from <A HREF="http://www.ossp.org/pkg/lib/uuid/" TARGET="_top" >http://www.ossp.org/pkg/lib/uuid/</A >. </P ></DD ><DT ><SPAN CLASS="PRODUCTNAME" >Python</SPAN ></DT ><DD ><P > Required for building <SPAN CLASS="APPLICATION" >PL/Python</SPAN >. Binaries can be downloaded from <A HREF="http://www.python.org" TARGET="_top" >http://www.python.org</A >. </P ></DD ><DT ><SPAN CLASS="PRODUCTNAME" >zlib</SPAN ></DT ><DD ><P > Required for compression support in <SPAN CLASS="APPLICATION" >pg_dump</SPAN > and <SPAN CLASS="APPLICATION" >pg_restore</SPAN >. Binaries can be downloaded from <A HREF="http://www.zlib.net" TARGET="_top" >http://www.zlib.net</A >. </P ></DD ></DL ></DIV ><P> </P ></DIV ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="AEN23365" >16.1.2. Building</A ></H2 ><P > To build all of PostgreSQL in release configuration (the default), run the command: </P><PRE CLASS="SCREEN" > <KBD CLASS="USERINPUT" > build </KBD > </PRE ><P> To build all of PostgreSQL in debug configuration, run the command: </P><PRE CLASS="SCREEN" > <KBD CLASS="USERINPUT" > build DEBUG </KBD > </PRE ><P> To build just a single project, for example psql, run the commands: </P><PRE CLASS="SCREEN" > <KBD CLASS="USERINPUT" > build psql </KBD > <KBD CLASS="USERINPUT" > build DEBUG psql </KBD > </PRE ><P> To change the default build configuration to debug, put the following in the <TT CLASS="FILENAME" >buildenv.pl</TT > file: </P><PRE CLASS="SCREEN" > <KBD CLASS="USERINPUT" > $ENV{CONFIG}="Debug"; </KBD > </PRE ><P> </P ><P > It is also possible to build from inside the Visual Studio GUI. In this case, you need to run: </P><PRE CLASS="SCREEN" > <KBD CLASS="USERINPUT" > perl mkvcbuild.pl </KBD > </PRE ><P> from the command prompt, and then open the generated <TT CLASS="FILENAME" >pgsql.sln</TT > (in the root directory of the source tree) in Visual Studio. </P ></DIV ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="AEN23382" >16.1.3. Cleaning and installing</A ></H2 ><P > Most of the time, the automatic dependency tracking in Visual Studio will handle changed files. But if there have been large changes, you may need to clean the installation. To do this, simply run the <TT CLASS="FILENAME" >clean.bat</TT > command, which will automatically clean out all generated files. You can also run it with the <TT CLASS="PARAMETER" >dist</TT > parameter, in which case it will behave like <KBD CLASS="USERINPUT" >make distclean</KBD > and remove the flex/bison output files as well. </P ><P > By default, all files are written into a subdirectory of the <TT CLASS="FILENAME" >debug</TT > or <TT CLASS="FILENAME" >release</TT > directories. To install these files using the standard layout, and also generate the files required to initialize and use the database, run the command: </P><PRE CLASS="SCREEN" > <KBD CLASS="USERINPUT" > perl install.pl c:\destination\directory </KBD > </PRE ><P> </P ></DIV ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="AEN23393" >16.1.4. Running the regression tests</A ></H2 ><P > To run the regression tests, make sure you have completed the build of all required parts first. Also, make sure that the DLLs required to load all parts of the system (such as the Perl and Python DLLs for the procedural languages) are present in the system path. If they are not, set it through the <TT CLASS="FILENAME" >buildenv.pl</TT > file. To run the tests, run one of the following commands from the <TT CLASS="FILENAME" >src\tools\msvc</TT > directory: </P><PRE CLASS="SCREEN" > <KBD CLASS="USERINPUT" > vcregress check </KBD > <KBD CLASS="USERINPUT" > vcregress installcheck </KBD > <KBD CLASS="USERINPUT" > vcregress plcheck </KBD > <KBD CLASS="USERINPUT" > vcregress contribcheck </KBD > </PRE ><P> To change the schedule used (default is the parallel), append it to the command line like: </P><PRE CLASS="SCREEN" > <KBD CLASS="USERINPUT" > vcregress check serial </KBD > </PRE ><P> For more information about the regression tests, see <A HREF="regress.html" >Chapter 29</A >. </P ></DIV ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="AEN23406" >16.1.5. Building the documentation</A ></H2 ><P > Building the PostgreSQL documentation in HTML format requires several tools and files. Create a root directory for all these files, and store them in the subdirectories in the list below. <P ></P ></P><DIV CLASS="VARIABLELIST" ><DL ><DT >OpenJade 1.3.1-2</DT ><DD ><P > Download from <A HREF="http://sourceforge.net/project/downloading.php?groupname=openjade&filename=openjade-1_3_1-2-bin.zip" TARGET="_top" >http://sourceforge.net/project/downloading.php?groupname=openjade&filename=openjade-1_3_1-2-bin.zip</A > and uncompress in the subdirectory <TT CLASS="FILENAME" >openjade-1.3.1</TT >. </P ></DD ><DT >DocBook DTD 4.2</DT ><DD ><P > Download from <A HREF="http://www.oasis-open.org/docbook/sgml/4.2/docbook-4.2.zip" TARGET="_top" >http://www.oasis-open.org/docbook/sgml/4.2/docbook-4.2.zip</A > and uncompress in the subdirectory <TT CLASS="FILENAME" >docbook</TT >. </P ></DD ><DT >DocBook DSSSL 1.79</DT ><DD ><P > Download from <A HREF="http://sourceforge.net/project/downloading.php?groupname=docbook&filename=docbook-dsssl-1.79.zip" TARGET="_top" >http://sourceforge.net/project/downloading.php?groupname=docbook&filename=docbook-dsssl-1.79.zip</A > and uncompress in the subdirectory <TT CLASS="FILENAME" >docbook-dsssl-1.79</TT >. </P ></DD ><DT >ISO character entities</DT ><DD ><P > Download from <A HREF="http://www.oasis-open.org/cover/ISOEnts.zip" TARGET="_top" >http://www.oasis-open.org/cover/ISOEnts.zip</A > and uncompress in the subdirectory <TT CLASS="FILENAME" >docbook</TT >. </P ></DD ></DL ></DIV ><P> Edit the <TT CLASS="FILENAME" >buildenv.pl</TT > file, and add a variable for the location of the root directory, for example: </P><PRE CLASS="SCREEN" > $ENV{DOCROOT}='c:\docbook'; </PRE ><P> To build the documentation, run the command <TT CLASS="FILENAME" >builddoc.bat</TT >. Note that this will actually run the build twice, in order to generate the indexes. The generated HTML files will be in <TT CLASS="FILENAME" >doc\src\sgml</TT >. </P ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="install-win32.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="install-win32-libpq.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Installation from Source Code on <SPAN CLASS="PRODUCTNAME" >Windows</SPAN ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="install-win32.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Building <SPAN CLASS="APPLICATION" >libpq</SPAN > with <SPAN CLASS="PRODUCTNAME" >Visual C++</SPAN > or <SPAN CLASS="PRODUCTNAME" >Borland C++</SPAN ></TD ></TR ></TABLE ></DIV ></BODY ></HTML >