postgresql/doc/src/sgml/install-win32.sgml

446 lines
15 KiB
Plaintext
Raw Normal View History

<!-- $PostgreSQL: pgsql/doc/src/sgml/install-win32.sgml,v 1.36 2007/03/23 09:57:55 mha Exp $ -->
2000-12-21 23:30:39 +01:00
<chapter id="install-win32">
<title>Installation on <productname>Windows</productname></title>
<indexterm>
<primary>installation</primary>
<secondary>on Windows</secondary>
</indexterm>
2000-12-21 23:30:39 +01:00
<para>
It is recommended that most users download the binary distribution for
Windows, available as a <productname>Windows Installer</productname> package
from the <productname>PostgreSQL</productname> website. Building from source
is only intended for people developing <productname>PostgreSQL</productname>
or extensions.
</para>
<para>
There are several different ways of building PostgreSQL on
<productname>Windows</productname>. The complete system can
be built using <productname>MinGW</productname> or
<productname>Visual C++ 2005</productname>. It can also be
built for older versions of <productname>Windows</productname> using
<productname>Cygwin</productname>. Finally, the client access library
(<application>libpq</application>) can be built using
<productname>Visual C++ 6.0</productname> or
<productname>Borland C++</productname> for compatibility with statically
linked applications built using these tools.
</para>
<para>
Building using <productname>MinGW</productname> or
<productname>Cygwin</productname> uses the normal build system, see
<xref linkend="installation"> and the FAQs in
<filename>doc/FAQ_MINGW</filename> and <filename>do/FAQ_CYGWIN</filename>.
Note that <productname>Cygwin</productname> is not recommended, and should
only be used for older versions of <productname>Windows</productname> where
the native build does not work, such as
<productname>Windows 98</productname>.
</para>
<sect1>
<title>Building with <productname>Visual C++ 2005</productname></title>
<para>
The tools for building using <productname>Visual C++ 2005</productname>,
are in the <filename>src/tools/msvc</filename> directory. When building,
make sure there are no tools from <productname>MinGW</productname> or
<productname>Cygwin</productname> present in your system PATH. Also, make
sure you have all the required Visual C++ tools available in the PATH,
usually by starting a <application>Visual Studio Command Prompt</application>
and running the commands from there. All commands should be run from the
<filename>src\tools\msvc</filename> directory.
</para>
<para>
Before you build, edit the file <filename>config.pl</filename> 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
<filename>buildenv.bat</filename> 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:
<screen>
@ECHO OFF
SET PATH=%PATH%;c:\some\where\bison\bin
</screen>
2000-12-21 23:30:39 +01:00
</para>
<sect2>
<title>Requirements</title>
<para>
PostgreSQL will build using either the professional versions (any edition)
2007-03-14 01:15:26 +01:00
or the free Express edition of
<productname>Visual Studio 2005</productname>. The following additional products
are required to build the complete package. Use the
<filename>config.pl</filename> to specify which directories the libraries
are available in.
<variablelist>
<varlistentry>
<term><productname>ActiveState Perl</productname></term>
<listitem><para>
2007-03-14 01:15:26 +01:00
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
<ulink url="http://www.activestate.com"></>.
</para></listitem>
</varlistentry>
<varlistentry>
2007-03-14 01:15:26 +01:00
<term><productname>ActiveState TCL</productname></term>
<listitem><para>
2007-03-14 01:15:26 +01:00
Required for building <application>PL/TCL</application>.
</para></listitem>
</varlistentry>
<varlistentry>
<term><productname>Bison</productname> and
2007-03-14 01:15:26 +01:00
<productname>Flex</productname></term>
<listitem><para>
2007-03-14 01:15:26 +01:00
Bison and Flex are required to build from CVS, 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
2007-03-14 01:15:26 +01:00
downloaded from <ulink url="http://gnuwin32.sourceforge.net"></>.
</para></listitem>
</varlistentry>
<varlistentry>
<term><productname>Diff</productname></term>
<listitem><para>
Diff is required to run the regression tests, and can be downloaded
from <ulink url="http://gnuwin32.sourceforge.net"></>.
</para></listitem>
</varlistentry>
2007-03-14 01:15:26 +01:00
<varlistentry>
<term><productname>Microsoft Platform SDK</productname></term>
<listitem><para>
It is recommended that you upgrade to the latest available version
of the <productname>Microsoft Platform SDK</productname>, available
for download from <ulink url="http://www.microsoft.com/downloads/"></>.
</para></listitem>
</varlistentry>
<varlistentry>
<term><productname>MIT Kerberos</productname></term>
<listitem><para>
2007-03-14 01:15:26 +01:00
Required for Kerberos authentication support. MIT Kerberos can be
downloaded from
<ulink url="http://web.mit.edu/Kerberos/dist/index.html"></>.
</para></listitem>
</varlistentry>
<varlistentry>
<term><productname>libxml2</productname> and
2007-03-14 01:15:26 +01:00
<productname>libxslt</productname></term>
<listitem><para>
Required for XML support. Binaries can be downloaded from
2007-03-14 01:15:26 +01:00
<ulink url="http://zlatkovic.com/pub/libxml"></> or source from
<ulink url="http://xmlsoft.org"></>. Note that libxml2 requires iconv,
which is available from the same download location.
</para></listitem>
</varlistentry>
<varlistentry>
<term><productname>openssl</productname></term>
<listitem><para>
Required for SSL support. Binaries can be downloaded from
<ulink url="http://www.slproweb.com/products/Win32OpenSSL.html"></>
2007-03-14 01:15:26 +01:00
or source from <ulink url="http://www.openssl.org"></>.
</para></listitem>
</varlistentry>
<varlistentry>
<term><productname>pthreads</productname></term>
<listitem><para>
Required for building the <application>ECPG</application> libraries.
2007-03-14 01:15:26 +01:00
Binaries can be downloaded from
<ulink url="ftp://sources.redhat.com/pub/pthreads-win32"></>.
</para></listitem>
</varlistentry>
<varlistentry>
<term><productname>Python</productname></term>
<listitem><para>
Required for building <application>PL/Python</application>. Binaries can
2007-03-14 01:15:26 +01:00
be downloaded from <ulink url="http://www.python.org"></>.
</para></listitem>
</varlistentry>
2007-03-14 01:15:26 +01:00
<varlistentry>
<term><productname>zlib</productname></term>
<listitem><para>
2007-03-14 01:15:26 +01:00
Required for compression support in <application>pg_dump</application>
and <application>pg_restore</application>. Binaries can be downloaded
from <ulink url="http://www.zlib.net"></>.
</para></listitem>
</varlistentry>
</variablelist>
</para>
</sect2>
<sect2>
<title>Building</title>
<para>
To build all of PostgreSQL in debug configuration (the default), run the
2007-03-14 01:15:26 +01:00
command:
<screen>
<userinput>
build
</userinput>
</screen>
To build all of PostgreSQL in release configuration, run the command:
<screen>
<userinput>
build RELEASE
</userinput>
</screen>
To build just a single project, for example psql, run the commands:
<screen>
<userinput>
build psql
</userinput>
<userinput>
build RELEASE psql
</userinput>
</screen>
</para>
2000-12-21 23:30:39 +01:00
<para>
It is also possible to build from inside the Visual Studio GUI. In this
2007-03-14 01:15:26 +01:00
case, you need to run:
<screen>
<userinput>
perl mkvcbuild.pl
</userinput>
</screen>
from the command prompt, and then open the generated
2007-03-14 01:15:26 +01:00
<filename>pgsql.sln</filename> (in the root directory of the source tree)
in Visual Studio.
2000-12-21 23:30:39 +01:00
</para>
</sect2>
<sect2>
<title>Cleaning and installing</title>
<para>
Most of the time, the automatic dependency tracking in Visual Studio will
2007-03-14 01:15:26 +01:00
handle changed files. But if there have been large changes, you may need
to clean the installation. To do this, simply run the
<filename>clean.bat</filename> command, which will automatically clean out
all generated files.
</para>
<para>
By default, all files are written into a subdirectory of the
2007-03-14 01:15:26 +01:00
<filename>debug</filename> or <filename>release</filename> directories. To
install these files using the standard layout, and also generate the files
required to initialize and use the database, run the command:
<screen>
<userinput>
perl install.pl c:\destination\directory
</userinput>
</screen>
</para>
</sect2>
2007-03-21 20:22:52 +01:00
<sect2>
<title>Running the regression tests</title>
<para>
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 <filename>buildenv.bat</filename> file. To run the tests, run one of
the following commands from the <filename>src\tools\msvc</filename>
directory:
<screen>
<userinput>
vcregress check
</userinput>
<userinput>
vcregress installcheck
</userinput>
<userinput>
vcregress plcheck
</userinput>
<userinput>
vcregress contribcheck
</userinput>
2007-03-21 20:22:52 +01:00
</screen>
To change the schedule used (default is the parallel), append it to the
commandline like:
<screen>
<userinput>
vcregress check serial
</userinput>
</screen>
For more information about the regression tests, see
<xref linkend="regress">.
</para>
</sect2>
<sect2>
<title>Building the documentation</title>
<para>
Building the PostgreSQL documentation in HTML format requires several tools
2007-03-14 01:15:26 +01:00
and files. Create a root directory for all these files, and store them
in the subdirectories in the list below.
<variablelist>
<varlistentry>
<term>OpenJade 1.3.1-2</term>
<listitem><para>
Download from
2007-03-14 01:15:26 +01:00
<ulink url="http://sourceforge.net/project/downloading.php?groupname=openjade&amp;filename=openjade-1_3_1-2-bin.zip"></>
and uncompress in the subdirectory <filename>openjade-1.3.1</filename>.
</para></listitem>
</varlistentry>
<varlistentry>
<term>DocBook DTD 4.2</term>
<listitem><para>
Download from
2007-03-14 01:15:26 +01:00
<ulink url="http://www.oasis-open.org/docbook/sgml/4.2/docbook-4.2.zip"></>
and uncompress in the subdirectory <filename>docbook</filename>.
</para></listitem>
</varlistentry>
<varlistentry>
<term>DocBook DSSL 1.79</term>
<listitem><para>
Download from
<ulink url="http://sourceforge.net/project/downloading.php?groupname=docbook&amp;filename=docbook-dsssl-1.79.zip"></>
and uncompress in the subdirectory
2007-03-14 01:15:26 +01:00
<filename>docbook-dsssl-1.79</filename>.
</para></listitem>
</varlistentry>
<varlistentry>
<term>ISO character entities</term>
<listitem><para>
Download from
2007-03-14 01:15:26 +01:00
<ulink url="http://www.oasis-open.org/cover/ISOEnts.zip"></> and
uncompress in the subdirectory <filename>docbook</filename>.
</para></listitem>
</varlistentry>
</variablelist>
Edit the <filename>buildenv.bat</filename> file, and add a variable for the
2007-03-14 01:15:26 +01:00
location of the root directory, for example:
<screen>
@ECHO OFF
SET DOCROOT=c:\docbook
</screen>
To build the documentation, run the command
2007-03-14 01:15:26 +01:00
<filename>builddoc.bat</filename>. Note that this will actually run the
build twice, in order to generate the indexes. The generated HTML files
will be in <filename>doc\src\sgml</filename>.
</para>
</sect2>
</sect1>
<sect1>
<title>Building <application>libpq</application> with
<productname>Visual C++</productname> or
<productname>Borland C++</productname></title>
2000-12-21 23:30:39 +01:00
<para>
Using <productname>Visual Studio 6.0</productname> or
<productname>Borland C++</productname> to build libpq is only recommended
if you need a version with different debug/release flags, or if you need a
static library to link into an application. For normal use the
<productname>MinGW</productname> or
<productname>Visual Studio 2005</productname> version is recommended.
</para>
<para>
To build the <application>libpq</application> client library using
<productname>Visual Studio 6.0</productname>, change into the
2000-12-21 23:30:39 +01:00
<filename>src</filename> directory and type the command
<screen>
<userinput>nmake /f win32.mak</userinput>
</screen>
</para>
2004-09-27 21:43:17 +02:00
<para>
To build the <application>libpq</application> client library using
<productname>Borland C++</productname>, change into the
<filename>src</filename> directory and type the command
2004-09-27 21:43:17 +02:00
<screen>
<userinput>make -N -DCFG=Release /f bcc32.mak</userinput>
2004-09-27 21:43:17 +02:00
</screen>
</para>
<sect2>
<title>Generated files</title>
2000-12-21 23:30:39 +01:00
<para>
The following files will be built:
2000-12-21 23:30:39 +01:00
<variablelist>
<varlistentry>
<term><filename>interfaces\libpq\Release\libpq.dll</filename></term>
<listitem>
<para>
The dynamically linkable frontend library
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><filename>interfaces\libpq\Release\libpqdll.lib</filename></term>
<listitem>
<para>
Import library to link your programs to <filename>libpq.dll</filename>
2000-12-21 23:30:39 +01:00
</para>
</listitem>
</varlistentry>
2000-12-21 23:30:39 +01:00
<varlistentry>
<term><filename>interfaces\libpq\Release\libpq.lib</filename></term>
<listitem>
<para>
Static version of the frontend library
2000-12-21 23:30:39 +01:00
</para>
</listitem>
</varlistentry>
2000-12-21 23:30:39 +01:00
</variablelist>
</para>
2000-12-21 23:30:39 +01:00
<para>
Normally you do not need to install any of the client files. You should
place the <filename>libpq.dll</filename> file in the same directory
as your applications executable file. Do not install
<filename>libpq.dll</filename> into your Windows, System or System32
directory unless absolutely necessary.
If this file is installed using a setup program, it should
2000-12-21 23:30:39 +01:00
be installed with version checking using the
<symbol>VERSIONINFO</symbol> resource included in the file, to
ensure that a newer version of the library is not overwritten.
</para>
2000-12-21 23:30:39 +01:00
<para>
If you are planning to do development using <application>libpq</application>
2004-09-27 21:43:17 +02:00
on this machine, you will have to add the
<filename>src\include</filename> and
<filename>src\interfaces\libpq</filename> subdirectories of the source
2004-12-27 00:06:56 +01:00
tree to the include path in your compiler's settings.
2000-12-21 23:30:39 +01:00
</para>
2000-12-21 23:30:39 +01:00
<para>
To use the library, you must add the
2000-12-21 23:30:39 +01:00
<filename>libpqdll.lib</filename> file to your project. (In Visual
2001-11-28 21:49:10 +01:00
C++, just right-click on the project and choose to add it.)
2000-12-21 23:30:39 +01:00
</para>
</sect2>
</sect1>
2000-12-21 23:30:39 +01:00
</chapter>