codekingpro/portable-devtools
115k
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>2<!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="install-windows.html" title="Chapter 18. Installation from Source Code on Windows" /></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 16.3 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="install-windows.html" title="Chapter 18. Installation from Source Code on Windows">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-AIX">17.7.1. AIX</a></span></dt><dt><span class="sect2"><a href="installation-platform-notes.html#INSTALLATION-NOTES-CYGWIN">17.7.2. Cygwin</a></span></dt><dt><span class="sect2"><a href="installation-platform-notes.html#INSTALLATION-NOTES-MACOS">17.7.3. macOS</a></span></dt><dt><span class="sect2"><a href="installation-platform-notes.html#INSTALLATION-NOTES-MINGW">17.7.4. MinGW/Native Windows</a></span></dt><dt><span class="sect2"><a href="installation-platform-notes.html#INSTALLATION-NOTES-SOLARIS">17.7.5. Solaris</a></span></dt></dl></div><p>3 This section documents additional platform-specific issues4 regarding the installation and setup of PostgreSQL. Be sure to5 read the installation instructions, and in6 particular <a class="xref" href="install-requirements.html" title="17.1. Requirements">Section 17.1</a> as well. Also,7 check <a class="xref" href="regress.html" title="Chapter 33. Regression Tests">Chapter 33</a> regarding the8 interpretation of regression test results.9 </p><p>10 Platforms that are not covered here have no known platform-specific11 installation issues.12 </p><div class="sect2" id="INSTALLATION-NOTES-AIX"><div class="titlepage"><div><div><h3 class="title">17.7.1. AIX <a href="#INSTALLATION-NOTES-AIX" class="id_link">#</a></h3></div></div></div><a id="id-1.6.4.11.4.2" class="indexterm"></a><p>13 You can use GCC or the native IBM compiler <code class="command">xlc</code>14 to build <span class="productname">PostgreSQL</span>15 on <span class="productname">AIX</span>.16 </p><p>17 <span class="productname">AIX</span> versions before 7.1 are no longer18 tested nor supported by the <span class="productname">PostgreSQL</span>19 community.20 </p><div class="sect3" id="INSTALLATION-NOTES-AIX-MEM-MANAGEMENT"><div class="titlepage"><div><div><h4 class="title">17.7.1.1. Memory Management <a href="#INSTALLATION-NOTES-AIX-MEM-MANAGEMENT" class="id_link">#</a></h4></div></div></div><p>21 AIX can be somewhat peculiar with regards to the way it does22 memory management. You can have a server with many multiples of23 gigabytes of RAM free, but still get out of memory or address24 space errors when running applications. One example25 is loading of extensions failing with unusual errors.26 For example, running as the owner of the PostgreSQL installation:27</p><pre class="screen">28=# CREATE EXTENSION plperl;29ERROR: could not load library "/opt/dbs/pgsql/lib/plperl.so": A memory address is not in the address space for the process.30</pre><p>31 Running as a non-owner in the group possessing the PostgreSQL32 installation:33</p><pre class="screen">34=# CREATE EXTENSION plperl;35ERROR: could not load library "/opt/dbs/pgsql/lib/plperl.so": Bad address36</pre><p>37 Another example is out of memory errors in the PostgreSQL server38 logs, with every memory allocation near or greater than 256 MB39 failing.40 </p><p>41 The overall cause of all these problems is the default bittedness42 and memory model used by the server process. By default, all43 binaries built on AIX are 32-bit. This does not depend upon44 hardware type or kernel in use. These 32-bit processes are45 limited to 4 GB of memory laid out in 256 MB segments using one46 of a few models. The default allows for less than 256 MB in the47 heap as it shares a single segment with the stack.48 </p><p>49 In the case of the <code class="literal">plperl</code> example, above,50 check your umask and the permissions of the binaries in your51 PostgreSQL installation. The binaries involved in that example52 were 32-bit and installed as mode 750 instead of 755. Due to the53 permissions being set in this fashion, only the owner or a member54 of the possessing group can load the library. Since it isn't55 world-readable, the loader places the object into the process'56 heap instead of the shared library segments where it would57 otherwise be placed.58 </p><p>59 The <span class="quote">“<span class="quote">ideal</span>”</span> solution for this is to use a 64-bit60 build of PostgreSQL, but that is not always practical, because61 systems with 32-bit processors can build, but not run, 64-bit62 binaries.63 </p><p>64 If a 32-bit binary is desired, set <code class="symbol">LDR_CNTRL</code> to65 <code class="literal">MAXDATA=0x<em class="replaceable"><code>n</code></em>0000000</code>,66 where 1 <= n <= 8, before starting the PostgreSQL server,67 and try different values and <code class="filename">postgresql.conf</code>68 settings to find a configuration that works satisfactorily. This69 use of <code class="symbol">LDR_CNTRL</code> tells AIX that you want the70 server to have <code class="symbol">MAXDATA</code> bytes set aside for the71 heap, allocated in 256 MB segments. When you find a workable72 configuration,73 <code class="command">ldedit</code> can be used to modify the binaries so74 that they default to using the desired heap size. PostgreSQL can75 also be rebuilt, passing <code class="literal">configure76 LDFLAGS="-Wl,-bmaxdata:0x<em class="replaceable"><code>n</code></em>0000000"</code>77 to achieve the same effect.78 </p><p>79 For a 64-bit build, set <code class="envar">OBJECT_MODE</code> to 64 and80 pass <code class="literal">CC="gcc -maix64"</code>81 and <code class="literal">LDFLAGS="-Wl,-bbigtoc"</code>82 to <code class="command">configure</code>. (Options for83 <code class="command">xlc</code> might differ.) If you omit the export of84 <code class="envar">OBJECT_MODE</code>, your build may fail with linker errors. When85 <code class="envar">OBJECT_MODE</code> is set, it tells AIX's build utilities86 such as <code class="command">ar</code>, <code class="command">as</code>, and <code class="command">ld</code> what87 type of objects to default to handling.88 </p><p>89 By default, overcommit of paging space can happen. While we have90 not seen this occur, AIX will kill processes when it runs out of91 memory and the overcommit is accessed. The closest to this that92 we have seen is fork failing because the system decided that93 there was not enough memory for another process. Like many other94 parts of AIX, the paging space allocation method and95 out-of-memory kill is configurable on a system- or process-wide96 basis if this becomes a problem.97 </p></div></div><div class="sect2" id="INSTALLATION-NOTES-CYGWIN"><div class="titlepage"><div><div><h3 class="title">17.7.2. Cygwin <a href="#INSTALLATION-NOTES-CYGWIN" class="id_link">#</a></h3></div></div></div><a id="id-1.6.4.11.5.2" class="indexterm"></a><p>98 PostgreSQL can be built using Cygwin, a Linux-like environment for99 Windows, but that method is inferior to the native Windows build100 <span class="phrase">(see <a class="xref" href="install-windows.html" title="Chapter 18. Installation from Source Code on Windows">Chapter 18</a>)</span> and101 running a server under Cygwin is no longer recommended.102 </p><p>103 When building from source, proceed according to the Unix-style104 installation procedure (i.e., <code class="literal">./configure;105 make</code>; etc.), noting the following Cygwin-specific106 differences:107 108 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>109 Set your path to use the Cygwin bin directory before the110 Windows utilities. This will help prevent problems with111 compilation.112 </p></li><li class="listitem"><p>113 The <code class="command">adduser</code> command is not supported; use114 the appropriate user management application on Windows.115 Otherwise, skip this step.116 </p></li><li class="listitem"><p>117 The <code class="command">su</code> command is not supported; use ssh to118 simulate su on Windows. Otherwise, skip this step.119 </p></li><li class="listitem"><p>120 <span class="productname">OpenSSL</span> is not supported.121 </p></li><li class="listitem"><p>122 Start <code class="command">cygserver</code> for shared memory support.123 To do this, enter the command <code class="literal">/usr/sbin/cygserver124 &</code>. This program needs to be running anytime you125 start the PostgreSQL server or initialize a database cluster126 (<code class="command">initdb</code>). The127 default <code class="command">cygserver</code> configuration may need to128 be changed (e.g., increase <code class="symbol">SEMMNS</code>) to prevent129 PostgreSQL from failing due to a lack of system resources.130 </p></li><li class="listitem"><p>131 Building might fail on some systems where a locale other than132 C is in use. To fix this, set the locale to C by doing133 <code class="command">export LANG=C.utf8</code> before building, and then134 setting it back to the previous setting after you have installed135 PostgreSQL.136 </p></li><li class="listitem"><p>137 The parallel regression tests (<code class="literal">make check</code>)138 can generate spurious regression test failures due to139 overflowing the <code class="function">listen()</code> backlog queue140 which causes connection refused errors or hangs. You can limit141 the number of connections using the make142 variable <code class="varname">MAX_CONNECTIONS</code> thus:143</p><pre class="programlisting">144make MAX_CONNECTIONS=5 check145</pre><p>146 (On some systems you can have up to about 10 simultaneous147 connections.)148 </p></li></ul></div><p>149 </p><p>150 It is possible to install <code class="command">cygserver</code> and the151 PostgreSQL server as Windows NT services. For information on how152 to do this, please refer to the <code class="filename">README</code>153 document included with the PostgreSQL binary package on Cygwin.154 It is installed in the155 directory <code class="filename">/usr/share/doc/Cygwin</code>.156 </p></div><div class="sect2" id="INSTALLATION-NOTES-MACOS"><div class="titlepage"><div><div><h3 class="title">17.7.3. macOS <a href="#INSTALLATION-NOTES-MACOS" class="id_link">#</a></h3></div></div></div><a id="id-1.6.4.11.6.2" class="indexterm"></a><p>157 To build <span class="productname">PostgreSQL</span> from source158 on <span class="productname">macOS</span>, you will need to install Apple's159 command line developer tools, which can be done by issuing160</p><pre class="programlisting">161xcode-select --install162</pre><p>163 (note that this will pop up a GUI dialog window for confirmation).164 You may or may not wish to also install Xcode.165 </p><p>166 On recent <span class="productname">macOS</span> releases, it's necessary to167 embed the <span class="quote">“<span class="quote">sysroot</span>”</span> path in the include switches used to168 find some system header files. This results in the outputs of169 the <span class="application">configure</span> script varying depending on170 which SDK version was used during <span class="application">configure</span>.171 That shouldn't pose any problem in simple scenarios, but if you are172 trying to do something like building an extension on a different machine173 than the server code was built on, you may need to force use of a174 different sysroot path. To do that, set <code class="varname">PG_SYSROOT</code>,175 for example176</p><pre class="programlisting">177make PG_SYSROOT=<em class="replaceable"><code>/desired/path</code></em> all178</pre><p>179 To find out the appropriate path on your machine, run180</p><pre class="programlisting">181xcrun --show-sdk-path182</pre><p>183 Note that building an extension using a different sysroot version than184 was used to build the core server is not really recommended; in the185 worst case it could result in hard-to-debug ABI inconsistencies.186 </p><p>187 You can also select a non-default sysroot path when configuring, by188 specifying <code class="varname">PG_SYSROOT</code>189 to <span class="application">configure</span>:190</p><pre class="programlisting">191./configure ... PG_SYSROOT=<em class="replaceable"><code>/desired/path</code></em>192</pre><p>193 This would primarily be useful to cross-compile for some other194 macOS version. There is no guarantee that the resulting executables195 will run on the current host.196 </p><p>197 To suppress the <code class="option">-isysroot</code> options altogether, use198</p><pre class="programlisting">199./configure ... PG_SYSROOT=none200</pre><p>201 (any nonexistent pathname will work). This might be useful if you wish202 to build with a non-Apple compiler, but beware that that case is not203 tested or supported by the PostgreSQL developers.204 </p><p>205 <span class="productname">macOS</span>'s <span class="quote">“<span class="quote">System Integrity206 Protection</span>”</span> (SIP) feature breaks <code class="literal">make check</code>,207 because it prevents passing the needed setting208 of <code class="literal">DYLD_LIBRARY_PATH</code> down to the executables being209 tested. You can work around that by doing <code class="literal">make210 install</code> before <code class="literal">make check</code>.211 Most PostgreSQL developers just turn off SIP, though.212 </p></div><div class="sect2" id="INSTALLATION-NOTES-MINGW"><div class="titlepage"><div><div><h3 class="title">17.7.4. MinGW/Native Windows <a href="#INSTALLATION-NOTES-MINGW" class="id_link">#</a></h3></div></div></div><a id="id-1.6.4.11.7.2" class="indexterm"></a><p>213 PostgreSQL for Windows can be built using MinGW, a Unix-like build214 environment for Microsoft operating systems, or using215 Microsoft's <span class="productname">Visual C++</span> compiler suite.216 The MinGW build procedure uses the normal build system described in217 this chapter; the Visual C++ build works completely differently218 and is described in <a class="xref" href="install-windows.html" title="Chapter 18. Installation from Source Code on Windows">Chapter 18</a>.219 </p><p>220 The native Windows port requires a 32 or 64-bit version of Windows221 2000 or later. Earlier operating systems do222 not have sufficient infrastructure (but Cygwin may be used on223 those). MinGW, the Unix-like build tools, and MSYS, a collection224 of Unix tools required to run shell scripts225 like <code class="command">configure</code>, can be downloaded226 from <a class="ulink" href="http://www.mingw.org/" target="_top">http://www.mingw.org/</a>. Neither is227 required to run the resulting binaries; they are needed only for228 creating the binaries.229 </p><p>230 To build 64 bit binaries using MinGW, install the 64 bit tool set231 from <a class="ulink" href="https://mingw-w64.org/" target="_top">https://mingw-w64.org/</a>, put its bin232 directory in the <code class="envar">PATH</code>, and run233 <code class="command">configure</code> with the234 <code class="command">--host=x86_64-w64-mingw32</code> option.235 </p><p>236 After you have everything installed, it is suggested that you237 run <span class="application">psql</span>238 under <code class="command">CMD.EXE</code>, as the MSYS console has239 buffering issues.240 </p><div class="sect3" id="WINDOWS-CRASH-DUMPS"><div class="titlepage"><div><div><h4 class="title">17.7.4.1. Collecting Crash Dumps on Windows <a href="#WINDOWS-CRASH-DUMPS" class="id_link">#</a></h4></div></div></div><p>241 If PostgreSQL on Windows crashes, it has the ability to generate242 <span class="productname">minidumps</span> that can be used to track down the cause243 for the crash, similar to core dumps on Unix. These dumps can be244 read using the <span class="productname">Windows Debugger Tools</span> or using245 <span class="productname">Visual Studio</span>. To enable the generation of dumps246 on Windows, create a subdirectory named <code class="filename">crashdumps</code>247 inside the cluster data directory. The dumps will then be written248 into this directory with a unique name based on the identifier of249 the crashing process and the current time of the crash.250 </p></div></div><div class="sect2" id="INSTALLATION-NOTES-SOLARIS"><div class="titlepage"><div><div><h3 class="title">17.7.5. Solaris <a href="#INSTALLATION-NOTES-SOLARIS" class="id_link">#</a></h3></div></div></div><a id="id-1.6.4.11.8.2" class="indexterm"></a><p>251 PostgreSQL is well-supported on Solaris. The more up to date your252 operating system, the fewer issues you will experience.253 </p><div class="sect3" id="INSTALLATION-NOTES-SOLARIS-REQ-TOOLS"><div class="titlepage"><div><div><h4 class="title">17.7.5.1. Required Tools <a href="#INSTALLATION-NOTES-SOLARIS-REQ-TOOLS" class="id_link">#</a></h4></div></div></div><p>254 You can build with either GCC or Sun's compiler suite. For255 better code optimization, Sun's compiler is strongly recommended256 on the SPARC architecture. If257 you are using Sun's compiler, be careful not to select258 <code class="filename">/usr/ucb/cc</code>;259 use <code class="filename">/opt/SUNWspro/bin/cc</code>.260 </p><p>261 You can download Sun Studio262 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>.263 Many GNU tools are integrated into Solaris 10, or they are264 present on the Solaris companion CD. If you need packages for265 older versions of Solaris, you can find these tools266 at <a class="ulink" href="http://www.sunfreeware.com" target="_top">http://www.sunfreeware.com</a>.267 If you prefer268 sources, look269 at <a class="ulink" href="https://www.gnu.org/prep/ftp" target="_top">https://www.gnu.org/prep/ftp</a>.270 </p></div><div class="sect3" id="INSTALLATION-NOTES-SOLARIS-CONFIGURE-COMPLAINS"><div class="titlepage"><div><div><h4 class="title">17.7.5.2. configure Complains About a Failed Test Program <a href="#INSTALLATION-NOTES-SOLARIS-CONFIGURE-COMPLAINS" class="id_link">#</a></h4></div></div></div><p>271 If <code class="command">configure</code> complains about a failed test272 program, this is probably a case of the run-time linker being273 unable to find some library, probably libz, libreadline or some274 other non-standard library such as libssl. To point it to the275 right location, set the <code class="envar">LDFLAGS</code> environment276 variable on the <code class="command">configure</code> command line, e.g.,277</p><pre class="programlisting">278configure ... LDFLAGS="-R /usr/sfw/lib:/opt/sfw/lib:/usr/local/lib"279</pre><p>280 See281 the <span class="citerefentry"><span class="refentrytitle">ld</span></span>282 man page for more information.283 </p></div><div class="sect3" id="INSTALLATION-NOTES-SOLARIS-COMP-OPT-PERF"><div class="titlepage"><div><div><h4 class="title">17.7.5.3. Compiling for Optimal Performance <a href="#INSTALLATION-NOTES-SOLARIS-COMP-OPT-PERF" class="id_link">#</a></h4></div></div></div><p>284 On the SPARC architecture, Sun Studio is strongly recommended for285 compilation. Try using the <code class="option">-xO5</code> optimization286 flag to generate significantly faster binaries. Do not use any287 flags that modify behavior of floating-point operations288 and <code class="varname">errno</code> processing (e.g.,289 <code class="option">-fast</code>).290 </p><p>291 If you do not have a reason to use 64-bit binaries on SPARC,292 prefer the 32-bit version. The 64-bit operations are slower and293 64-bit binaries are slower than the 32-bit variants. On the294 other hand, 32-bit code on the AMD64 CPU family is not native,295 so 32-bit code is significantly slower on that CPU family.296 </p></div><div class="sect3" id="INSTALLATION-NOTES-SOLARIS-USING-DTRACE"><div class="titlepage"><div><div><h4 class="title">17.7.5.4. Using DTrace for Tracing PostgreSQL <a href="#INSTALLATION-NOTES-SOLARIS-USING-DTRACE" class="id_link">#</a></h4></div></div></div><p>297 Yes, using DTrace is possible. See <a class="xref" href="dynamic-trace.html" title="28.5. Dynamic Tracing">Section 28.5</a> for298 further information.299 </p><p>300 If you see the linking of the <code class="command">postgres</code> executable abort with an301 error message like:302</p><pre class="screen">303Undefined first referenced304 symbol in file305AbortTransaction utils/probes.o306CommitTransaction utils/probes.o307ld: fatal: Symbol referencing errors. No output written to postgres308collect2: ld returned 1 exit status309make: *** [postgres] Error 1310</pre><p>311 your DTrace installation is too old to handle probes in static312 functions. You need Solaris 10u4 or newer to use DTrace.313 </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="install-windows.html" title="Chapter 18. Installation from Source Code on Windows">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 16.3 Documentation">Home</a></td><td width="40%" align="right" valign="top"> Chapter 18. Installation from Source Code on <span class="productname">Windows</span></td></tr></table></div></body></html>