From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Fri, 07 May 2021 14:15:14 +0200 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by lore.white.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1lezNy-0004SQ-50 for lore@lore.pengutronix.de; Fri, 07 May 2021 14:15:14 +0200 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 1lezNx-0005IX-S7; Fri, 07 May 2021 14:15:13 +0200 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 1lezNU-0005IP-71 for ptxdist@pengutronix.de; Fri, 07 May 2021 14:14:44 +0200 Received: from mol by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1lezNT-0000rd-UF for ptxdist@pengutronix.de; Fri, 07 May 2021 14:14:43 +0200 Date: Fri, 7 May 2021 14:14:43 +0200 From: Michael Olbrich To: ptxdist@pengutronix.de Message-ID: <20210507121443.GJ28490@pengutronix.de> Mail-Followup-To: ptxdist@pengutronix.de References: <73cafc96-554f-4e33-93ac-79bee71f1101@t2data.com> <20210507071553.3964996-1-m.olbrich@pengutronix.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 13:54:00 up 78 days, 15:17, 98 users, load average: 0.02, 0.05, 0.07 User-Agent: Mutt/1.10.1 (2018-07-13) Subject: Re: [ptxdist] [PATCH] pkg-config-wrapper: calculate the system paths dynamically as well 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 On Fri, May 07, 2021 at 01:14:02PM +0200, Christian Melki wrote: > On 5/7/21 9:15 AM, Michael Olbrich wrote: > > Signed-off-by: Michael Olbrich > > --- > > > > Would this work? Or do we need to exclude /usr/lib explicitly as well? > > > > Michael > > > > scripts/pkg-config-wrapper | 8 +++++--- > > 1 file changed, 5 insertions(+), 3 deletions(-) > > > > diff --git a/scripts/pkg-config-wrapper b/scripts/pkg-config-wrapper > > index d86fa7c683b5..dd786e47b212 100755 > > --- a/scripts/pkg-config-wrapper > > +++ b/scripts/pkg-config-wrapper > > @@ -17,9 +17,11 @@ else > > fi > > > > declare -a libdir system_path system_incpath > > -libdir=( $(find ${prefix} -maxdepth 3 -type d -name pkgconfig) > -system_libpath=( "${libdir[@]/%//../../lib}" "${libdir[@]/%//../lib}" > "/usr/lib" "/lib" ) > > -system_incpath=( "${libdir[@]/%//../../include}" "${libdir[@]/%//../include}" "/usr/include" "/include" ) > > +libdir=( $(find ${prefix} -maxdepth 3 -type d -path */lib*/pkgconfig) ) > > +lib="$(basename $(dirname ${libdir[0]}))" > > Only one libdir? Lost lib64 in translation? Not sure I understand this. My expectation was that ${libdir[0]} is .../sysroot-target/usr/lib64/pkgconfig in your case. I want to use it to find out if lib or lib64 is correct. What's the result of the 'find' above? > > +libdir+=( "${prefix/%//share/pkgconfig}" ) > > +system_libpath=( "${libdir[@]/%//../../${lib}}" "/usr/${lib}" "/${lib}" ) > > This looks strange to me. libdir contains lib64, but $lib is only "lib". > > Doesn't this assume that system libpath is the same as the target? > I'm a bit confused what the filtering needs to filter. > Removing host directories, whatever they may be or removing directories > that are similar to those we are including? The .pc files usually generate search paths like this: 1. Relative to the .pc file itself. This results in something like this: -L[....]/sysroot-target/usr/lib64/pkgconfig/../../lib64 2. Absolute based on the prefix/libdir specified during configure etc.: -L/usr/lib64 So note that the second on is not really a host path but a target path without the sysroot prefix. > Couldn't host path filtering be of similar construction as the cross libdir? > > > +system_incpath=( "${libdir[@]/%//../../include}" "/usr/include" "/include" They are not really host paths. See above. > Not sure i understand libdir to include path filtering either. :) > This becomes sysroot-target/usr/lib{64}/pkgconfig/../../include, > /usr/include. /include? Correct. Those paths will be removed from the pkg-config output. 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 | _______________________________________________ ptxdist mailing list ptxdist@pengutronix.de To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de