/
Ao
/
MaxReport
Обзор
Документация
Войти
/
Ao
/
MaxReport
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
pgsql/doc/src/sgml/html/installation-platform-notes.html
340 строк
27 KB
AoAnima
first_commit
13 июл 2026, 17:47
13 июл 2026, 17:47
f1a670a
Код
Авторство
О чём код?
<?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>17.7. Platform-Specific Notes</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="supported-platforms.html" title="17.6. Supported Platforms" /><link rel="next" href="runtime.html" title="Chapter 18. 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">17.7. Platform-Specific Notes</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="supported-platforms.html" title="17.6. Supported Platforms">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="installation.html" title="Chapter 17. Installation from Source Code">Up</a></td><th width="60%" align="center">Chapter 17. Installation from Source Code</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 18.4 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="runtime.html" title="Chapter 18. Server Setup and Operation">Next</a></td></tr></table><hr /></div><div class="sect1" id="INSTALLATION-PLATFORM-NOTES"><div class="titlepage"><div><div><h2 class="title" style="clear: both">17.7. Platform-Specific Notes <a href="#INSTALLATION-PLATFORM-NOTES" class="id_link">#</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="sect2"><a href="installation-platform-notes.html#INSTALLATION-NOTES-CYGWIN">17.7.1. Cygwin</a></span></dt><dt><span class="sect2"><a href="installation-platform-notes.html#INSTALLATION-NOTES-MACOS">17.7.2. macOS</a></span></dt><dt><span class="sect2"><a href="installation-platform-notes.html#INSTALLATION-NOTES-MINGW">17.7.3. MinGW</a></span></dt><dt><span class="sect2"><a href="installation-platform-notes.html#INSTALLATION-NOTES-SOLARIS">17.7.4. Solaris</a></span></dt><dt><span class="sect2"><a href="installation-platform-notes.html#INSTALLATION-NOTES-VISUAL-STUDIO">17.7.5. Visual Studio</a></span></dt></dl></div><p> This section documents additional platform-specific issues regarding the installation and setup of PostgreSQL. Be sure to read the installation instructions, and in particular <a class="xref" href="install-requirements.html" title="17.1. Requirements">Section 17.1</a> as well. Also, check <a class="xref" href="regress.html" title="Chapter 31. Regression Tests">Chapter 31</a> regarding the interpretation of regression test results. </p><p> Platforms that are not covered here have no known platform-specific installation issues. </p><div class="sect2" id="INSTALLATION-NOTES-CYGWIN"><div class="titlepage"><div><div><h3 class="title">17.7.1. Cygwin <a href="#INSTALLATION-NOTES-CYGWIN" class="id_link">#</a></h3></div></div></div><a id="id-1.6.4.10.4.2" class="indexterm"></a><p> PostgreSQL can be built using Cygwin, a Linux-like environment for Windows, but that method is inferior to the native Windows build and running a server under Cygwin is no longer recommended. </p><p> When building from source, proceed according to the Unix-style installation procedure (i.e., <code class="literal">./configure; make</code>; etc.), noting the following Cygwin-specific differences: </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p> Set your path to use the Cygwin bin directory before the Windows utilities. This will help prevent problems with compilation. </p></li><li class="listitem"><p> The <code class="command">adduser</code> command is not supported; use the appropriate user management application on Windows. Otherwise, skip this step. </p></li><li class="listitem"><p> The <code class="command">su</code> command is not supported; use ssh to simulate su on Windows. Otherwise, skip this step. </p></li><li class="listitem"><p> <span class="productname">OpenSSL</span> is not supported. </p></li><li class="listitem"><p> Start <code class="command">cygserver</code> for shared memory support. To do this, enter the command <code class="literal">/usr/sbin/cygserver &</code>. This program needs to be running anytime you start the PostgreSQL server or initialize a database cluster (<code class="command">initdb</code>). The default <code class="command">cygserver</code> configuration may need to be changed (e.g., increase <code class="symbol">SEMMNS</code>) to prevent PostgreSQL from failing due to a lack of system resources. </p></li><li class="listitem"><p> Building might fail on some systems where a locale other than C is in use. To fix this, set the locale to C by doing <code class="command">export LANG=C.utf8</code> before building, and then setting it back to the previous setting after you have installed PostgreSQL. </p></li><li class="listitem"><p> The parallel regression tests (<code class="literal">make check</code>) can generate spurious regression test failures due to overflowing the <code class="function">listen()</code> backlog queue which causes connection refused errors or hangs. You can limit the number of connections using the make variable <code class="varname">MAX_CONNECTIONS</code> thus: </p><pre class="programlisting"> make MAX_CONNECTIONS=5 check </pre><p> (On some systems you can have up to about 10 simultaneous connections.) </p></li></ul></div><p> </p><p> It is possible to install <code class="command">cygserver</code> and the PostgreSQL server as Windows NT services. For information on how to do this, please refer to the <code class="filename">README</code> document included with the PostgreSQL binary package on Cygwin. It is installed in the directory <code class="filename">/usr/share/doc/Cygwin</code>. </p></div><div class="sect2" id="INSTALLATION-NOTES-MACOS"><div class="titlepage"><div><div><h3 class="title">17.7.2. macOS <a href="#INSTALLATION-NOTES-MACOS" class="id_link">#</a></h3></div></div></div><a id="id-1.6.4.10.5.2" class="indexterm"></a><p> To build <span class="productname">PostgreSQL</span> from source on <span class="productname">macOS</span>, you will need to install Apple's command line developer tools, which can be done by issuing </p><pre class="programlisting"> xcode-select --install </pre><p> (note that this will pop up a GUI dialog window for confirmation). You may or may not wish to also install Xcode. </p><p> On recent <span class="productname">macOS</span> releases, it's necessary to embed the <span class="quote">“<span class="quote">sysroot</span>”</span> path in the include switches used to find some system header files. This results in the outputs of the <span class="application">configure</span> script varying depending on which SDK version was used during <span class="application">configure</span>. That shouldn't pose any problem in simple scenarios, but if you are trying to do something like building an extension on a different machine than the server code was built on, you may need to force use of a different sysroot path. To do that, set <code class="varname">PG_SYSROOT</code>, for example </p><pre class="programlisting"> make PG_SYSROOT=<em class="replaceable"><code>/desired/path</code></em> all </pre><p> To find out the appropriate path on your machine, run </p><pre class="programlisting"> xcrun --show-sdk-path </pre><p> Note that building an extension using a different sysroot version than was used to build the core server is not really recommended; in the worst case it could result in hard-to-debug ABI inconsistencies. </p><p> You can also select a non-default sysroot path when configuring, by specifying <code class="varname">PG_SYSROOT</code> to <span class="application">configure</span>: </p><pre class="programlisting"> ./configure ... PG_SYSROOT=<em class="replaceable"><code>/desired/path</code></em> </pre><p> This would primarily be useful to cross-compile for some other macOS version. There is no guarantee that the resulting executables will run on the current host. </p><p> To suppress the <code class="option">-isysroot</code> options altogether, use </p><pre class="programlisting"> ./configure ... PG_SYSROOT=none </pre><p> (any nonexistent pathname will work). This might be useful if you wish to build with a non-Apple compiler, but beware that that case is not tested or supported by the PostgreSQL developers. </p><p> <span class="productname">macOS</span>'s <span class="quote">“<span class="quote">System Integrity Protection</span>”</span> (SIP) feature breaks <code class="literal">make check</code>, because it prevents passing the needed setting of <code class="literal">DYLD_LIBRARY_PATH</code> down to the executables being tested. You can work around that by doing <code class="literal">make install</code> before <code class="literal">make check</code>. Most PostgreSQL developers just turn off SIP, though. </p></div><div class="sect2" id="INSTALLATION-NOTES-MINGW"><div class="titlepage"><div><div><h3 class="title">17.7.3. MinGW <a href="#INSTALLATION-NOTES-MINGW" class="id_link">#</a></h3></div></div></div><a id="id-1.6.4.10.6.2" class="indexterm"></a><p> PostgreSQL for Windows can be built using MinGW, a Unix-like build environment for Windows. It is recommended to use the <a class="ulink" href="https://www.msys2.org/" target="_top">MSYS2</a> environment for this and also to install any prerequisite packages. </p><div class="sect3" id="MINGW-CRASH-DUMPS"><div class="titlepage"><div><div><h4 class="title">17.7.3.1. Collecting Crash Dumps <a href="#MINGW-CRASH-DUMPS" class="id_link">#</a></h4></div></div></div><p> If PostgreSQL on Windows crashes, it has the ability to generate <span class="productname">minidumps</span> that can be used to track down the cause for the crash, similar to core dumps on Unix. These dumps can be read using the <span class="productname">Windows Debugger Tools</span> or using <span class="productname">Visual Studio</span>. To enable the generation of dumps on Windows, create a subdirectory named <code class="filename">crashdumps</code> inside the cluster data directory. The dumps will then be written into this directory with a unique name based on the identifier of the crashing process and the current time of the crash. </p></div></div><div class="sect2" id="INSTALLATION-NOTES-SOLARIS"><div class="titlepage"><div><div><h3 class="title">17.7.4. Solaris <a href="#INSTALLATION-NOTES-SOLARIS" class="id_link">#</a></h3></div></div></div><a id="id-1.6.4.10.7.2" class="indexterm"></a><p> PostgreSQL is well-supported on Solaris. The more up to date your operating system, the fewer issues you will experience. </p><div class="sect3" id="INSTALLATION-NOTES-SOLARIS-REQ-TOOLS"><div class="titlepage"><div><div><h4 class="title">17.7.4.1. Required Tools <a href="#INSTALLATION-NOTES-SOLARIS-REQ-TOOLS" class="id_link">#</a></h4></div></div></div><p> You can build with either GCC or Sun's compiler suite. For better code optimization, Sun's compiler is strongly recommended on the SPARC architecture. If you are using Sun's compiler, be careful not to select <code class="filename">/usr/ucb/cc</code>; use <code class="filename">/opt/SUNWspro/bin/cc</code>. </p><p> You can download Sun Studio from <a class="ulink" href="https://www.oracle.com/technetwork/server-storage/solarisstudio/downloads/" target="_top">https://www.oracle.com/technetwork/server-storage/solarisstudio/downloads/</a>. Many GNU tools are integrated into Solaris 10, or they are present on the Solaris companion CD. If you need packages for older versions of Solaris, you can find these tools at <a class="ulink" href="http://www.sunfreeware.com" target="_top">http://www.sunfreeware.com</a>. If you prefer sources, look at <a class="ulink" href="https://www.gnu.org/prep/ftp" target="_top">https://www.gnu.org/prep/ftp</a>. </p></div><div class="sect3" id="INSTALLATION-NOTES-SOLARIS-CONFIGURE-COMPLAINS"><div class="titlepage"><div><div><h4 class="title">17.7.4.2. configure Complains About a Failed Test Program <a href="#INSTALLATION-NOTES-SOLARIS-CONFIGURE-COMPLAINS" class="id_link">#</a></h4></div></div></div><p> If <code class="command">configure</code> complains about a failed test program, this is probably a case of the run-time linker being unable to find some library, probably libz, libreadline or some other non-standard library such as libssl. To point it to the right location, set the <code class="envar">LDFLAGS</code> environment variable on the <code class="command">configure</code> command line, e.g., </p><pre class="programlisting"> configure ... LDFLAGS="-R /usr/sfw/lib:/opt/sfw/lib:/usr/local/lib" </pre><p> See the <span class="citerefentry"><span class="refentrytitle">ld</span></span> man page for more information. </p></div><div class="sect3" id="INSTALLATION-NOTES-SOLARIS-COMP-OPT-PERF"><div class="titlepage"><div><div><h4 class="title">17.7.4.3. Compiling for Optimal Performance <a href="#INSTALLATION-NOTES-SOLARIS-COMP-OPT-PERF" class="id_link">#</a></h4></div></div></div><p> On the SPARC architecture, Sun Studio is strongly recommended for compilation. Try using the <code class="option">-xO5</code> optimization flag to generate significantly faster binaries. Do not use any flags that modify behavior of floating-point operations and <code class="varname">errno</code> processing (e.g., <code class="option">-fast</code>). </p><p> If you do not have a reason to use 64-bit binaries on SPARC, prefer the 32-bit version. The 64-bit operations are slower and 64-bit binaries are slower than the 32-bit variants. On the other hand, 32-bit code on the AMD64 CPU family is not native, so 32-bit code is significantly slower on that CPU family. </p></div><div class="sect3" id="INSTALLATION-NOTES-SOLARIS-USING-DTRACE"><div class="titlepage"><div><div><h4 class="title">17.7.4.4. Using DTrace for Tracing PostgreSQL <a href="#INSTALLATION-NOTES-SOLARIS-USING-DTRACE" class="id_link">#</a></h4></div></div></div><p> Yes, using DTrace is possible. See <a class="xref" href="dynamic-trace.html" title="27.5. Dynamic Tracing">Section 27.5</a> for further information. </p><p> If you see the linking of the <code class="command">postgres</code> executable abort with an error message like: </p><pre class="screen"> Undefined first referenced symbol in file AbortTransaction utils/probes.o CommitTransaction utils/probes.o ld: fatal: Symbol referencing errors. No output written to postgres collect2: ld returned 1 exit status make: *** [postgres] Error 1 </pre><p> your DTrace installation is too old to handle probes in static functions. You need Solaris 10u4 or newer to use DTrace. </p></div></div><div class="sect2" id="INSTALLATION-NOTES-VISUAL-STUDIO"><div class="titlepage"><div><div><h3 class="title">17.7.5. Visual Studio <a href="#INSTALLATION-NOTES-VISUAL-STUDIO" class="id_link">#</a></h3></div></div></div><a id="id-1.6.4.10.8.2" class="indexterm"></a><p> It is recommended that most users download the binary distribution for Windows, available as a graphical installer package from the <span class="productname">PostgreSQL</span> website at <a class="ulink" href="https://www.postgresql.org/download/" target="_top">https://www.postgresql.org/download/</a>. Building from source is only intended for people developing <span class="productname">PostgreSQL</span> or extensions. </p><p> PostgreSQL for Windows with Visual Studio can be built using Meson, as described in <a class="xref" href="install-meson.html" title="17.4. Building and Installation with Meson">Section 17.4</a>. The native Windows port requires a 32 or 64-bit version of Windows 10 or later. </p><p> Native builds of <span class="application">psql</span> don't support command line editing. The <span class="productname">Cygwin</span> build does support command line editing, so it should be used where psql is needed for interactive use on <span class="productname">Windows</span>. </p><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> 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><div class="sect3" id="WINDOWS-REQUIREMENTS"><div class="titlepage"><div><div><h4 class="title">17.7.5.1. Requirements <a href="#WINDOWS-REQUIREMENTS" class="id_link">#</a></h4></div></div></div><p> The following additional products are required to build <span class="productname">PostgreSQL</span> on Windows. </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="productname">Strawberry Perl</span></span></dt><dd><p> Strawberry 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://strawberryperl.com" target="_top">https://strawberryperl.com</a>. </p></dd><dt><span class="term"><span class="productname">Bison</span> and <span class="productname">Flex</span></span></dt><dd><p> Binaries for <span class="productname">Bison</span> and <span class="productname">Flex</span> can be downloaded from <a class="ulink" href="https://github.com/lexxmark/winflexbison" target="_top">https://github.com/lexxmark/winflexbison</a>. </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. </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="productname">Magicsplat Tcl</span></span></dt><dd><p> Required for building <span class="application">PL/Tcl</span>. Binaries can be downloaded from <a class="ulink" href="https://www.magicsplat.com/tcl-installer/index.html" target="_top">https://www.magicsplat.com/tcl-installer/index.html</a>. </p></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="sect3" id="INSTALL-WINDOWS-FULL-64-BIT"><div class="titlepage"><div><div><h4 class="title">17.7.5.2. Special Considerations for 64-Bit Windows <a href="#INSTALL-WINDOWS-FULL-64-BIT" class="id_link">#</a></h4></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="sect3" id="WINDOWS-CRASH-DUMPS"><div class="titlepage"><div><div><h4 class="title">17.7.5.3. Collecting Crash Dumps <a href="#WINDOWS-CRASH-DUMPS" class="id_link">#</a></h4></div></div></div><p> If PostgreSQL on Windows crashes, it has the ability to generate <span class="productname">minidumps</span> that can be used to track down the cause for the crash, similar to core dumps on Unix. These dumps can be read using the <span class="productname">Windows Debugger Tools</span> or using <span class="productname">Visual Studio</span>. To enable the generation of dumps on Windows, create a subdirectory named <code class="filename">crashdumps</code> inside the cluster data directory. The dumps will then be written into this directory with a unique name based on the identifier of the crashing process and the current time of the crash. </p></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="supported-platforms.html" title="17.6. Supported Platforms">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="installation.html" title="Chapter 17. Installation from Source Code">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="runtime.html" title="Chapter 18. Server Setup and Operation">Next</a></td></tr><tr><td width="40%" align="left" valign="top">17.6. Supported Platforms </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.4 Documentation">Home</a></td><td width="40%" align="right" valign="top"> Chapter 18. Server Setup and Operation</td></tr></table></div></body></html>