Re: Can't initdb, libdir points to static location

From: tfarrell(at)laurelnetworks(dot)com (Tim Farrell)
To: "pgsql-general(at)postgresql(dot)org(dot)pgsql-hackers"(at)postgresql(dot)org
Subject: Re: Can't initdb, libdir points to static location
Date: 2003-11-25 14:24:25
Message-ID: e971267b.0311250624.4c759b14@posting.google.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

peter_e(at)gmx(dot)net (Peter Eisentraut) wrote in message news:<Pine(dot)LNX(dot)4(dot)44(dot)0311242011220(dot)21306-100000(at)peter(dot)localdomain>...
> Tim Farrell writes:
>
> > I use PostgreSQL as a default database in our solution and with the
> > 7.2 version I was able to tar up the area pointed to by the --prefix
> > build argument and untar to an arbitrary path as part of my product
> > installation and I could initdb the database no problem and get a
> > running database setup completely.
>
> OK, but it was never intended that this would work. In fact, it was
> specifically documented as not working well. Maybe you want to do 'make
> install DESTDIR=...' instead, to create a "fake root" installation that
> you can tar up.

Setting DESTDIR doesn't fix the issue because the macro referenced in
the conversion_create.sql script is defined at compile time to take
whatever value
PKGPREFIX resolves to. This means that no matter what path I use to
compile the distribution with, the $libdir will not resolve correctly.
If I tar up the distribution and untar it into an arbitrary directory
the $libdir will not resolve to find the correct shared libraries.

>
> > Is there an environment variable that can override this like
> > LD_LIBRARY_PATH ?
>
> There isn't one right now, but the environment variable might not be a bad
> idea.

To work around this I changed dfmgr.c to look for an alternate value
for $libdir if the compile time value of PKGPREFIX doesn't exist in
the environment variable PGDATA. Its a hack but it works for me right
now.

Seems to me that removing the path from the shared libraries
referenced in the conversion_create.sql script and letting them be
found with LD_LIBRARY_PATH and dlopen would be a better way to handle
this. There must be some history as to why the $libdir macro is used
in this case that is preventing a solution like this ?

Thanks for the new 7.4 version of postgres, we were using 7.2.1
previously. Keep up the good work.

Tim

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adam Witney 2003-11-25 15:03:27 [OT... But couldn't resist!] Master/Slave
Previous Message btober 2003-11-25 14:16:29 Re: duplicate primary key entries?

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2003-11-25 14:49:33 Re: Build farm
Previous Message Hans-Jürgen Schönig 2003-11-25 13:54:43 Re: ObjectWeb/Clustered JDBC