From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Thu, 23 Mar 2023 07:00:02 +0100 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pfDzV-00BUFa-Py for lore@lore.pengutronix.de; Thu, 23 Mar 2023 07:00:02 +0100 Received: from localhost ([127.0.0.1] helo=metis.ext.pengutronix.de) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1pfDzU-00013c-Rh; Thu, 23 Mar 2023 07:00:00 +0100 Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pfDzH-00013S-Cg; Thu, 23 Mar 2023 06:59:47 +0100 Received: from mol by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1pfDzG-000412-Sz; Thu, 23 Mar 2023 06:59:46 +0100 Date: Thu, 23 Mar 2023 06:59:46 +0100 From: Michael Olbrich To: Christian Melki Message-ID: <20230323055946.GK19906@pengutronix.de> Mail-Followup-To: Christian Melki , ptxdist@pengutronix.de References: <4d8f168a-d731-8cc0-892c-19c9f0cdc879@t2data.com> <20211015131257.GE2239952@pengutronix.de> <351d7aec-e41a-c334-1835-5062e8825650@t2data.com> <3bce4a46-0eb6-8bf1-3057-c0d0c2f393fe@t2data.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3bce4a46-0eb6-8bf1-3057-c0d0c2f393fe@t2data.com> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain User-Agent: Mutt/1.10.1 (2018-07-13) Subject: Re: [ptxdist] Request for comments: CROSS_LIB_DIR handling etc. X-BeenThere: ptxdist@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: ptxdist@pengutronix.de Cc: ptxdist@pengutronix.de Sender: "ptxdist" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: ptxdist-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false Hi, On Fri, Nov 05, 2021 at 10:31:24AM +0100, Christian Melki wrote: > On 11/5/21 9:57 AM, Michael Olbrich wrote: > > On Thu, Nov 04, 2021 at 11:06:13AM +0100, Christian Melki wrote: > > > On 10/15/21 3:34 PM, Christian Melki wrote: > > > > On 10/15/21 3:12 PM, Michael Olbrich wrote: > > > > > On Wed, Oct 13, 2021 at 09:29:24AM +0200, Christian Melki wrote: > > > > > > I've been correcting various hardcoded paths in ptxdist packages > > > > > > and whatnot > > > > > > lately. This started with ptxdist not coping well with toolchains that > > > > > > adhere to the ABI path for various architectures. > > > > > > > > > > > > Yesterday, I dug into the problem that on x86_64 (/lib64), all > > > > > > .pc.in -> .pc > > > > > > file transformations looked broken with hardcoded paths. At > > > > > > first I thought > > > > > > it had something to do with autoconf or pkg-config but after a > > > > > > while I found > > > > > > this. > > > > > > > > > > > > scripts/lib/ptxd_make_world_install_mangle_pc.awk > > > > > > > > > > > > Which after a while made me realize that there is still a lot of code in > > > > > > ptxdist core stuff that assumes that lib-paths are only /lib and nothing > > > > > > else. > > > > > > > > > > > > So. I'm presenting a two options here. > > > > > > > > > > > > 1. Fix all ptxdist core stuff, because really, ptxdist should be more > > > > > > flexible than hardcoded paths. Esp. for libs. > > > > > > > > > > > > 2. Split ptxd_get_lib_dir, because, ld.so path should not be > > > > > > assumed to be > > > > > > the same as main library install path. So ptxd_get_ld_lib_dir which does > > > > > > what it does today and install ld there and ptxd_get_lib_dir = > > > > > > /lib and be > > > > > > done with all the userspace library transformations. > > > > > > > > > > So, put everything in lib/ and only the ld.so in lib64/, right? > > > > > > > > > > > > > Yes. And depending on toolchain configuration.. + glibc, but not the > > > > rest of the userspace libs as you say. Since the copy_toolchain routines > > > > query the linker by itself afaiu. > > > > Good point about copy_toolchain. I don't mind if glibc (etc.) is installed > > in /lib64 as well. Whatever is easier to start with. We can change that > > later if necessary. > > > > Ok. I'll prepare a patch for hardcoding ptxdist to /lib for non toolchain > related things. I will be naive/stupid/simple, but the discussion about > configurability etc can start there. > > > > > Either way, the important bit is the hardcoded path to ld.so in the ABI > > > > declaration. That's the one you have to hit, otherwise you'll have > > > > bricked userspace. :) The rest can be solved with ld.so.conf. > > > > So /usr/lib is not in the default search path and /etc/ld.so.conf is > > necessary in this case? > > > > Hmm. If we do nothing then I guess that depends on the toolchain. If the > toolchain is configured with an extended "user-defined-trusted-dirs" option > you probably don't need an ld.so.conf for the default search paths. But > otherwise, I'd say yes? Can't remember. I use an ld.so.conf that always > includes the usual suspects and prepare a cache when I boot (after ld.so has > been hit). > > To me it looks like glibc expects the default usr search path to be the > usr/ld.so path (/lib64, /usr/lib64) So, I've picked this up myself and I've pushed something to master. CROSS_LIB_DIR is now always /lib and CROSS_LINKER_LIB_DIR has its previous value. If they differ, then /$(CROSS_LINKER_LIB_DIR) is created as a symlink to /lib (which is a symlink to /usr/lib). And everything is installed to /usr/lib including the dynamic linker. This avoids any issues with the search path. I've removed all uses of CROSS_LIB_DIR in PTXdist itself, but it's still there for compatibility for now. I've tested this with a crosstool-ng x86_64 toolchain, but it would be great if you could take a look at it with your setup. Michael -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |