Movatterモバイル変換


[0]ホーム

URL:



Facebook
Postgres Pro
Facebook
Downloads
16.7. Platform-specific Notes
Prev UpChapter 16. Installation from Source CodeHome Next

16.7. Platform-specific Notes

This section documents additional platform-specific issues regarding the installation and setup of PostgreSQL. Be sure to read the installation instructions, and in particularSection 16.2 as well. Also, checkChapter 33 regarding the interpretation of regression test results.

Platforms that are not covered here have no known platform-specific installation issues.

16.7.1. AIX

PostgreSQL works on AIX, but getting it installed properly can be challenging. AIX versions from 4.3.3 to 6.1 are considered supported. You can use GCC or the native IBM compilerxlc. In general, using recent versions of AIX and PostgreSQL helps. Check the build farm for up to date information about which versions of AIX are known to work.

The minimum recommended fix levels for supported AIX versions are:

AIX 4.3.3

Maintenance Level 11 + post ML11 bundle

AIX 5.1

Maintenance Level 9 + post ML9 bundle

AIX 5.2

Technology Level 10 Service Pack 3

AIX 5.3

Technology Level 7

AIX 6.1

Base Level

To check your current fix level, useoslevel -r in AIX 4.3.3 to AIX 5.2 ML 7, oroslevel -s in later versions.

Use the followingconfigure flags in addition to your own if you have installed Readline or libz in/usr/local:--with-includes=/usr/local/include --with-libraries=/usr/local/lib.

16.7.1.1. GCC Issues

On AIX 5.3, there have been some problems getting PostgreSQL to compile and run using GCC.

You will want to use a version of GCC subsequent to 3.3.2, particularly if you use a prepackaged version. We had good success with 4.0.1. Problems with earlier versions seem to have more to do with the way IBM packaged GCC than with actual issues with GCC, so that if you compile GCC yourself, you might well have success with an earlier version of GCC.

16.7.1.2. Unix-Domain Sockets Broken

AIX 5.3 has a problem wheresockaddr_storage is not defined to be large enough. In version 5.3, IBM increased the size ofsockaddr_un, the address structure for Unix-domain sockets, but did not correspondingly increase the size ofsockaddr_storage. The result of this is that attempts to use Unix-domain sockets with PostgreSQL lead to libpq overflowing the data structure. TCP/IP connections work OK, but not Unix-domain sockets, which prevents the regression tests from working.

The problem was reported to IBM, and is recorded as bug report PMR29657. If you upgrade to maintenance level 5300-03 or later, that will include this fix. A quick workaround is to alter_SS_MAXSIZE to 1025 in/usr/include/sys/socket.h. In either case, recompile PostgreSQL once you have the corrected header file.

16.7.1.3. Internet Address Issues

PostgreSQL relies on the system'sgetaddrinfo function to parse IP addresses inlisten_addresses,pg_hba.conf, etc. Older versions of AIX have assorted bugs in this function. If you have problems related to these settings, updating to the appropriate AIX fix level shown above should take care of it.

One user reports:

When implementing PostgreSQL version 8.1 on AIX 5.3, we periodically ran into problems where the statistics collector wouldmysteriously not come up successfully. This appears to be the result of unexpected behavior in the IPv6 implementation. It looks like PostgreSQL and IPv6 do not play very well together on AIX 5.3.

Any of the following actionsfix the problem.

  • Delete the IPv6 address for localhost:

    (as root)# ifconfig lo0 inet6 ::1/0 delete

  • Remove IPv6 from net services. The file/etc/netsvc.conf on AIX is roughly equivalent to/etc/nsswitch.conf on Solaris/Linux. The default, on AIX, is thus:

    hosts=local,bind

    Replace this with:

    hosts=local4,bind4

    to deactivate searching for IPv6 addresses.

Warning

This is really a workaround for problems relating to immaturity of IPv6 support, which improved visibly during the course of AIX 5.3 releases. It has worked with AIX version 5.3, but does not represent an elegant solution to the problem. It has been reported that this workaround is not only unnecessary, but causes problems on AIX 6.1, where IPv6 support has become more mature.

16.7.1.4. Memory Management

