diff options
Diffstat (limited to 'doc/src/sgml/html/install-windows-full.html')
-rw-r--r-- | doc/src/sgml/html/install-windows-full.html | 344 |
1 files changed, 344 insertions, 0 deletions
diff --git a/doc/src/sgml/html/install-windows-full.html b/doc/src/sgml/html/install-windows-full.html new file mode 100644 index 0000000..2d09e72 --- /dev/null +++ b/doc/src/sgml/html/install-windows-full.html @@ -0,0 +1,344 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>18.1. Building with Visual C++ or the Microsoft Windows SDK</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="install-windows.html" title="Chapter 18. Installation from Source Code on Windows" /><link rel="next" href="runtime.html" title="Chapter 19. Server Setup and Operation" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">18.1. Building with <span class="productname">Visual C++</span> or the + <span class="productname">Microsoft Windows SDK</span></th></tr><tr><td width="10%" align="left"><a accesskey="p" href="install-windows.html" title="Chapter 18. Installation from Source Code on Windows">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="install-windows.html" title="Chapter 18. Installation from Source Code on Windows">Up</a></td><th width="60%" align="center">Chapter 18. Installation from Source Code on <span class="productname">Windows</span></th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 16.2 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="runtime.html" title="Chapter 19. Server Setup and Operation">Next</a></td></tr></table><hr /></div><div class="sect1" id="INSTALL-WINDOWS-FULL"><div class="titlepage"><div><div><h2 class="title" style="clear: both">18.1. Building with <span class="productname">Visual C++</span> or the + <span class="productname">Microsoft Windows SDK</span> <a href="#INSTALL-WINDOWS-FULL" class="id_link">#</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="sect2"><a href="install-windows-full.html#INSTALL-WINDOWS-FULL-REQUIREMENTS">18.1.1. Requirements</a></span></dt><dt><span class="sect2"><a href="install-windows-full.html#INSTALL-WINDOWS-FULL-64-BIT">18.1.2. Special Considerations for 64-Bit Windows</a></span></dt><dt><span class="sect2"><a href="install-windows-full.html#INSTALL-WINDOWS-FULL-BUILD">18.1.3. Building</a></span></dt><dt><span class="sect2"><a href="install-windows-full.html#INSTALL-WINDOWS-FULL-CLEAN-INST">18.1.4. Cleaning and Installing</a></span></dt><dt><span class="sect2"><a href="install-windows-full.html#INSTALL-WINDOWS-FULL-REG-TESTS">18.1.5. Running the Regression Tests</a></span></dt></dl></div><p> + PostgreSQL can be built using the Visual C++ compiler suite from Microsoft. + These compilers can be either from <span class="productname">Visual Studio</span>, + <span class="productname">Visual Studio Express</span> or some versions of the + <span class="productname">Microsoft Windows SDK</span>. If you do not already have a + <span class="productname">Visual Studio</span> environment set up, the easiest + ways are to use the compilers from + <span class="productname">Visual Studio 2022</span> or those in the + <span class="productname">Windows SDK 10</span>, which are both free downloads + from Microsoft. + </p><p> + Both 32-bit and 64-bit builds are possible with the Microsoft Compiler suite. + 32-bit PostgreSQL builds are possible with + <span class="productname">Visual Studio 2015</span> to + <span class="productname">Visual Studio 2022</span>, + as well as standalone Windows SDK releases 10 and above. + 64-bit PostgreSQL builds are supported with + <span class="productname">Microsoft Windows SDK</span> version 10 and above or + <span class="productname">Visual Studio 2015</span> and above. + + </p><p> + The tools for building using <span class="productname">Visual C++</span> or + <span class="productname">Platform SDK</span> are in the + <code class="filename">src\tools\msvc</code> 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. In + <span class="productname">Visual Studio</span>, start the + <span class="application">Visual Studio Command Prompt</span>. + If you wish to build a 64-bit version, you must use the 64-bit version of + the command, and vice versa. + Starting with <span class="productname">Visual Studio 2017</span> this can be + done from the command line using <code class="command">VsDevCmd.bat</code>, see + <code class="command">-help</code> for the available options and their default values. + <code class="command">vsvars32.bat</code> is available in + <span class="productname">Visual Studio 2015</span> and earlier versions for the + same purpose. + From the <span class="application">Visual Studio Command Prompt</span>, you can + change the targeted CPU architecture, build type, and target OS by using the + <code class="command">vcvarsall.bat</code> command, e.g., + <code class="command">vcvarsall.bat x64 10.0.10240.0</code> to target Windows 10 + with a 64-bit release build. See <code class="command">-help</code> for the other + options of <code class="command">vcvarsall.bat</code>. All commands should be run from + the <code class="filename">src\tools\msvc</code> directory. + </p><p> + Before you build, you can create the file <code class="filename">config.pl</code> + 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 <code class="filename">config_default.pl</code>, + and then apply any changes from <code class="filename">config.pl</code>. For example, + to specify the location of your <span class="productname">Python</span> installation, + put the following in <code class="filename">config.pl</code>: +</p><pre class="programlisting"> +$config->{python} = 'c:\python310'; +</pre><p> + You only need to specify those parameters that are different from what's in + <code class="filename">config_default.pl</code>. + </p><p> + If you need to set any other environment variables, create a file called + <code class="filename">buildenv.pl</code> 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="programlisting"> +$ENV{PATH}=$ENV{PATH} . ';c:\some\where\bison\bin'; +</pre><p> + </p><p> + To pass additional command line arguments to the Visual Studio build + command (msbuild or vcbuild): +</p><pre class="programlisting"> +$ENV{MSBFLAGS}="/m"; +</pre><p> + </p><div class="sect2" id="INSTALL-WINDOWS-FULL-REQUIREMENTS"><div class="titlepage"><div><div><h3 class="title">18.1.1. Requirements <a href="#INSTALL-WINDOWS-FULL-REQUIREMENTS" class="id_link">#</a></h3></div></div></div><p> + The following additional products are required to build + <span class="productname">PostgreSQL</span>. Use the + <code class="filename">config.pl</code> file to specify which directories the libraries + are available in. + + </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="productname">Microsoft Windows SDK</span></span></dt><dd><p> + If your build environment doesn't ship with a supported version of the + <span class="productname">Microsoft Windows SDK</span> it + is recommended that you upgrade to the latest version (currently + version 10), available for download from + <a class="ulink" href="https://www.microsoft.com/download" target="_top">https://www.microsoft.com/download</a>. + </p><p> + You must always include the + <span class="application">Windows Headers and Libraries</span> part of the SDK. + If you install a <span class="productname">Windows SDK</span> + including the <span class="application">Visual C++ Compilers</span>, + you don't need <span class="productname">Visual Studio</span> to build. + Note that as of Version 8.0a the Windows SDK no longer ships with a + complete command-line build environment. + </p></dd><dt><span class="term"><span class="productname">ActiveState Perl</span></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 class="ulink" href="https://www.activestate.com" target="_top">https://www.activestate.com</a> + (Note: version 5.14 or later is required, + the free Standard Distribution is sufficient). + </p></dd></dl></div><p> + </p><p> + The following additional products are not required to get started, + but are required to build the complete package. Use the + <code class="filename">config.pl</code> file to specify which directories the libraries + are available in. + + </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="productname">ActiveState TCL</span></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="term"><span class="productname">Bison</span> and + <span class="productname">Flex</span></span></dt><dd><p> + <span class="productname">Bison</span> and <span class="productname">Flex</span> are + required to build from Git, but not required when building from a release + file. Only <span class="productname">Bison</span> versions 2.3 and later + will work. <span class="productname">Flex</span> must be version 2.5.35 or later. + </p><p> + Both <span class="productname">Bison</span> and <span class="productname">Flex</span> + are included in the <span class="productname">msys</span> tool suite, available + from <a class="ulink" href="http://www.mingw.org/wiki/MSYS" target="_top">http://www.mingw.org/wiki/MSYS</a> as part of the + <span class="productname">MinGW</span> compiler suite. + </p><p> + You will need to add the directory containing + <code class="filename">flex.exe</code> and <code class="filename">bison.exe</code> to the + PATH environment variable in <code class="filename">buildenv.pl</code> unless + they are already in PATH. In the case of MinGW, the directory is the + <code class="filename">\msys\1.0\bin</code> subdirectory of your MinGW + installation directory. + </p><div class="note"><h3 class="title">Note</h3><p> + The Bison distribution from GnuWin32 appears to have a bug that + causes Bison to malfunction when installed in a directory with + spaces in the name, such as the default location on English + installations <code class="filename">C:\Program Files\GnuWin32</code>. + Consider installing into <code class="filename">C:\GnuWin32</code> or use the + NTFS short name path to GnuWin32 in your PATH environment setting + (e.g., <code class="filename">C:\PROGRA~1\GnuWin32</code>). + </p></div></dd><dt><span class="term"><span class="productname">Diff</span></span></dt><dd><p> + Diff is required to run the regression tests, and can be downloaded + from <a class="ulink" href="http://gnuwin32.sourceforge.net" target="_top">http://gnuwin32.sourceforge.net</a>. + </p></dd><dt><span class="term"><span class="productname">Gettext</span></span></dt><dd><p> + Gettext is required to build with NLS support, and can be downloaded + from <a class="ulink" 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="term"><span class="productname">MIT Kerberos</span></span></dt><dd><p> + Required for GSSAPI authentication support. MIT Kerberos can be + downloaded from + <a class="ulink" href="https://web.mit.edu/Kerberos/dist/index.html" target="_top">https://web.mit.edu/Kerberos/dist/index.html</a>. + </p></dd><dt><span class="term"><span class="productname">libxml2</span> and + <span class="productname">libxslt</span></span></dt><dd><p> + Required for XML support. Binaries can be downloaded from + <a class="ulink" href="https://zlatkovic.com/pub/libxml" target="_top">https://zlatkovic.com/pub/libxml</a> or source from + <a class="ulink" 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="term"><span class="productname">LZ4</span></span></dt><dd><p> + Required for supporting <span class="productname">LZ4</span> compression. + Binaries and source can be downloaded from + <a class="ulink" href="https://github.com/lz4/lz4/releases" target="_top">https://github.com/lz4/lz4/releases</a>. + </p></dd><dt><span class="term"><span class="productname">Zstandard</span></span></dt><dd><p> + Required for supporting <span class="productname">Zstandard</span> compression. + Binaries and source can be downloaded from + <a class="ulink" href="https://github.com/facebook/zstd/releases" target="_top">https://github.com/facebook/zstd/releases</a>. + </p></dd><dt><span class="term"><span class="productname">OpenSSL</span></span></dt><dd><p> + Required for SSL support. Binaries can be downloaded from + <a class="ulink" href="https://slproweb.com/products/Win32OpenSSL.html" target="_top">https://slproweb.com/products/Win32OpenSSL.html</a> + or source from <a class="ulink" href="https://www.openssl.org" target="_top">https://www.openssl.org</a>. + </p></dd><dt><span class="term"><span class="productname">ossp-uuid</span></span></dt><dd><p> + Required for UUID-OSSP support (contrib only). Source can be + downloaded from + <a class="ulink" href="http://www.ossp.org/pkg/lib/uuid/" target="_top">http://www.ossp.org/pkg/lib/uuid/</a>. + </p></dd><dt><span class="term"><span class="productname">Python</span></span></dt><dd><p> + Required for building <span class="application">PL/Python</span>. Binaries can + be downloaded from <a class="ulink" href="https://www.python.org" target="_top">https://www.python.org</a>. + </p></dd><dt><span class="term"><span class="productname">zlib</span></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 class="ulink" href="https://www.zlib.net" target="_top">https://www.zlib.net</a>. + </p></dd></dl></div><p> + </p></div><div class="sect2" id="INSTALL-WINDOWS-FULL-64-BIT"><div class="titlepage"><div><div><h3 class="title">18.1.2. Special Considerations for 64-Bit Windows <a href="#INSTALL-WINDOWS-FULL-64-BIT" class="id_link">#</a></h3></div></div></div><p> + PostgreSQL will only build for the x64 architecture on 64-bit Windows. + </p><p> + 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. + </p><p> + To use a server-side third party library such as <span class="productname">Python</span> or + <span class="productname">OpenSSL</span>, this library <span class="emphasis"><em>must</em></span> 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. + </p></div><div class="sect2" id="INSTALL-WINDOWS-FULL-BUILD"><div class="titlepage"><div><div><h3 class="title">18.1.3. Building <a href="#INSTALL-WINDOWS-FULL-BUILD" class="id_link">#</a></h3></div></div></div><p> + To build all of PostgreSQL in release configuration (the default), run the + command: +</p><pre class="screen"> +<strong class="userinput"><code>build</code></strong> +</pre><p> + To build all of PostgreSQL in debug configuration, run the command: +</p><pre class="screen"> +<strong class="userinput"><code>build DEBUG</code></strong> +</pre><p> + To build just a single project, for example psql, run the commands: +</p><pre class="screen"> +<strong class="userinput"><code>build psql</code></strong> +<strong class="userinput"><code>build DEBUG psql</code></strong> +</pre><p> + To change the default build configuration to debug, put the following + in the <code class="filename">buildenv.pl</code> file: +</p><pre class="programlisting"> +$ENV{CONFIG}="Debug"; +</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"> +<strong class="userinput"><code>perl mkvcbuild.pl</code></strong> +</pre><p> + from the command prompt, and then open the generated + <code class="filename">pgsql.sln</code> (in the root directory of the source tree) + in Visual Studio. + </p></div><div class="sect2" id="INSTALL-WINDOWS-FULL-CLEAN-INST"><div class="titlepage"><div><div><h3 class="title">18.1.4. Cleaning and Installing <a href="#INSTALL-WINDOWS-FULL-CLEAN-INST" class="id_link">#</a></h3></div></div></div><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 + <code class="filename">clean.bat</code> command, which will automatically clean out + all generated files. You can also run it with the + <em class="parameter"><code>dist</code></em> parameter, in which case it will behave like + <strong class="userinput"><code>make distclean</code></strong> and remove the flex/bison output files + as well. + </p><p> + By default, all files are written into a subdirectory of the + <code class="filename">debug</code> or <code class="filename">release</code> 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"> +<strong class="userinput"><code>install c:\destination\directory</code></strong> +</pre><p> + </p><p> + If you want to install only the client applications and + interface libraries, then you can use these commands: +</p><pre class="screen"> +<strong class="userinput"><code>install c:\destination\directory client</code></strong> +</pre><p> + </p></div><div class="sect2" id="INSTALL-WINDOWS-FULL-REG-TESTS"><div class="titlepage"><div><div><h3 class="title">18.1.5. Running the Regression Tests <a href="#INSTALL-WINDOWS-FULL-REG-TESTS" class="id_link">#</a></h3></div></div></div><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 <code class="filename">buildenv.pl</code> file. To run the tests, run one of + the following commands from the <code class="filename">src\tools\msvc</code> + directory: +</p><pre class="screen"> +<strong class="userinput"><code>vcregress check</code></strong> +<strong class="userinput"><code>vcregress installcheck</code></strong> +<strong class="userinput"><code>vcregress plcheck</code></strong> +<strong class="userinput"><code>vcregress contribcheck</code></strong> +<strong class="userinput"><code>vcregress modulescheck</code></strong> +<strong class="userinput"><code>vcregress ecpgcheck</code></strong> +<strong class="userinput"><code>vcregress isolationcheck</code></strong> +<strong class="userinput"><code>vcregress bincheck</code></strong> +<strong class="userinput"><code>vcregress recoverycheck</code></strong> +<strong class="userinput"><code>vcregress taptest</code></strong> +</pre><p> + + To change the schedule used (default is parallel), append it to the + command line like: +</p><pre class="screen"> +<strong class="userinput"><code>vcregress check serial</code></strong> +</pre><p> + + <code class="command">vcregress taptest</code> can be used to run the TAP tests + of a target directory, like: +</p><pre class="screen"> +<strong class="userinput"><code>vcregress taptest src\bin\initdb\</code></strong> +</pre><p> + + For more information about the regression tests, see + <a class="xref" href="regress.html" title="Chapter 33. Regression Tests">Chapter 33</a>. + </p><p> + Running the regression tests on client programs with + <code class="command">vcregress bincheck</code>, on recovery tests with + <code class="command">vcregress recoverycheck</code>, or TAP tests specified with + <code class="command">vcregress taptest</code> requires an additional Perl module + to be installed: + </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="productname">IPC::Run</span></span></dt><dd><p> + As of this writing, <code class="literal">IPC::Run</code> is not included in the + ActiveState Perl installation, nor in the ActiveState Perl Package + Manager (PPM) library. To install, download the + <code class="filename">IPC-Run-<version>.tar.gz</code> source archive from + <acronym class="acronym">CPAN</acronym>, + at <a class="ulink" href="https://metacpan.org/dist/IPC-Run" target="_top">https://metacpan.org/dist/IPC-Run</a>, and + uncompress. Edit the <code class="filename">buildenv.pl</code> file, and add a PERL5LIB + variable to point to the <code class="filename">lib</code> subdirectory from the + extracted archive. For example: +</p><pre class="programlisting"> +$ENV{PERL5LIB}=$ENV{PERL5LIB} . ';c:\IPC-Run-0.94\lib'; +</pre><p> + </p></dd></dl></div><p> + </p><p> + The TAP tests run with <code class="command">vcregress</code> support the + environment variables <code class="varname">PROVE_TESTS</code>, that is expanded + automatically using the name patterns given, and + <code class="varname">PROVE_FLAGS</code>. These can be set on a Windows terminal, + before running <code class="command">vcregress</code>: +</p><pre class="programlisting"> +set PROVE_FLAGS=--timer --jobs 2 +set PROVE_TESTS=t/020*.pl t/010*.pl +</pre><p> + It is also possible to set up those parameters in + <code class="filename">buildenv.pl</code>: +</p><pre class="programlisting"> +$ENV{PROVE_FLAGS}='--timer --jobs 2' +$ENV{PROVE_TESTS}='t/020*.pl t/010*.pl' +</pre><p> + </p><p> + Additionally, the behavior of TAP tests can be controlled by a set of + environment variables, see <a class="xref" href="regress-tap.html#REGRESS-TAP-VARS" title="33.4.1. Environment Variables">Section 33.4.1</a>. + </p><p> + Some of the TAP tests depend on a set of external commands that would + optionally trigger tests related to them. Each one of those variables + can be set or unset in <code class="filename">buildenv.pl</code>: + </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="varname">GZIP_PROGRAM</code></span></dt><dd><p> + Path to a <span class="application">gzip</span> command. The default is + <code class="literal">gzip</code>, which will search for a command by that + name in the configured <code class="envar">PATH</code>. + </p></dd><dt><span class="term"><code class="varname">LZ4</code></span></dt><dd><p> + Path to a <span class="application">lz4</span> command. The default is + <code class="literal">lz4</code>, which will search for a command by that + name in the configured <code class="envar">PATH</code>. + </p></dd><dt><span class="term"><code class="varname">OPENSSL</code></span></dt><dd><p> + Path to an <span class="application">openssl</span> command. The default is + <code class="literal">openssl</code>, which will search for a command by that + name in the configured <code class="envar">PATH</code>. + </p></dd><dt><span class="term"><code class="varname">TAR</code></span></dt><dd><p> + Path to a <span class="application">tar</span> command. The default is + <code class="literal">tar</code>, which will search for a command by that + name in the configured <code class="envar">PATH</code>. + </p></dd><dt><span class="term"><code class="varname">ZSTD</code></span></dt><dd><p> + Path to a <span class="application">zstd</span> command. The default is + <code class="literal">zstd</code>, which will search for a command by that + name in the configured <code class="envar">PATH</code>. + </p></dd></dl></div><p> + </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="install-windows.html" title="Chapter 18. Installation from Source Code on Windows">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="install-windows.html" title="Chapter 18. Installation from Source Code on Windows">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="runtime.html" title="Chapter 19. Server Setup and Operation">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 18. Installation from Source Code on <span class="productname">Windows</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 16.2 Documentation">Home</a></td><td width="40%" align="right" valign="top"> Chapter 19. Server Setup and Operation</td></tr></table></div></body></html>
\ No newline at end of file |