Re: Postgresql8.4 install breaks Evolution on Ubuntu 9.10 - Mailing list pgsql-general

From Craig Ringer
Subject Re: Postgresql8.4 install breaks Evolution on Ubuntu 9.10
Date
Msg-id 4B13648C.2090604@postnewspapers.com.au
Whole thread Raw
In response to Re: Postgresql8.4 install breaks Evolution on Ubuntu 9.10  (Greg Stark <gsstark@mit.edu>)
List pgsql-general
Greg Stark wrote:

> But i don't see what the conflict is if they're installed in
> PGHOME/lib as long as the installer doesn't fiddle with
> /etc/ld.so.conf or set any environment variables. The binaries should
> just be built with an rpath pointing to that directory or ship with a
> startup script which puts that directory in LD_LIBRARY_PATH.

In fact, it looks like the EnterpriseDB init scripts *already* set
LD_LIBRARY_PATH when starting the postgresql daemon, despite having also
messed with ld.so.conf . It's a weird half-and-half approach.

I've tested the distribution with ${ORIGIN} based rpath linking without
issues.

Until EnterpriseDB get around to fixing this in their packages, if you
or anyone else need to fix a one-click PostgreSQL-on-Linux binary
install, just make sure chrpath is installed (eg: apt-get install
chrpath) then run the following:

cd /opt/PostgreSQL/8.4
sudo -v
for f in `file * | grep ELF | cut -d : -f 1 `; do
  sudo chrpath --replace "\${ORIGIN}/../lib" $f
done
sudo rm -f /etc/ld.so.conf.d/postgresql-8.4
sudo ldconfig

... which will remove the edb-installed libs from the global search path
and will set the edb binaries to preferentially use the copies of the
libs that came with the distribution. Note that this will change the
checksum of the binaries.


*** TO FIX THIS IN THE EDB ONECLICK DISTRIBUTION ***:

Just build the Pg binaries for the distribution as normal. Once you've
built the binaries and installed to a staging directory, use chrpath to
edit the rpath setting as above, so that the binaries know where to look
for their libraries. Remove /etc/ld.so.conf.d/postgresql-8.4 from the
installer package. Remove setting of LD_LIBRARY_PATH from the init script.

Finally, please rename /etc/init.d/postgresql-8.4 to something that
*doesn't* clobber a distro-installed initscript, like say
/etc/init.d/postgresql-oneclick-8.4 .

*grumbles and restores his original init script from backups after it
was clobbered by the edb installer*

> Whether
> you want to append, leaving the system directories ahead of the
> one-click installed libraries, or prepend so the linker always uses
> your libraries would depend on how you want it to behave. Setting
> rpath is equivalent to prepending I believe.

It is. It's also much, much safer to do things that way, because a lib
with the same name but incompatible configuration won't land up being
unexpectedly loaded.

--
Craig Ringer

pgsql-general by date:

Previous
From: Eduardo Piombino
Date:
Subject: Re: Date with time zone
Next
From: "A. Kretschmer"
Date:
Subject: Re: Access a Field / Column of a resultset by Number