Re: Postgresql8.4 install breaks Evolution on Ubuntu 9.10

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, Sachin Srivastava <sachin(dot)srivastava(at)enterprisedb(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Postgresql8.4 install breaks Evolution on Ubuntu 9.10
Date: 2009-11-30 06:22:04
Message-ID: 4B13648C.2090604@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message A. Kretschmer 2009-11-30 06:56:15 Re: Access a Field / Column of a resultset by Number
Previous Message Eduardo Piombino 2009-11-30 04:51:33 Re: Date with time zone