From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A9F9C433F5 for ; Wed, 1 Dec 2021 22:39:04 +0000 (UTC) Received: from mail-vk1-f177.google.com (mail-vk1-f177.google.com [209.85.221.177]) by mx.groups.io with SMTP id smtpd.web10.594.1638398343402096478 for ; Wed, 01 Dec 2021 14:39:03 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=CLsRjNus; spf=pass (domain: gmail.com, ip: 209.85.221.177, mailfrom: alex.kanavin@gmail.com) Received: by mail-vk1-f177.google.com with SMTP id 84so17205211vkc.6 for ; Wed, 01 Dec 2021 14:39:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VbIyrXvwaf+O65uCdLW94fUHJTHSoCQf6++PaIY6bGM=; b=CLsRjNusNmeSII3CxkrfGj8tYKBPliEgPU9Tn9VMcX9tGfhvtCP18FrGM8WG0UHJXu mWl7p29IJqnNJLD+EKMmxqRRMAoM4oR73m4K6tWqrjhgJ8cfnARLRhHoHLpBkwUJGqBn dk6e/YchFQuTPHVbsaHu2sqUGnRCLIOW9RDpwFF55e4A253swX5GlgB1Gz+DcNK0Egyk NmXePtzUBnQl4akRyiratbhYwvGckAMsB0frysNAilUGD0/0tyJ1fynrmT3Qpz3dlROh 9mwaj55lJ0j54gYVK85YiQ7SvrTFMSAxwyo7xcXq3cnI6ao96YBppwyDqeWVAxZm04O/ GMxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VbIyrXvwaf+O65uCdLW94fUHJTHSoCQf6++PaIY6bGM=; b=T8IYpt0j3Efq6XqjPOuHdexBvoJf3k8HWMKaRkX6Jy7N7W3EzzNsRhH2UA6G1smORv fLdbmIes+Xosp3vA3dK5L8GwM/dwJtRiLvgmS31Tg6D8a/Xt6LfvXmy4gMQM5a/32eCZ pobT/YmprknwP2Ny6lqq8FSNBYYOjDq6E5D471jBwu0h4krgv8/ILcemeti935LYpYLd gEF0pjd9LtriKbaktFavCueQsY6mdwcCLZyy3x3WLLRG6xuWQaEOn4/eYtGwm+MedIXj p0mVAQRbDA04tahsbCGTCQdh7DxEokl9aNsLbxpmV3hMRmvf8gVsZnoTlIebrwwyOsxm XGDQ== X-Gm-Message-State: AOAM531Y3/i0RZ/sxQsmQBtX+gxqeXreFpOMyFJB3zfl6g4kRlcOreH0 ZFKgleMdSHn3QVBSgkPxLg/Db7C9MyJPcNgUKuM= X-Google-Smtp-Source: ABdhPJzDoC9njGsgSSP2xs2HVP/Kle421P/iK18OBDH0m2eW3Cc29kksyYNDp4nlwcWBx63GihZCxe8yb1rqOwxAnSs= X-Received: by 2002:a05:6122:114c:: with SMTP id p12mr11539638vko.21.1638398342561; Wed, 01 Dec 2021 14:39:02 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Alexander Kanavin Date: Wed, 1 Dec 2021 23:38:51 +0100 Message-ID: Subject: Re: [OE-core] [RFC] meson needs a pkg-config wrapper script To: Joel Winarske Cc: OE-core Content-Type: multipart/alternative; boundary="00000000000035834105d21d5798" List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Wed, 01 Dec 2021 22:39:04 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/159064 --00000000000035834105d21d5798 Content-Type: text/plain; charset="UTF-8" Please keep the conversation on the list. Those are two different, independently developed projects: https://gitlab.freedesktop.org/pkg-config/pkg-config https://github.com/pkgconf/pkgconf and they are not fully compatible as you have just shown. I'm not sure how pkgconf is able to decide that includedir is a path (short of hardcoding that inside the source somewhere), but such logic needs to be carefully investigated before we make use of it, e.g. by switching to pkgconf in oe-core. Alex On Wed, 1 Dec 2021 at 23:31, Joel Winarske wrote: > pkg-config --version ? > > Using 0.29.2 I get the same output as you: > $ PKG_CONFIG_SYSROOT_DIR=$STAGING_DIR_TARGET > /home/linuxbrew/.linuxbrew/bin/pkg-config --define-variable=prefix=/opt > --variable=includedir glesv2 > /usr/include > > Using 1.7.3 it works: > > STAGING_DIR_TARGET=/b/github-ci/_work/meta-flutter/rpi4-drm-honister-latest/raspberrypi4-64/tmp/work/cortexa72-poky-linux/vkmark/git-r0/recipe-sysroot > PKG_CONFIG_SYSROOT_DIR=$STAGING_DIR_TARGET /usr/bin/pkg-config > --variable=includedir glesv2 > > /b/github-ci/_work/meta-flutter/rpi4-drm-honister-latest/raspberrypi4-64/tmp/work/cortexa72-poky-linux/vkmark/git-r0/recipe-sysroot/usr/include > > $ /usr/bin/pkg-config --version > 1.7.3 > > $ /home/linuxbrew/.linuxbrew/bin/pkg-config --version > 0.29.2 > > On Wed, Dec 1, 2021 at 12:36 AM Alexander Kanavin > wrote: > >> No, it's not that. Even if you pass PKG_CONFIG_SYSROOT_DIR to pkg-config >> directly, it will apply that only to --cflags and similar, but not to >> generic --variable. Try this: >> >> alex@alex-lx-laptop:~$ PKG_CONFIG_SYSROOT_DIR=/aaaa pkg-config libdrm >> --cflags >> -I/aaaa/usr/include/libdrm >> alex@alex-lx-laptop:~$ PKG_CONFIG_SYSROOT_DIR=/aaaa pkg-config libdrm >> --variable=includedir >> /usr/include >> >> So a wrapper will not solve the 'includedir prefix' problem, and neither >> the wrapper, nor pkg-config or meson can possibly know which variable is a >> path, and which isn't - the only place where that is known is the component >> that obtains the variable. And so that's where it has to be prefixed. >> >> Alex >> >> On Tue, 30 Nov 2021 at 23:38, Joel Winarske >> wrote: >> >>> Based on my testing, if PKG_CONFIG_SYSROOT_DIR is set or not makes zero >>> difference on the outcome. I suspect this is related to how pkg-config is >>> launched by meson. >>> >>> Looking at the meson source tree, in all ci/test cross compile scenarios >>> they reference a pkg-config wrapper. No cross compile scenario I see >>> referencing the 'pkgconfig' key uses a bare pkg-config. >>> >>> cross/armclang-linux.txt:#pkgconfig = >>> '/usr/bin/arm-linux-gnueabihf-pkg-config' >>> cross/linux-mingw-w64-32bit.txt:pkgconfig = >>> '/usr/bin/i686-w64-mingw32-pkg-config' >>> cross/linux-mingw-w64-64bit.txt:pkgconfig = >>> '/usr/bin/x86_64-w64-mingw32-pkg-config' >>> cross/ubuntu-armhf.txt:pkgconfig = >>> '/usr/bin/arm-linux-gnueabihf-pkg-config' >>> test cases/unit/33 cross file overrides always >>> args/ubuntu-armhf-overrides.txt:pkgconfig = >>> '/usr/bin/arm-linux-gnueabihf-pkg-config' >>> test cases/unit/36 exe_wrapper behaviour/broken-cross.txt:pkgconfig >>> = '/usr/bin/x86_64-w64-mingw32-pkg-config' >>> >>> I think adding a wrapper makes sense. >>> >>> 5.2 Tool Calling Conventions - >>> https://autotools.io/pkgconfig/cross-compiling.html >>> >>> On Tue, Nov 30, 2021 at 12:13 PM Alexander Kanavin < >>> alex.kanavin@gmail.com> wrote: >>> >>>> On Tue, 30 Nov 2021 at 21:00, Joel Winarske >>>> wrote: >>>> >>>>> Yes, if the sys_root key value in meson.cross is present >>>>> PKG_CONFIG_SYSROOT_DIR gets set. Honister patch I confirmed with: >>>>> >>>>> https://github.com/jwinarske/manifests/blob/honister/rpi64/0001-Add-sys_root-to-properties-section.patch >>>>> >>>>> The issue is that meson doesn't pass PKG_CONFIG_SYSROOT_DIR to the >>>>> shell environment that runs pkg-config, as with the pkg-config sandbox test >>>>> it does work. >>>>> >>>> >>>> Both meson source code and its documentation indicate otherwise - if >>>> you set sys_root property, it will get passed to pkg-config via environment >>>> as PKG_CONFIG_SYSROOT_DIR: >>>> >>>> https://github.com/mesonbuild/meson/blob/master/mesonbuild/dependencies/pkgconfig.py#L121 >>>> >>>> Alex >>>> >>>> --00000000000035834105d21d5798 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Please keep the conversation on the list.
<= br>
Those are two different, independently developed projects:
and they are not fully compatible as you have just shown.

