Building 7.1.3 on Solaris 2.6

From: Dave Krieger <dkrieger(at)imnetworks(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Building 7.1.3 on Solaris 2.6
Date: 2003-05-20 21:05:07
Message-ID: 5.2.1.1.0.20030520122447.09de6ec8@mail2.imnetworks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Short version of query: Can anybody provide me with the steps necessary to get PostgreSQL 7.1.3 to build on Solaris 2.6? I'm thinking of something along the lines of "Compiling PostgreSQL 7.3.2 on Solaris 8" (at http://techdocs.postgresql.org/v2/Guides/Installation%20Guides/Compiling%20PostgreSQL%207.3.2%20on%20Solaris%208/document_view), retrofitted to 7.1.3 and 2.6. I'm not asking for something as detailed as that; just the Solaris voodoo, like setting environment variables properly, that isn't covered in the Postgres INSTALL docs. I've encountered a number of headaches along the way (see long version below) and still haven't succeeded in getting a build that will function.

Long version:

(Why 7.1.3 and not the latest version? This is the version we're running on our Linux-based servers, and it's known to be compatible with the latest version of our own server code. We'd like to standardize the version of PostgreSQL we're running across all of our servers for a number of reasons, not least of which is so we can update the older Solaris servers to also be running the latest version of our own code, and un-fork our code base.)

In preparation for the upgrade, I've updated or installed gcc, gmake, glib, readline, binutils, bzip2, and a number of other dependencies, to the latest versions. I built them from source, because I found references online saying that the sunfreeware.com binaries were not that reliable.

The first hurdle to be overcome was a bug in 7.1.3's 'configure'. The 'config.h' it generated contained an unterminated string for PG_VERSION_STR, causing 'make' to fail horribly (see http://archives.postgresql.org/pgsql-ports/2003-04/msg00015.php for probable reason); but more importantly, 'configure' was failing to find libraries in standard places. Passing lists of directories in the '--with-includes' and '--with-libraries' command-line options to 'configure' didn't seem to help; manually editing 'config.h' to close the unterminated string and override for the header files that 'configure' didn't find, enabled 'make' to go to completion, but the resulting build wouldn't pass its regression tests. However, editing 'configure' to set PG_VERSION_STR to a fixed value rather than one determined programmatically, enabled it to find all of the libraries correctly and build to completion. That build couldn't pass its regression tests because it was looking for its binaries in their intended final install location (/usr/local/pgsql713) instead of the temp location in the source hierarchy (.../postgresql-7.1.3/src/test/regress/tmp_check/install/usr/local/pgsql713). Adding a symlink enabled this version to pass its regression tests.

After installing, however, this build was unable to create a database because the binaries were looking for their required libraries in the wrong places. '/usr/local/pgsql713/bin/initdb -D /usr/local/pgsql713/data' results in:
--------------------------------
ld.so.1: /usr/local/pgsql713/bin/pg_encoding: fatal: relocation error: file /usr/local/pgsql713/bin/pg_encoding: symbol pg_char_to_encoding: referenced symbol not found
initdb: pg_encoding failed

Perhaps you did not configure PostgreSQL for multibyte support or
the program was not successfully installed.
---------------------------------
'ldd -r /usr/local/pgsql713/bin/pg_encoding' produces this output:
---------------------------------
libpq.so.2 => /usr/local/pgsql/lib/libpq.so.2
libresolv.so.2 => /usr/lib/libresolv.so.2
libnsl.so.1 => /usr/lib/libnsl.so.1
libsocket.so.1 => /usr/lib/libsocket.so.1
libdl.so.1 => /usr/lib/libdl.so.1
libm.so.1 => /usr/lib/libm.so.1
libreadline.so.4 => /usr/local/lib/libreadline.so.4
libc.so.1 => /usr/lib/libc.so.1
libmp.so.2 => /usr/lib/libmp.so.2
libgcc_s.so.1 => /usr/local/lib/libgcc_s.so.1
/usr/platform/SUNW,UltraAX-MP/lib/libc_psr.so.1
symbol not found: pg_char_to_encoding (/usr/local/pgsql713/bin/pg_encoding)
symbol not found: pg_encoding_to_char (/usr/local/pgsql713/bin/pg_encoding)
---------------------------------
which, to my untrained eye, looks like, despite all my singing and dancing, the binaries are still lookin' for love in all the wrong places. (/usr/local/pgsql is the location of the existing PG 7.0.1 installation from which we're upgrading.) The error doesn't appear to be affected by the values of PGSQL, PGLIB, etc., at runtime.

If anyone a bit more Solaris-savvy has some light to shed on the problem, I'd be grateful. My current thinking is that the problem is with the compile-time values of environment variables such as LD_RUN_PATH and LD_LIBRARY_PATH, but I lack deep understanding of all their ins and outs.

A bit more information that might be useful: The version of PostgreSQL from which we're upgrading these servers is 7.0.1; it's located in /usr/local/pgsql/, so 7.1.3 is being built and tested with '--prefix=/usr/local/pgsql713'

The arguments to 'configure' I'm using are:
./configure --with-includes=/usr/include:/usr/local/include:\
/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/3.2.3/include:\
/usr/platform/sun4u/include:/usr/platform/sun4c/include:\
/usr/platform/sun4d/include:/usr/platform/sun4m/include:/usr/dt/share/include \
--with-libs=/usr/lib:/usr/local/lib:/usr/ccs/lib:/usr/platform/sun4u/lib:\
/usr/share/lib:/usr/opt/SUNWmd/lib:/usr/local/sparc-sun-solaris2.6/lib \
--enable-locale --enable-multibyte=UNICODE --with-perl --enable-odbc \
--prefix=/usr/local/pgsql713

Values of relevant environment variables:
LD_RUN_PATH=:/usr/local/lib:/usr/etc/lib:/usr/proc/lib:/usr/etc/security/lib:/usr/lib:/usr/local/pgsql/lib:/usr/local/pgsql/include/lib:/usr/local/ssl/lib
INCLUDE=:/usr/include:/usr/local/include:/usr/local/lib/glib/include:/usr/include/sys
LD_LIBRARY_PATH=:/usr/local/lib:/usr/etc/lib:/usr/proc/lib:/usr/etc/security/lib:/usr/lib:/usr/local/pgsql/lib:/usr/local/pgsql/include/lib:/usr/local/ssl/lib:/usr/local/pgsql/lib
MACHTYPE=sparc-sun-solaris2.6
POSTGRES_LIB=/usr/local/pgsql/lib
PGSQL=/usr/local/pgsql
PGLIB=/usr/local/pgsql/lib
OSTYPE=solaris2.6
PGDATA=/usr/local/pgsql/data
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/bin:/opt/FSFgzip/bin:/opt/LYNX271/bin:/usr/openwin/bin:/usr/ccs/bin:/usr/opt/SUNWmd/bin:/usr/opt/SUNWmd/sbin:/usr/local/sbin:/usr/ucb:/usr/local/pgsql/bin

Thanks to anyone who wants to help...

Dave Krieger
iM Networks, Inc.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dean Gibson (DB Administrator) 2003-05-20 21:11:03 Re: Subqueries and the optimizer
Previous Message Network Administrator 2003-05-20 21:04:11 Re: - what protocol for an Internet postgres