-
+
Installation from Source Code on Windows
It is recommended that most users download the binary distribution for
- Windows, available as a
Windows Installer package
+ Windows, available as a one-click installer package
from the
PostgreSQL website. Building from source
is only intended for people developing
PostgreSQL
or extensions.
There are several different ways of building PostgreSQL on
-
Windows. The complete system can
- be built using
MinGW or
-
Visual C++ 2005. It can also be
- built for older versions of
Windows using
-
Cygwin. Finally, the client access library
+
Windows. The simplest way to build with
+ Microsoft tools is to intall a modern version of the
+
Microsoft Platform SDK and use use the included
+ compiler. It is also possible to build with the full
+
Microsoft Visual C++ 2005 or 2008. In some cases
+ that requires the installation of the
Platform SDK
+ in addition to the compiler.
+
+
+ It is also possible to build PostgreSQL using the GNU compiler tools
+ provided by
MinGW, or using
+
Cygwin for older versions of
+
+
+ Finally, the client access library
(
libpq) can be built using
Borland C++ for compatibility with statically
Cygwin uses the normal build system, see
and the specific notes in
and .
+ These builds cannot generate 64-bit binaries.
Cygwin is not recommended and should
only be used for older versions of
Windows where
the native build does not work, such as
+ only recommended if you are building other modules using it. The official
+ binaries are built using
Visual Studio.
-
Building with Visual C++ 2005
+
Building with Visual C++ or the
+
+ PostgreSQL can be built using the Visual C++ compiler suite from Microsoft.
+ These compilers can be either from
Visual Studio,
+
Visual Studio Express or recent versions of the
+
Platform SDK. If you do not already have a
+
Visual Studio environment set up, the easiest
+ way us to use the compilers in the
Platform SDK,
+ which is a free download from Microsoft.
+
- The tools for building using
Visual C++ 2005,
+ PostgreSQL supports the compilers from
+
Visual Studio 2008. When using the Platform SDK
+ only, or when building for 64-bit Windows, only
+
Visual Studio 2008 is supported.
+
+
+ The tools for building using
Visual C++,
are in the src/tools/msvc directory. When building,
make sure there are no tools from
MinGW or
Cygwin present in your system PATH. Also, make
- sure you have all the required Visual C++ tools available in the PATH,
- usually by starting a
Visual Studio Command Prompt
- and running the commands from there. All commands should be run from the
- src\tools\msvc directory.
+ sure you have all the required Visual C++ tools available in the PATH. In
+
Visual Studio, start the
+
Visual Studio Command Prompt. In the
+
Platform SDK, start the
+
CMD shell listed under the SDK on the Start Menu.
+ If you wish to build a 64-bit version, you must use the 64-bit version of
+ the command, and vice versa.
+ All commands should be run from the src\tools\msvc
+ directory.
+
+
+ Before you build, you may need to edit the file config.pl
+ to reflect any configuration options you want to change, or the paths to
+ any third party libraries to use. The complete configuration is determined
+ by first reading and parsing the file config_default.pl,
+ and then apply any changes from config.pl. For example,
+ to specify the location of your
Python installation,
+ put the following in config.pl:
+
+ $config->{python} = 'c:\python26';
+
+ You only need to specify those parameters that are different from what's in
+ config_default.pl.
- Before you build, edit the file config.pl 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
buildenv.pl and put the required commands there. For
example, to add the path for bison when it's not in the PATH, create a file
Requirements
- PostgreSQL will build using either the professional versions (any edition)
- or the free Express edition of
-
Visual Studio 2005. The following additional products
- are required to build the complete package. Use the
+ The following additional products are required to build
config.pl file to specify which directories the libraries
are available in.
+
+ It is recommended that you upgrade to the latest available version
+ of the
Microsoft Platform SDK, available
+
+ You must always include the
+
Windows Headers and Libraries part of the SDK.
+ If you install the
Platform SDK
+ including the
Visual C++ Compilers,
+ you don't need
Visual Studio to build.
+
+
+
+
+
+ The following additional products are not required to get started,
+ but are required to build the complete package. Use the
+ config.pl file to specify which directories the libraries
+ are available in.
+
+
-
- It is recommended that you upgrade to the latest available version
- of the
Microsoft Platform SDK, available
-
-
-
+
+
Special considerations for 64-bit Windows
+
+ PostgreSQL will only build for the x64 architecture on 64-bit Windows, there
+ is no support for Itanium processors.
+
+
+ Mixing 32- and 64-bit versions in the same build tree is not supported.
+ The build system will automatically detect if it's running in a 32- or
+ 64-bit environment, and build PostgreSQL accordingly. For this reason, it
+ is important to start the correct command prompt before building.
+
+
+ To use a server-side third party library such as
python> or
+
openssl>, this library must also be
+ 64-bit. There is no support for loading a 32-bit library in a 64-bit
+ server. Several of the third party libraries that PostgreSQL supports may
+ only be available in 32-bit versions, in which case they cannot be used with
+ 64-bit PostgreSQL.
+
+
+
Building
required to initialize and use the database, run the command:
- perl install.pl c:\destination\directory
+ install c:\destination\directory
- Using
Visual C++ 7.1-8.0 or
+ Using
Visual C++ 7.1-9.0 or
Borland C++ 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
-
Visual Studio 2005 version is recommended.
+
Platform SDK method is recommended.