Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mbVyq-0002dE-Ab for pgsql-hackers@arkaria.postgresql.org; Fri, 15 Oct 2021 22:47:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mbVyo-0008Rg-Pm for pgsql-hackers@arkaria.postgresql.org; Fri, 15 Oct 2021 22:47:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mbVyo-0008RX-HI for pgsql-hackers@lists.postgresql.org; Fri, 15 Oct 2021 22:47:10 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mbVyl-0003M0-SY for pgsql-hackers@postgresql.org; Fri, 15 Oct 2021 22:47:10 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id B805D5C01CF; Fri, 15 Oct 2021 18:47:06 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Fri, 15 Oct 2021 18:47:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=CjExoVmJ3JAJzbDT6eq/XG+gE24 OcC75ouRRi4LAVnU=; b=MDzQpiwcBnfVZaHvpmuqc8yyUp3Jl7tkIx+FGEF74sl 6rCn4B/5fQ/DZIcVY37CmGCFRaxC/xqaK09X/DsoBshQDhOfyyPSxvqveBt1Av3F 5FOIeO5OGjqLUdYKJAf9/jg5Q193j9pCv6DJBndwUsGZtUhUni6SCb6wSQpMquRe vvwwBXb9piJGR4duvD2t3U8DJpvrFAlJOywJK8FMCQJA/nBeVIw8wDhYVo8nssxO QOTV4opl1Lq9nB6em4BA9J6BBprpWZ0ZZxqDqhC82n1ShaUFRsG8oAU14wHklIM6 jO5KS10qhCrnIK9Et8W/+au5HWtS7ppDQjxeJ0oc1/Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=CjExoV mJ3JAJzbDT6eq/XG+gE24OcC75ouRRi4LAVnU=; b=gYm7eojKTau4NBWaYXSq7z ky6GGFvxvNysC9X6p7NqIxc9ZwTAkgSD/VHbHWnQKS7DCkrzbmlvvgr1viGRFvpk 44mG4lMYc8npQ+KY2iSpCWtzw+tSqbwPh4dTPvb3ho5cHaGYVeCcBZbrEyTdNdAv rhQnRdnqBt+h/F9G1TejNVhIREO/b+r8qkWfPDvgz5J4V3TUqHIfxtCXKb1JfMm2 CgJXR3go86VEK1UEvWA83gRW790HAijDY7O39l2t9Cff7YFI2QTvc5UlEnTcMVpR 09QyWro8CzJkoA44y9s3XpZjO3mO3T1t7hI4rDUZ2NOCO6e5QRDZ5QYteQYT35ow == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvdduhedgudefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeetnhgurhgv shcuhfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucggtffrrg htthgvrhhnpeevffejhfeugfeviedvffefudfgjeeiteevhedtfeelieetteeivdeiudel gffggeenucffohhmrghinhepghhithhhuhgsrdgtohhmnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomheprghnughrvghssegrnhgrrhgriigvlhdr uggv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 15 Oct 2021 18:47:06 -0400 (EDT) Date: Fri, 15 Oct 2021 15:47:05 -0700 From: Andres Freund To: Tom Lane , Peter Eisentraut Cc: Thomas Munro , John Naylor , pgsql-hackers Subject: Re: [RFC] building postgres with meson Message-ID: <20211015224705.mngenvtqjbr4mee5@alap3.anarazel.de> References: <20211013174246.zgp2sxdqsulhepea@alap3.anarazel.de> <906095.1634248849@sss.pgh.pa.us> <20211014231501.vgmxc2jl63cya5ym@alap3.anarazel.de> <910266.1634253838@sss.pgh.pa.us> <20211015185030.l43dcix5mltks235@alap3.anarazel.de> <20211015223616.kjpn6lnfjyayzsht@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211015223616.kjpn6lnfjyayzsht@alap3.anarazel.de> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2021-10-15 15:36:16 -0700, Andres Freund wrote: > 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. Well, now that I think about it, it's still only relocatable in the sense that postgres itself will continue to work. Outside code linking to e.g. libpq will get the wrong path after relocation the source tree, due to the absolute install_name. But that doesn't seem solvable, unless we make the installed install_name to be '@rpath/libpq...dylib' and require code linking to libpq to pass -Wl,-rpath,/path/to/libpq when linking to libpq. Greetings, Andres Freund