I'm not sure how pkgconf is able to decide that = includedir is a path (short of hardcoding that inside the source somewhere)= , but such logic needs to be carefully investigated before we make use of i= t, e.g. by switching to pkgconf in oe-core.

Al= ex

On Wed, 1 Dec 2021 at 23:31, Joel Winarske <joel.winarske@gmail.com>= ; wrote:
pkg-config --version ?

Using 0.29.2 I get the same output as you:
$ PKG_CONFIG_SYSROO= T_DIR=3D$STAGING_DIR_TARGET /home/linuxbrew/.linuxbrew/bin/pkg-config --def= ine-variable=3Dprefix=3D/opt --variable=3Dincludedir glesv2
/usr/include=

Using 1.7.3 it works:
STAGING_DIR_TARGE= T=3D/b/github-ci/_work/meta-flutter/rpi4-drm-honister-latest/raspberrypi4-6= 4/tmp/work/cortexa72-poky-linux/vkmark/git-r0/recipe-sysroot
PKG_CONFIG_SYSROOT_DIR=3D$STAGING_DIR_TARGET /usr/bin/pkg= -config --variable=3Dincludedir glesv2
/b/github-ci/_work/meta-flutter/r= pi4-drm-honister-latest/raspberrypi4-64/tmp/work/cortexa72-poky-linux/vkmar= k/git-r0/recipe-sysroot/usr/include