AIX can be somewhat peculiar with regards to the way it does memory management. You can have a server with many multiples of gigabytes of RAM free, but still get out of memory or address space errors when running applications. One example is loading of extensions failing with unusual errors. For example, running as the owner of the PostgreSQL installation:

=# CREATE EXTENSION plperl;ERROR:  could not load library "/opt/dbs/pgsql/lib/plperl.so": A memory address is not in the address space for the process.

Running as a non-owner in the group possessing the PostgreSQL installation:

=# CREATE EXTENSION plperl;ERROR:  could not load library "/opt/dbs/pgsql/lib/plperl.so": Bad address

Another example is out of memory errors in the PostgreSQL server logs, with every memory allocation near or greater than 256 MB failing.

The overall cause of all these problems is the default bittedness and memory model used by the server process. By default, all binaries built on AIX are 32-bit. This does not depend upon hardware type or kernel in use. These 32-bit processes are limited to 4 GB of memory laid out in 256 MB segments using one of a few models. The default allows for less than 256 MB in the heap as it shares a single segment with the stack.

In the case of theplperl example, above, check your umask and the permissions of the binaries in your PostgreSQL installation. The binaries involved in that example were 32-bit and installed as mode 750 instead of 755. Due to the permissions being set in this fashion, only the owner or a member of the possessing group can load the library. Since it isn't world-readable, the loader places the object into the process' heap instead of the shared library segments where it would otherwise be placed.

Theideal solution for this is to use a 64-bit build of PostgreSQL, but that is not always practical, because systems with 32-bit processors can build, but not run, 64-bit binaries.

If a 32-bit binary is desired, setLDR_CNTRL toMAXDATA=0xn0000000, where 1 <= n <= 8, before starting the PostgreSQL server, and try different values andpostgresql.conf settings to find a configuration that works satisfactorily. This use ofLDR_CNTRL tells AIX that you want the server to haveMAXDATA bytes set aside for the heap, allocated in 256 MB segments. When you find a workable configuration,ldedit can be used to modify the binaries so that they default to using the desired heap size. PostgreSQL can also be rebuilt, passingconfigure LDFLAGS="-Wl,-bmaxdata:0xn0000000" to achieve the same effect.

For a 64-bit build, setOBJECT_MODE to 64 and passCC="gcc -maix64" andLDFLAGS="-Wl,-bbigtoc" toconfigure. (Options forxlc might differ.) If you omit the export ofOBJECT_MODE, your build may fail with linker errors. WhenOBJECT_MODE is set, it tells AIX's build utilities such asar,as, andld what type of objects to default to handling.

By default, overcommit of paging space can happen. While we have not seen this occur, AIX will kill processes when it runs out of memory and the overcommit is accessed. The closest to this that we have seen is fork failing because the system decided that there was not enough memory for another process. Like many other parts of AIX, the paging space allocation method and out-of-memory kill is configurable on a system- or process-wide basis if this becomes a problem.

16.7.2. Cygwin

PostgreSQL can be built using Cygwin, a Linux-like environment for Windows, but that method is inferior to the native Windows build(seeChapter 17) and running a server under Cygwin is no longer recommended.

When building from source, proceed according to the normal installation procedure (i.e.,./configure; make; etc.), noting the following-Cygwin specific differences:

  • Set your path to use the Cygwin bin directory before the Windows utilities. This will help prevent problems with compilation.

  • Theadduser command is not supported; use the appropriate user management application on Windows NT, 2000, or XP. Otherwise, skip this step.

  • Thesu command is not supported; use ssh to simulate su on Windows NT, 2000, or XP. Otherwise, skip this step.

  • OpenSSL is not supported.

  • Startcygserver for shared memory support. To do this, enter the command/usr/sbin/cygserver &. This program needs to be running anytime you start the PostgreSQL server or initialize a database cluster (initdb). The defaultcygserver configuration may need to be changed (e.g., increaseSEMMNS) to prevent PostgreSQL from failing due to a lack of system resources.

  • Building might fail on some systems where a locale other than C is in use. To fix this, set the locale to C by doingexport LANG=C.utf8 before building, and then setting it back to the previous setting, after you have installed PostgreSQL.

  • The parallel regression tests (make check) can generate spurious regression test failures due to overflowing thelisten() backlog queue which causes connection refused errors or hangs. You can limit the number of connections using the make variableMAX_CONNECTIONS thus:

    make MAX_CONNECTIONS=5 check

    (On some systems you can have up to about 10 simultaneous connections).

