Re: initdb has trouble finding the right ascii_and_mic.so - Mailing list pgsql-general

From Maciej (Matchek) Blizinski
Subject Re: initdb has trouble finding the right ascii_and_mic.so
Date
Msg-id ce97543b1001100918v31c9c0a0ic88267a15257d4dd@mail.gmail.com
Whole thread Raw
In response to Re: initdb has trouble finding the right ascii_and_mic.so  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Sun, Jan 10, 2010 at 4:05 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> "Maciej (Matchek) Blizinski" <blizinski@google.com> writes:
>> There are 2 sets of libraries installed.
>> /opt/csw/lib/postgresql/8.4/lib contains 32-bit libraries.
>> /opt/csw/lib/postgresql/8.4/lib/64 contains the 64-bit set.
>
> You can't just make up some random layout for the libraries.

The layout is not exactly random.  On Solaris:

maciej@netra ~ $ ls -ld /usr/lib/32
lrwxrwxrwx   1 root     root           1 Feb 14  2009 /usr/lib/32 -> .
maciej@netra ~ $ ls -ld /usr/lib/64
lrwxrwxrwx   1 root     root           7 Feb 14  2009 /usr/lib/64 -> sparcv9

And, by analogy:

maciej@netra ~ $ ls -ld /opt/csw/lib/32
lrwxrwxrwx   1 root     root           1 Sep 25 08:48 /opt/csw/lib/32 -> .
maciej@netra ~ $ ls -ld /opt/csw/lib/64
lrwxrwxrwx   1 root     root           7 Sep 25 08:48 /opt/csw/lib/64 -> sparcv9

The whole operating system is laid out this way.  The issue of finding
the right set of libraries is solved in the following way:

maciej@netra ~ $ /usr/ccs/bin/dump -Lv /opt/csw/bin/sparcv8/gpg |
gegrep 'R(UN|)PATH'
[13]    RUNPATH
/opt/csw/lib/$ISALIST:/opt/csw/lib:/opt/csw/lib:/opt/csw/lib
[14]    RPATH
/opt/csw/lib/$ISALIST:/opt/csw/lib:/opt/csw/lib:/opt/csw/lib
maciej@netra ~ $ /usr/ccs/bin/dump -Lv /opt/csw/bin/sparcv9/gpg |
gegrep 'R(UN|)PATH'
[11]    RUNPATH         /opt/csw/lib/$ISALIST:/opt/csw/lib/64
[12]    RPATH           /opt/csw/lib/$ISALIST:/opt/csw/lib/64

$ISALIST expands to:

sparcv9+vis sparcv9 sparcv8plus+vis sparcv8plus sparcv8 sparcv8-fsmuld
sparcv7 sparc

The binary checks each element of this list, substituting the $ISALIST
token for the path.  After the expansion, /opt/csw/lib/$ISALIST
becomes /opt/csw/lib/sparcv9+vis, /opt/csw/lib/sparcv9,
/opt/csw/lib/sparcv8plus+vis, etc.

In the case of the initdb binary:

maciej@netra ~ $ /usr/ccs/bin/dump -Lv
/opt/csw/lib/postgresql/8.4/bin/sparcv8/initdb | gegrep 'R(UN|)PATH'
[17]    RUNPATH

/opt/csw/lib/$ISALIST:/opt/csw/lib:/opt/csw/lib/postgresql/8.4/lib/$ISALIST:/opt/csw/lib/postgresql/8.4/lib:/opt/csw/lib:/opt/csw/lib/postgresql/8.4/lib
[18]    RPATH

/opt/csw/lib/$ISALIST:/opt/csw/lib:/opt/csw/lib/postgresql/8.4/lib/$ISALIST:/opt/csw/lib/postgresql/8.4/lib:/opt/csw/lib:/opt/csw/lib/postgresql/8.4/lib
maciej@netra ~ $ /usr/ccs/bin/dump -Lv
/opt/csw/lib/postgresql/8.4/bin/sparcv9/initdb | gegrep 'R(UN|)PATH'
[17]    RUNPATH

/opt/csw/lib/$ISALIST:/opt/csw/lib/64:/opt/csw/lib/postgresql/8.4/lib/$ISALIST:/opt/csw/lib/postgresql/8.4/lib/64:/opt/csw/lib/postgresql/8.4/lib
[18]    RPATH

/opt/csw/lib/$ISALIST:/opt/csw/lib/64:/opt/csw/lib/postgresql/8.4/lib/$ISALIST:/opt/csw/lib/postgresql/8.4/lib/64:/opt/csw/lib/postgresql/8.4/lib

The search path for the 64-bit binary is:

/opt/csw/lib/$ISALIST
/opt/csw/lib/64
/opt/csw/lib/postgresql/8.4/lib/$ISALIST
/opt/csw/lib/postgresql/8.4/lib/64
/opt/csw/lib/postgresql/8.4/lib

All the binaries have this RPATH set, so they have enough information
to find the right libraries.

> Even if this could work, I don't see a lot of point to it.
> Why don't you set up two independent installation trees if
> you want to have both 32- and 64-bit postgres installed?

That is an option, but I wanted to avoid separate installation trees
in the first place.  I'm working on replicating the Debian layout, to
support installing multiple PostgreSQL versions at the same time.
Currently, OpenCSW package[1] install PostgreSQL in
/opt/csw/postgresql and there's no room for another version and/or for
data migration.  There are also issues with things like the PATH
setting, so the PostgreSQL package doesn't work out of the box.  I
want to fix that.

My options seem to be:

- find a way to make initdb use the information from RPATH
- ship 32-bit binaries only

Maciej

[1] http://www.opencsw.org/packages/postgresql

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: initdb has trouble finding the right ascii_and_mic.so
Next
From: Claudio Eichenberger
Date:
Subject: 8.4.1 & 8.4.2 require map=... for ident in the pg_hba.conf file, will this be the new way?