$ /usr/bin/pkg= -config --version
1.7.3

$ /home/linuxbrew/.linu= xbrew/bin/pkg-config --version
0.29.2

On Wed, Dec 1, 2021 at 12= :36 AM Alexander Kanavin <alex.kanavin@gmail.com> wrote:
No, it's not = that. Even if you pass PKG_CONFIG_SYSROOT_DIR to pkg-config directly, it wi= ll apply that only to --cflags and similar, but not to generic --variable. = Try this:

alex@alex-lx-laptop:~$ PKG_CONFIG_SYSROO= T_DIR=3D/aaaa pkg-config libdrm --cflags
-I/aaaa/usr/include/libdrm
a= lex@alex-lx-laptop:~$ PKG_CONFIG_SYSROOT_DIR=3D/aaaa pkg-config libdrm --va= riable=3Dincludedir
/usr/include

So a wrapper w= ill not solve the 'includedir prefix' problem, and neither the wrap= per, nor pkg-config or meson can possibly know which variable is a path, an= d which isn't - the only place where that is known is the component tha= t obtains the variable. And so that's where it has to be prefixed.
<= /div>

Alex

On Tue, 30 Nov 2021 at 23:38, Joel W= inarske <jo= el.winarske@gmail.com> wrote:
Based on my testing, if PKG_CONF= IG_SYSROOT_DIR is set or not makes zero difference on the outcome.=C2=A0 I = suspect this is related to how pkg-config is launched by meson.

Looking at the meson source tree, in all ci/test cross co= mpile=20 scenarios they reference a pkg-config wrapper.=C2=A0 No cross compile=20 scenario I see referencing the 'pkgconfig' key uses a bare pkg-conf= ig.

=C2=A0=C2=A0=C2=A0 cross/armclang-linux.tx= t:#pkgconfig =3D '/usr/bin/arm-linux-gnueabihf-pkg-config'
=C2= =A0=C2=A0=C2=A0 cross/linux-mingw-w64-32bit.txt:pkgconfig =3D '/usr/bin= /i686-w64-mingw32-pkg-config'
=C2=A0=C2=A0=C2=A0 cross/linux-mingw-w= 64-64bit.txt:pkgconfig =3D '/usr/bin/x86_64-w64-mingw32-pkg-config'=
=C2=A0=C2=A0=C2=A0 cross/ubuntu-armhf.txt:pkgconfig =3D '/usr/bin/a= rm-linux-gnueabihf-pkg-config'
=C2=A0=C2=A0=C2=A0 test cases/unit/33 cross file overrides always=20 args/ubuntu-armhf-overrides.txt:pkgconfig =3D=20 '/usr/bin/arm-linux-gnueabihf-pkg-config'
=C2=A0=C2=A0=C2=A0 tes= t cases/unit/36 exe_wrapper behaviour/broken-cross.txt:pkgconfig =3D '/= usr/bin/x86_64-w64-mingw32-pkg-config'

I think adding a wrapper makes sense.


On Tue, Nov 30, 2021 at 12:13 PM Alexander Kanav= in <alex.kan= avin@gmail.com> wrote:
On Tue, 30 Nov 2021 at 21:00, Joel Winarske <joel.winarske@gmail.= com> wrote:
Yes, if the sys_root key value in meson.cross is p= resent PKG_CONFIG_SYSROOT_DIR gets set.=C2=A0 Honister patch I confirmed wi= th:
https://= github.com/jwinarske/manifests/blob/honister/rpi64/0001-Add-sys_root-to-pro= perties-section.patch

The issue is that meson = doesn't pass PKG_CONFIG_SYSROOT_DIR to the shell environment that runs = pkg-config, as with the pkg-config sandbox test it does work.

Both meson source code and its documenta= tion indicate otherwise - if you set sys_root property, it will get passed = to pkg-config via environment as PKG_CONFIG_SYSROOT_DIR:

Alex

--00000000000035834105d21d5798--