It is possible to installcygserver and the PostgreSQL server as Windows NT services. For information on how to do this, please refer to theREADME document included with the PostgreSQL binary package on Cygwin. It is installed in the directory/usr/share/doc/Cygwin.

16.7.3. HP-UX

PostgreSQL 7.3+ should work on Series 700/800 PA-RISC machines running HP-UX 10.X or 11.X, given appropriate system patch levels and build tools. At least one developer routinely tests on HP-UX 10.20, and we have reports of successful installations on HP-UX 11.00 and 11.11.

Aside from the PostgreSQL source distribution, you will need GNU make (HP's make will not do), and either GCC or HP's full ANSI C compiler. If you intend to build from Git sources rather than a distribution tarball, you will also need Flex (GNU lex) and Bison (GNU yacc). We also recommend making sure you are fairly up-to-date on HP patches. At a minimum, if you are building 64 bit binaries on HP-UX 11.11 you may need PHSS_30966 (11.11) or a successor patch otherwiseinitdb may hang:


PHSS_30966  s700_800 ld(1) and linker tools cumulative patch

On general principles you should be current on libc and ld/dld patches, as well as compiler patches if you are using HP's C compiler. See HP's support sites such asftp://us-ffs.external.hp.com/ for free copies of their latest patches.

If you are building on a PA-RISC 2.0 machine and want to have 64-bit binaries using GCC, you must use a GCC 64-bit version.

If you are building on a PA-RISC 2.0 machine and want the compiled binaries to run on PA-RISC 1.1 machines you will need to specify+DAportable inCFLAGS.

If you are building on a HP-UX Itanium machine, you will need the latest HP ANSI C compiler with its dependent patch or successor patches:


PHSS_30848  s700_800 HP C Compiler (A.05.57)
PHSS_30849  s700_800 u2comp/be/plugin library Patch

If you have both HP's C compiler and GCC's, then you might want to explicitly select the compiler to use when you runconfigure:

./configure CC=cc

for HP's C compiler, or

./configure CC=gcc

for GCC. If you omit this setting, then configure will pickgcc if it has a choice.

The default install target location is/usr/local/pgsql, which you might want to change to something under/opt. If so, use the--prefix switch toconfigure.

In the regression tests, there might be some low-order-digit differences in the geometry tests, which vary depending on which compiler and math library versions you use. Any other error is cause for suspicion.

16.7.4. macOS

To buildPostgreSQL from source onmacOS, you will need to install Apple's command line developer tools, which can be done by issuing

xcode-select --install

(note that this will pop up a GUI dialog window for confirmation). You may or may not wish to also install Xcode.

On recentmacOS releases, it's necessary to embed thesysroot path in the include switches used to find some system header files. This results in the outputs of theconfigure script varying depending on which SDK version was used duringconfigure. 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, setPG_SYSROOT, for example

make PG_SYSROOT=/desired/path all

To find out the appropriate path on your machine, run

xcrun --show-sdk-path

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.

You can also select a non-default sysroot path when configuring, by specifyingPG_SYSROOT toconfigure:

./configure ... PG_SYSROOT=/desired/path

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.

To suppress the-isysroot options altogether, use

./configure ... PG_SYSROOT=none

(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.

macOS'sSystem Integrity Protection (SIP) feature breaksmake check, because it prevents passing the needed setting ofDYLD_LIBRARY_PATH down to the executables being tested. You can work around that by doingmake install beforemake check. Most Postgres developers just turn off SIP, though.

16.7.5. MinGW/Native Windows

PostgreSQL for Windows can be built using MinGW, a Unix-like build environment for Microsoft operating systems, or using Microsoft'sVisual C++ compiler suite. The MinGW build variant uses the normal build system described in this chapter; the Visual C++ build works completely differently and is described inChapter 17. It is a fully native build and uses no additional software like MinGW. A ready-made installer is available on the main PostgreSQL web site.

The native Windows port requires a 32 or 64-bit version of Windows 2000 or later. Earlier operating systems do not have sufficient infrastructure (but Cygwin may be used on those). MinGW, the Unix-like build tools, and MSYS, a collection of Unix tools required to run shell scripts likeconfigure, can be downloaded fromhttp://www.mingw.org/. Neither is required to run the resulting binaries; they are needed only for creating the binaries.

To build 64 bit binaries using MinGW, install the 64 bit tool set fromhttps://mingw-w64.org/, put its bin directory in thePATH, and runconfigure with the--host=x86_64-w64-mingw32 option.

After you have everything installed, it is suggested that you runpsql underCMD.EXE, as the MSYS console has buffering issues.

16.7.5.1. Collecting Crash Dumps on Windows

If PostgreSQL on Windows crashes, it has the ability to generateminidumps that can be used to track down the cause for the crash, similar to core dumps on Unix. These dumps can be read using theWindows Debugger Tools or usingVisual Studio. To enable the generation of dumps on Windows, create a subdirectory namedcrashdumps 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.

16.7.6. Solaris

PostgreSQL is well-supported on Solaris. The more up to date your operating system, the fewer issues you will experience; details below.

16.7.6.1. Required Tools

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. We have heard reports of problems when using GCC 2.95.1; GCC 2.95.3 or later is recommended. If you are using Sun's compiler, be careful not to select/usr/ucb/cc; use/opt/SUNWspro/bin/cc.

You can download Sun Studio fromhttps://www.oracle.com/technetwork/server-storage/solarisstudio/downloads/. Many of GNU tools are integrated into Solaris 10, or they are present on the Solaris companion CD. If you like packages for older version of Solaris, you can find these tools athttp://www.sunfreeware.com. If you prefer sources, look athttps://www.gnu.org/prep/ftp.

16.7.6.2. configure Complains About a Failed Test Program

Ifconfigure 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 theLDFLAGS environment variable on theconfigure command line, e.g.,

configure ... LDFLAGS="-R /usr/sfw/lib:/opt/sfw/lib:/usr/local/lib"

See theld man page for more information.

16.7.6.3. 64-bit Build Sometimes Crashes

On Solaris 7 and older, the 64-bit version of libc has a buggyvsnprintf routine, which leads to erratic core dumps in PostgreSQL. The simplest known workaround is to force PostgreSQL to use its own version ofvsnprintf rather than the library copy. To do this, after you runconfigure edit a file produced byconfigure: Insrc/Makefile.global, change the line

LIBOBJS =

to read

LIBOBJS = snprintf.o

(There might be other files already listed in this variable. Order does not matter.) Then build as usual.

16.7.6.4. Compiling for Optimal Performance

On the SPARC architecture, Sun Studio is strongly recommended for compilation. Try using the-xO5 optimization flag to generate significantly faster binaries. Do not use any flags that modify behavior of floating-point operations anderrno processing (e.g.,-fast). These flags could raise some nonstandard PostgreSQL behavior for example in the date/time computing.

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. And on other hand, 32-bit code on the AMD64 CPU family is not native, and that is why 32-bit code is significant slower on this CPU family.

16.7.6.5. Using DTrace for Tracing PostgreSQL

Yes, using DTrace is possible. SeeSection 28.5 for further information.

If you see the linking of thepostgres executable abort with an error message like:

Undefined                       first referenced symbol                             in fileAbortTransaction                    utils/probes.oCommitTransaction                   utils/probes.old: fatal: Symbol referencing errors. No output written to postgrescollect2: ld returned 1 exit statusmake: *** [postgres] Error 1

your DTrace installation is too old to handle probes in static functions. You need Solaris 10u4 or newer.


Prev Up Next
16.6. Supported Platforms Home Chapter 17. Installation from Source Code onWindows
epubpdf
Go to PostgreSQL 11
By continuing to browse this website, you agree to the use of cookies. Go toPrivacy Policy.

[8]ページ先頭

©2009-2025 Movatter.jp