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 1mbSI2-0000cU-9e for pgsql-hackers@arkaria.postgresql.org; Fri, 15 Oct 2021 18:50:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mbSI0-00062v-2h for pgsql-hackers@arkaria.postgresql.org; Fri, 15 Oct 2021 18:50:44 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mbSHy-0005zx-4B for pgsql-hackers@lists.postgresql.org; Fri, 15 Oct 2021 18:50:43 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mbSHr-0000Xl-02 for pgsql-hackers@postgresql.org; Fri, 15 Oct 2021 18:50:41 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 871285C01FE; Fri, 15 Oct 2021 14:50:32 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 15 Oct 2021 14:50:32 -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=4X+89bMYwGDWiALOB/oM2dTssPZ 5zTpEZaGReDvfZMc=; b=KvTfb7GZrpzvGCGyS0saLzBSpdsi6GoA5r+phqNTQgI 7zYnRKryEw3ND1k/y0qdUewPEC4RkPMNl2oOaC2C7zXkPZmyofha7xxsJC2ENzmt JMFLMeVUQ6v11ppZBumfxoKSW1iasqMA3SWji+xS0LIfRCs3PlenB2mrZHmyxDjq f3JRJqluf6tCg6npXzGV7zANBnO5A/lNLVo+Sy4uBZ3pfTOw+X5+ezp6fBKsVVaN /oZtPAByF3K2Lj+sal3qsaRMlNFzjnKQSuPaMZSVMWd5Cm6lD/+5xPtUrOqKTTnh 56d/KBDJf0YoXqzKiRDxK190u+AZ+8Hfs0LCMtwkIFg== 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=4X+89b MYwGDWiALOB/oM2dTssPZ5zTpEZaGReDvfZMc=; b=M/uyUY3bALx8ofQvMq2CFW aOWlVD+tdokHo+TrRH4U4MqRKQB7qUhLiirygjShnOnzQLDeurIj6HjFJ9f/Itt3 oKky9D/HnosQOS3hTvqmVkINUeStF0u/FSfp6KIwB5b+zIqYHJDAP7GxvPf1aIwT RamaXptWVK7SF90o9IjLivbFcg38+zDoM2p7t/IlYiQjxg7oJ5ZEnRqyVFOCTG4R AK1pBay/S6gh4zMVa34k2GMNuKmko+S4Su26UX3lMcffUv4qhHbybVo2wLpoEiXg 8HIY1oGPQtlt2wnKA5jLIWFL7re6Z0ftUQaiygUv3KZGiu5Te2x+he0RF9Q955MQ == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddugedguddvkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkfhggtggujgesthdtredttddtvdenucfhrhhomheptehnughr vghsucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuggftrf grthhtvghrnhepudekhfekleeugeevteehleffffejgeelueduleeffeeutdelffeujeff hfeuffdunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh eprghnughrvghssegrnhgrrhgriigvlhdruggv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 15 Oct 2021 14:50:32 -0400 (EDT) Date: Fri, 15 Oct 2021 11:50:30 -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: <20211015185030.l43dcix5mltks235@alap3.anarazel.de> References: <20211013163721.oqwvztktwsym3iu4@alap3.anarazel.de> <20211013174246.zgp2sxdqsulhepea@alap3.anarazel.de> <906095.1634248849@sss.pgh.pa.us> <20211014231501.vgmxc2jl63cya5ym@alap3.anarazel.de> <910266.1634253838@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <910266.1634253838@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2021-10-14 19:23:58 -0400, Tom Lane wrote: > Andres Freund writes: > > If, and perhaps that's too big an if, relative rpaths actually work despite > > SIP, it might be worth setting a relative install_rpath, because afaict that > > should then work both for a "real" installation and our temporary test one. > > From what we know so far, it seems like SIP wouldn't interfere with > that (if it works at all). I think what SIP desires to prevent is > messing with a program's execution by setting DYLD_LIBRARY_PATH. > As long as the program executable itself is saying where to find > the library, I don't see why they should interfere with that. Well, there's *some* danger with relative rpaths, because they might accidentally be pointing somewhere non-existing and user-creatable. Not a huge risk, but as you say: > (Again, it seems blindingly stupid to forbid this while not blocking > PATH or any of the other environment variables that have always affected > execution. But what do I know.) these aren't necessarily carefuly weighed considerations :/ But it seems to work well from what I gather. > > If absolute rpaths are required, it'd make the process a bit more expensive, > > It'd also put the kibosh on relocatable install trees, though I dunno how > much people really care about that. We currently use absolute rpaths, or something equivalent. The reason that running tests on macos works is that we set the "install_name" of shared libraries to the intended installed location, using an absolute path: LINK.shared = $(COMPILER) -dynamiclib -install_name '$(libdir)/lib$(NAME).$(SO_MAJOR_VERSION)$(DLSUFFIX)' $(version_link) $(exported_symbols_list) -multiply_defined suppress which on macos means that all libraries linking to that dylib reference it under that absolute path. On most other platforms we set an absolute rpath to the installation directory, which has an equivalent effect: rpathdir = $(libdir) 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. Greetings, Andres Freund