Re: [RFC] building postgres with meson

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, John Naylor <john(dot)naylor(at)enterprisedb(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [RFC] building postgres with meson
Date: 2021-10-15 22:36:16
Message-ID: 20211015223616.kjpn6lnfjyayzsht@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2021-10-15 11:50:30 -0700, Andres Freund wrote:
> It seems to work quite well to change our own references to libpq in binaries
> / shared libs to be relative, but to leave the install_name of the libraries
> intact. In combination with adding an rpath of @loader_path/../lib/ to
> binaries and @loader_path/ to shlibs, the install will re relocatable.
>
> It doesn't work as well to actually have a non-absolute install_name for
> libraries (e.g. @rpath/libpq.dylib), because then external code linking to
> libpq needs to add an rpath to the installation to make it work.
>
> The advantage of this approach over Peter's is that it's not temp-install
> specific - due to the relative paths, it makes installations relocatable
> without relying [DY]LD_LIBRARY_PATH.
>
> On other unixoid systems this whole mess is simpler, because we can just add
> $ORIGIN to shared libraries and $ORIGIN/../lib/ to binaries. We don't need to
> leave some absolute path in the libraries themself intact.

I implemented this for the meson build, and it seems to work nicely. The macos
part was harder than I hoped due to the install_name stuff, which meson
doesn't solve.

https://github.com/anarazel/postgres/commit/a35379c28989469cc4b701a8d7a22422e6302e09

After that the build directory is relocatale.

I don't immediately see a way to do this reasonably for the autoconf
build. We'd need a list of our own shared libraries from somewhere, and then
replace the references after building the objects?

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2021-10-15 22:47:05 Re: [RFC] building postgres with meson
Previous Message Tomas Vondra 2021-10-15 21:59:47 Re: Partial aggregates pushdown