All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] meson needs a pkg-config wrapper script
@ 2021-11-30 17:20 Joel Winarske
  2021-11-30 17:49 ` [OE-core] " Alexander Kanavin
  2021-11-30 21:18 ` Ross Burton
  0 siblings, 2 replies; 16+ messages in thread
From: Joel Winarske @ 2021-11-30 17:20 UTC (permalink / raw)
  To: Openembedded-core

[-- Attachment #1: Type: text/plain, Size: 958 bytes --]

Meson does not expose PKG_CONFIG_SYSROOT_DIR to the pkg-config process.

Currently meson.cross as generated in meson.bbclass points directly to the
pkg-config executable (no wrapper script).

PKG_CONFIG_SYSROOT_DIR behaves like a simple string prepend to all package
config variable queries.  So if you want to determine the absolute path of
a variable in .pc you set PKG_CONFIG_SYSROOT_DIR and make your query.
Currently this is not possible with Yocto+Meson.

I think a simple wrapper script would resolve this.  This is from
https://autotools.io/pkgconfig/cross-compiling.html:

#!/bin/sh

SYSROOT=/build/root

export PKG_CONFIG_PATH=
export PKG_CONFIG_LIBDIR=${SYSROOT}/usr/lib/pkgconfig:${SYSROOT}/usr/share/pkgconfig
export PKG_CONFIG_SYSROOT_DIR=${SYSROOT}

exec pkg-config "$@"


The wrapper script would be generated per recipe via meson.bbclass,
meson.cross would then reference this wrapper instead of the pkg-config
executable.

Thoughts?


Joel

[-- Attachment #2: Type: text/html, Size: 1382 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [OE-core] [RFC] meson needs a pkg-config wrapper script
  2021-11-30 17:20 [RFC] meson needs a pkg-config wrapper script Joel Winarske
@ 2021-11-30 17:49 ` Alexander Kanavin
  2021-11-30 18:25   ` Joel Winarske
  2021-11-30 21:18 ` Ross Burton
  1 sibling, 1 reply; 16+ messages in thread
From: Alexander Kanavin @ 2021-11-30 17:49 UTC (permalink / raw)
  To: Joel Winarske; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 1630 bytes --]

On Tue, 30 Nov 2021 at 18:20, Joel Winarske <joel.winarske@gmail.com> wrote:

> Meson does not expose PKG_CONFIG_SYSROOT_DIR to the pkg-config process.
>
> Currently meson.cross as generated in meson.bbclass points directly to the
> pkg-config executable (no wrapper script).
>
> PKG_CONFIG_SYSROOT_DIR behaves like a simple string prepend to all package
> config variable queries.  So if you want to determine the absolute path of
> a variable in .pc you set PKG_CONFIG_SYSROOT_DIR and make your query.
> Currently this is not possible with Yocto+Meson.
>
> I think a simple wrapper script would resolve this.  This is from
> https://autotools.io/pkgconfig/cross-compiling.html:
>
> #!/bin/sh
>
> SYSROOT=/build/root
>
> export PKG_CONFIG_PATH=
> export PKG_CONFIG_LIBDIR=${SYSROOT}/usr/lib/pkgconfig:${SYSROOT}/usr/share/pkgconfig
> export PKG_CONFIG_SYSROOT_DIR=${SYSROOT}
>
> exec pkg-config "$@"
>
>
> The wrapper script would be generated per recipe via meson.bbclass,
> meson.cross would then reference this wrapper instead of the pkg-config
> executable.
>
> Thoughts?
>

I don't think this is correct. Meson's way of doing things is that you are
not supposed to get the include/library paths directly from pkg-config, but
rather use
https://mesonbuild.com/Reference-manual_functions.html#dependency and meson
will take care of any needed prefixes to the paths.

For the custom variables defined in .pc that happen to contain paths,
PKG_CONFIG_SYSROOT_DIR has no effect at all, so you need to manually
prepend it anyway everywhere where they're used. pkg-config does not know
what variable is a path and what isn't.

Alex

[-- Attachment #2: Type: text/html, Size: 2426 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [OE-core] [RFC] meson needs a pkg-config wrapper script
  2021-11-30 17:49 ` [OE-core] " Alexander Kanavin
@ 2021-11-30 18:25   ` Joel Winarske
  2021-11-30 18:53     ` Alexander Kanavin
  0 siblings, 1 reply; 16+ messages in thread
From: Joel Winarske @ 2021-11-30 18:25 UTC (permalink / raw)
  To: Alexander Kanavin; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 4047 bytes --]

This pattern works to get the absolute path of the header:

Yocto

    EXTRA_OEMESON += "--prefix ${STAGING_DIR_TARGET}/usr"

Meson

    vulkan_dep = dependency('vulkan')
    vulkan_hpp = join_paths([
        vulkan_dep.get_pkgconfig_variable('includedir', define_variable:
['prefix', get_option('prefix')]),
        'vulkan',
        'vulkan.hpp'
        ])

Implementation in build/meson-log.txt

Called
`/b/github-ci/_work/meta-flutter/rpi4-drm-honister-latest/rpi4/tmp/work/cortexa72-poky-linux/vkmark/git-r0/recipe-sysroot-native/usr/bin/pkg-config
--define-variable=prefix=/b/github-ci/_work/meta-flutter/rpi4-drm-honister-latest/rpi4/tmp/work/cortexa72-poky-linux/vkmark/git-r0/recipe-sysroot/usr
--variable=includedir vulkan` -> 0


One would expect the following meson to work if STAGING_DIR_TARGET were
set, as that's how pkg-config works:

    vulkan_dep = dependency('vulkan')
    vulkan_hpp = join_paths([
        vulkan_dep.get_pkgconfig_variable('includedir'),
        'vulkan',
        'vulkan.hpp'
        ])

This will always return /usr/include/vulkan/vulkan.hpp regardless of
PKG_CONFIG_SYSROOT_DIR value.  With PKG_CONFIG_SYSROOT_DIR set, it should
be /usr/include/vulkan/vulkan.hpp with prepend of PKG_CONFIG_SYSROOT_DIR
value.


Sandbox testing of pkg-config

    $ export
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 pkg-config
--define-variable=prefix=/opt --variable=includedir vulkan
/b/github-ci/_work/meta-flutter/rpi4-drm-honister-latest/raspberrypi4-64/tmp/work/cortexa72-poky-linux/vkmark/git-r0/recipe-sysroot/opt/include


meson.cross

Setting sys_root in the properties section of meson.cross (patching
meson.bbclass) indirectly sets PKG_CONFIG_SYSROOT_DIR.  The setting of
sys_root is present in nativesdk_meson*.bb, not meson*.bb.

The issue for meson is that they are not passing the PKG_CONFIG_SYSROOT_DIR
variable to the shell that launches pkg-config.

My proposed work around (this email thread) would fix the behavior.  I
believe the proper fix is for meson to address upstream.  Still waiting on
a response from them: https://github.com/mesonbuild/meson/issues/9674


Joel

On Tue, Nov 30, 2021 at 9:49 AM Alexander Kanavin <alex.kanavin@gmail.com>
wrote:

> On Tue, 30 Nov 2021 at 18:20, Joel Winarske <joel.winarske@gmail.com>
> wrote:
>
>> Meson does not expose PKG_CONFIG_SYSROOT_DIR to the pkg-config process.
>>
>> Currently meson.cross as generated in meson.bbclass points directly to
>> the pkg-config executable (no wrapper script).
>>
>> PKG_CONFIG_SYSROOT_DIR behaves like a simple string prepend to all
>> package config variable queries.  So if you want to determine the absolute
>> path of a variable in .pc you set PKG_CONFIG_SYSROOT_DIR and make your
>> query.  Currently this is not possible with Yocto+Meson.
>>
>> I think a simple wrapper script would resolve this.  This is from
>> https://autotools.io/pkgconfig/cross-compiling.html:
>>
>> #!/bin/sh
>>
>> SYSROOT=/build/root
>>
>> export PKG_CONFIG_PATH=
>> export PKG_CONFIG_LIBDIR=${SYSROOT}/usr/lib/pkgconfig:${SYSROOT}/usr/share/pkgconfig
>> export PKG_CONFIG_SYSROOT_DIR=${SYSROOT}
>>
>> exec pkg-config "$@"
>>
>>
>> The wrapper script would be generated per recipe via meson.bbclass,
>> meson.cross would then reference this wrapper instead of the pkg-config
>> executable.
>>
>> Thoughts?
>>
>
> I don't think this is correct. Meson's way of doing things is that you are
> not supposed to get the include/library paths directly from pkg-config, but
> rather use
> https://mesonbuild.com/Reference-manual_functions.html#dependency and
> meson will take care of any needed prefixes to the paths.
>
> For the custom variables defined in .pc that happen to contain paths,
> PKG_CONFIG_SYSROOT_DIR has no effect at all, so you need to manually
> prepend it anyway everywhere where they're used. pkg-config does not know
> what variable is a path and what isn't.
>
> Alex
>

[-- Attachment #2: Type: text/html, Size: 5782 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [OE-core] [RFC] meson needs a pkg-config wrapper script
  2021-11-30 18:25   ` Joel Winarske
@ 2021-11-30 18:53     ` Alexander Kanavin
  2021-11-30 19:15       ` Joel Winarske
  0 siblings, 1 reply; 16+ messages in thread
From: Alexander Kanavin @ 2021-11-30 18:53 UTC (permalink / raw)
  To: Joel Winarske; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 4390 bytes --]

I do not quite understand the use case. What is being done with the full
path to the header?

Alex

On Tue, 30 Nov 2021 at 19:26, Joel Winarske <joel.winarske@gmail.com> wrote:

> This pattern works to get the absolute path of the header:
>
> Yocto
>
>     EXTRA_OEMESON += "--prefix ${STAGING_DIR_TARGET}/usr"
>
> Meson
>
>     vulkan_dep = dependency('vulkan')
>     vulkan_hpp = join_paths([
>         vulkan_dep.get_pkgconfig_variable('includedir', define_variable:
> ['prefix', get_option('prefix')]),
>         'vulkan',
>         'vulkan.hpp'
>         ])
>
> Implementation in build/meson-log.txt
>
> Called
> `/b/github-ci/_work/meta-flutter/rpi4-drm-honister-latest/rpi4/tmp/work/cortexa72-poky-linux/vkmark/git-r0/recipe-sysroot-native/usr/bin/pkg-config
> --define-variable=prefix=/b/github-ci/_work/meta-flutter/rpi4-drm-honister-latest/rpi4/tmp/work/cortexa72-poky-linux/vkmark/git-r0/recipe-sysroot/usr
> --variable=includedir vulkan` -> 0
>
>
> One would expect the following meson to work if STAGING_DIR_TARGET were
> set, as that's how pkg-config works:
>
>     vulkan_dep = dependency('vulkan')
>     vulkan_hpp = join_paths([
>         vulkan_dep.get_pkgconfig_variable('includedir'),
>         'vulkan',
>         'vulkan.hpp'
>         ])
>
> This will always return /usr/include/vulkan/vulkan.hpp regardless of
> PKG_CONFIG_SYSROOT_DIR value.  With PKG_CONFIG_SYSROOT_DIR set, it should
> be /usr/include/vulkan/vulkan.hpp with prepend of PKG_CONFIG_SYSROOT_DIR
> value.
>
>
> Sandbox testing of pkg-config
>
>     $ export
> 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 pkg-config
> --define-variable=prefix=/opt --variable=includedir vulkan
>
> /b/github-ci/_work/meta-flutter/rpi4-drm-honister-latest/raspberrypi4-64/tmp/work/cortexa72-poky-linux/vkmark/git-r0/recipe-sysroot/opt/include
>
>
> meson.cross
>
> Setting sys_root in the properties section of meson.cross (patching
> meson.bbclass) indirectly sets PKG_CONFIG_SYSROOT_DIR.  The setting of
> sys_root is present in nativesdk_meson*.bb, not meson*.bb.
>
> The issue for meson is that they are not passing the
> PKG_CONFIG_SYSROOT_DIR variable to the shell that launches pkg-config.
>
> My proposed work around (this email thread) would fix the behavior.  I
> believe the proper fix is for meson to address upstream.  Still waiting on
> a response from them: https://github.com/mesonbuild/meson/issues/9674
>
>
> Joel
>
> On Tue, Nov 30, 2021 at 9:49 AM Alexander Kanavin <alex.kanavin@gmail.com>
> wrote:
>
>> On Tue, 30 Nov 2021 at 18:20, Joel Winarske <joel.winarske@gmail.com>
>> wrote:
>>
>>> Meson does not expose PKG_CONFIG_SYSROOT_DIR to the pkg-config process.
>>>
>>> Currently meson.cross as generated in meson.bbclass points directly to
>>> the pkg-config executable (no wrapper script).
>>>
>>> PKG_CONFIG_SYSROOT_DIR behaves like a simple string prepend to all
>>> package config variable queries.  So if you want to determine the absolute
>>> path of a variable in .pc you set PKG_CONFIG_SYSROOT_DIR and make your
>>> query.  Currently this is not possible with Yocto+Meson.
>>>
>>> I think a simple wrapper script would resolve this.  This is from
>>> https://autotools.io/pkgconfig/cross-compiling.html:
>>>
>>> #!/bin/sh
>>>
>>> SYSROOT=/build/root
>>>
>>> export PKG_CONFIG_PATH=
>>> export PKG_CONFIG_LIBDIR=${SYSROOT}/usr/lib/pkgconfig:${SYSROOT}/usr/share/pkgconfig
>>> export PKG_CONFIG_SYSROOT_DIR=${SYSROOT}
>>>
>>> exec pkg-config "$@"
>>>
>>>
>>> The wrapper script would be generated per recipe via meson.bbclass,
>>> meson.cross would then reference this wrapper instead of the pkg-config
>>> executable.
>>>
>>> Thoughts?
>>>
>>
>> I don't think this is correct. Meson's way of doing things is that you
>> are not supposed to get the include/library paths directly from pkg-config,
>> but rather use
>> https://mesonbuild.com/Reference-manual_functions.html#dependency and
>> meson will take care of any needed prefixes to the paths.
>>
>> For the custom variables defined in .pc that happen to contain paths,
>> PKG_CONFIG_SYSROOT_DIR has no effect at all, so you need to manually
>> prepend it anyway everywhere where they're used. pkg-config does not know
>> what variable is a path and what isn't.
>>
>> Alex
>>
>

[-- Attachment #2: Type: text/html, Size: 6314 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [OE-core] [RFC] meson needs a pkg-config wrapper script
  2021-11-30 18:53     ` Alexander Kanavin
@ 2021-11-30 19:15       ` Joel Winarske
  2021-11-30 19:39         ` Alexander Kanavin
  0 siblings, 1 reply; 16+ messages in thread
From: Joel Winarske @ 2021-11-30 19:15 UTC (permalink / raw)
  To: Alexander Kanavin; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 4669 bytes --]

https://github.com/vkmark/vkmark/blob/master/src/meson.build#L9

On Tue, Nov 30, 2021 at 10:53 AM Alexander Kanavin <alex.kanavin@gmail.com>
wrote:

> I do not quite understand the use case. What is being done with the full
> path to the header?
>
> Alex
>
> On Tue, 30 Nov 2021 at 19:26, Joel Winarske <joel.winarske@gmail.com>
> wrote:
>
>> This pattern works to get the absolute path of the header:
>>
>> Yocto
>>
>>     EXTRA_OEMESON += "--prefix ${STAGING_DIR_TARGET}/usr"
>>
>> Meson
>>
>>     vulkan_dep = dependency('vulkan')
>>     vulkan_hpp = join_paths([
>>         vulkan_dep.get_pkgconfig_variable('includedir', define_variable:
>> ['prefix', get_option('prefix')]),
>>         'vulkan',
>>         'vulkan.hpp'
>>         ])
>>
>> Implementation in build/meson-log.txt
>>
>> Called
>> `/b/github-ci/_work/meta-flutter/rpi4-drm-honister-latest/rpi4/tmp/work/cortexa72-poky-linux/vkmark/git-r0/recipe-sysroot-native/usr/bin/pkg-config
>> --define-variable=prefix=/b/github-ci/_work/meta-flutter/rpi4-drm-honister-latest/rpi4/tmp/work/cortexa72-poky-linux/vkmark/git-r0/recipe-sysroot/usr
>> --variable=includedir vulkan` -> 0
>>
>>
>> One would expect the following meson to work if STAGING_DIR_TARGET were
>> set, as that's how pkg-config works:
>>
>>     vulkan_dep = dependency('vulkan')
>>     vulkan_hpp = join_paths([
>>         vulkan_dep.get_pkgconfig_variable('includedir'),
>>         'vulkan',
>>         'vulkan.hpp'
>>         ])
>>
>> This will always return /usr/include/vulkan/vulkan.hpp regardless of
>> PKG_CONFIG_SYSROOT_DIR value.  With PKG_CONFIG_SYSROOT_DIR set, it should
>> be /usr/include/vulkan/vulkan.hpp with prepend of PKG_CONFIG_SYSROOT_DIR
>> value.
>>
>>
>> Sandbox testing of pkg-config
>>
>>     $ export
>> 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 pkg-config
>> --define-variable=prefix=/opt --variable=includedir vulkan
>>
>> /b/github-ci/_work/meta-flutter/rpi4-drm-honister-latest/raspberrypi4-64/tmp/work/cortexa72-poky-linux/vkmark/git-r0/recipe-sysroot/opt/include
>>
>>
>> meson.cross
>>
>> Setting sys_root in the properties section of meson.cross (patching
>> meson.bbclass) indirectly sets PKG_CONFIG_SYSROOT_DIR.  The setting of
>> sys_root is present in nativesdk_meson*.bb, not meson*.bb.
>>
>> The issue for meson is that they are not passing the
>> PKG_CONFIG_SYSROOT_DIR variable to the shell that launches pkg-config.
>>
>> My proposed work around (this email thread) would fix the behavior.  I
>> believe the proper fix is for meson to address upstream.  Still waiting on
>> a response from them: https://github.com/mesonbuild/meson/issues/9674
>>
>>
>> Joel
>>
>> On Tue, Nov 30, 2021 at 9:49 AM Alexander Kanavin <alex.kanavin@gmail.com>
>> wrote:
>>
>>> On Tue, 30 Nov 2021 at 18:20, Joel Winarske <joel.winarske@gmail.com>
>>> wrote:
>>>
>>>> Meson does not expose PKG_CONFIG_SYSROOT_DIR to the pkg-config process.
>>>>
>>>> Currently meson.cross as generated in meson.bbclass points directly to
>>>> the pkg-config executable (no wrapper script).
>>>>
>>>> PKG_CONFIG_SYSROOT_DIR behaves like a simple string prepend to all
>>>> package config variable queries.  So if you want to determine the absolute
>>>> path of a variable in .pc you set PKG_CONFIG_SYSROOT_DIR and make your
>>>> query.  Currently this is not possible with Yocto+Meson.
>>>>
>>>> I think a simple wrapper script would resolve this.  This is from
>>>> https://autotools.io/pkgconfig/cross-compiling.html:
>>>>
>>>> #!/bin/sh
>>>>
>>>> SYSROOT=/build/root
>>>>
>>>> export PKG_CONFIG_PATH=
>>>> export PKG_CONFIG_LIBDIR=${SYSROOT}/usr/lib/pkgconfig:${SYSROOT}/usr/share/pkgconfig
>>>> export PKG_CONFIG_SYSROOT_DIR=${SYSROOT}
>>>>
>>>> exec pkg-config "$@"
>>>>
>>>>
>>>> The wrapper script would be generated per recipe via meson.bbclass,
>>>> meson.cross would then reference this wrapper instead of the pkg-config
>>>> executable.
>>>>
>>>> Thoughts?
>>>>
>>>
>>> I don't think this is correct. Meson's way of doing things is that you
>>> are not supposed to get the include/library paths directly from pkg-config,
>>> but rather use
>>> https://mesonbuild.com/Reference-manual_functions.html#dependency and
>>> meson will take care of any needed prefixes to the paths.
>>>
>>> For the custom variables defined in .pc that happen to contain paths,
>>> PKG_CONFIG_SYSROOT_DIR has no effect at all, so you need to manually
>>> prepend it anyway everywhere where they're used. pkg-config does not know
>>> what variable is a path and what isn't.
>>>
>>> Alex
>>>
>>

[-- Attachment #2: Type: text/html, Size: 6850 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [OE-core] [RFC] meson needs a pkg-config wrapper script
  2021-11-30 19:15       ` Joel Winarske
@ 2021-11-30 19:39         ` Alexander Kanavin
  2021-11-30 20:00           ` Joel Winarske
  0 siblings, 1 reply; 16+ messages in thread
From: Alexander Kanavin @ 2021-11-30 19:39 UTC (permalink / raw)
  To: Joel Winarske; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 5180 bytes --]

I am seeing in mesonbuild/dependencies/pkgconfig.py

        sysroot = environment.properties[for_machine].get_sys_root()
        if sysroot:
            env['PKG_CONFIG_SYSROOT_DIR'] = sysroo

So we probably need to ensure this 'sys_root' is correctly set, and then
things will simply work?

Alex

On Tue, 30 Nov 2021 at 20:15, Joel Winarske <joel.winarske@gmail.com> wrote:

> https://github.com/vkmark/vkmark/blob/master/src/meson.build#L9
>
> On Tue, Nov 30, 2021 at 10:53 AM Alexander Kanavin <alex.kanavin@gmail.com>
> wrote:
>
>> I do not quite understand the use case. What is being done with the full
>> path to the header?
>>
>> Alex
>>
>> On Tue, 30 Nov 2021 at 19:26, Joel Winarske <joel.winarske@gmail.com>
>> wrote:
>>
>>> This pattern works to get the absolute path of the header:
>>>
>>> Yocto
>>>
>>>     EXTRA_OEMESON += "--prefix ${STAGING_DIR_TARGET}/usr"
>>>
>>> Meson
>>>
>>>     vulkan_dep = dependency('vulkan')
>>>     vulkan_hpp = join_paths([
>>>         vulkan_dep.get_pkgconfig_variable('includedir', define_variable:
>>> ['prefix', get_option('prefix')]),
>>>         'vulkan',
>>>         'vulkan.hpp'
>>>         ])
>>>
>>> Implementation in build/meson-log.txt
>>>
>>> Called
>>> `/b/github-ci/_work/meta-flutter/rpi4-drm-honister-latest/rpi4/tmp/work/cortexa72-poky-linux/vkmark/git-r0/recipe-sysroot-native/usr/bin/pkg-config
>>> --define-variable=prefix=/b/github-ci/_work/meta-flutter/rpi4-drm-honister-latest/rpi4/tmp/work/cortexa72-poky-linux/vkmark/git-r0/recipe-sysroot/usr
>>> --variable=includedir vulkan` -> 0
>>>
>>>
>>> One would expect the following meson to work if STAGING_DIR_TARGET were
>>> set, as that's how pkg-config works:
>>>
>>>     vulkan_dep = dependency('vulkan')
>>>     vulkan_hpp = join_paths([
>>>         vulkan_dep.get_pkgconfig_variable('includedir'),
>>>         'vulkan',
>>>         'vulkan.hpp'
>>>         ])
>>>
>>> This will always return /usr/include/vulkan/vulkan.hpp regardless of
>>> PKG_CONFIG_SYSROOT_DIR value.  With PKG_CONFIG_SYSROOT_DIR set, it should
>>> be /usr/include/vulkan/vulkan.hpp with prepend of PKG_CONFIG_SYSROOT_DIR
>>> value.
>>>
>>>
>>> Sandbox testing of pkg-config
>>>
>>>     $ export
>>> 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 pkg-config
>>> --define-variable=prefix=/opt --variable=includedir vulkan
>>>
>>> /b/github-ci/_work/meta-flutter/rpi4-drm-honister-latest/raspberrypi4-64/tmp/work/cortexa72-poky-linux/vkmark/git-r0/recipe-sysroot/opt/include
>>>
>>>
>>> meson.cross
>>>
>>> Setting sys_root in the properties section of meson.cross (patching
>>> meson.bbclass) indirectly sets PKG_CONFIG_SYSROOT_DIR.  The setting of
>>> sys_root is present in nativesdk_meson*.bb, not meson*.bb.
>>>
>>> The issue for meson is that they are not passing the
>>> PKG_CONFIG_SYSROOT_DIR variable to the shell that launches pkg-config.
>>>
>>> My proposed work around (this email thread) would fix the behavior.  I
>>> believe the proper fix is for meson to address upstream.  Still waiting on
>>> a response from them: https://github.com/mesonbuild/meson/issues/9674
>>>
>>>
>>> Joel
>>>
>>> On Tue, Nov 30, 2021 at 9:49 AM Alexander Kanavin <
>>> alex.kanavin@gmail.com> wrote:
>>>
>>>> On Tue, 30 Nov 2021 at 18:20, Joel Winarske <joel.winarske@gmail.com>
>>>> wrote:
>>>>
>>>>> Meson does not expose PKG_CONFIG_SYSROOT_DIR to the pkg-config process.
>>>>>
>>>>> Currently meson.cross as generated in meson.bbclass points directly to
>>>>> the pkg-config executable (no wrapper script).
>>>>>
>>>>> PKG_CONFIG_SYSROOT_DIR behaves like a simple string prepend to all
>>>>> package config variable queries.  So if you want to determine the absolute
>>>>> path of a variable in .pc you set PKG_CONFIG_SYSROOT_DIR and make your
>>>>> query.  Currently this is not possible with Yocto+Meson.
>>>>>
>>>>> I think a simple wrapper script would resolve this.  This is from
>>>>> https://autotools.io/pkgconfig/cross-compiling.html:
>>>>>
>>>>> #!/bin/sh
>>>>>
>>>>> SYSROOT=/build/root
>>>>>
>>>>> export PKG_CONFIG_PATH=
>>>>> export PKG_CONFIG_LIBDIR=${SYSROOT}/usr/lib/pkgconfig:${SYSROOT}/usr/share/pkgconfig
>>>>> export PKG_CONFIG_SYSROOT_DIR=${SYSROOT}
>>>>>
>>>>> exec pkg-config "$@"
>>>>>
>>>>>
>>>>> The wrapper script would be generated per recipe via meson.bbclass,
>>>>> meson.cross would then reference this wrapper instead of the pkg-config
>>>>> executable.
>>>>>
>>>>> Thoughts?
>>>>>
>>>>
>>>> I don't think this is correct. Meson's way of doing things is that you
>>>> are not supposed to get the include/library paths directly from pkg-config,
>>>> but rather use
>>>> https://mesonbuild.com/Reference-manual_functions.html#dependency and
>>>> meson will take care of any needed prefixes to the paths.
>>>>
>>>> For the custom variables defined in .pc that happen to contain paths,
>>>> PKG_CONFIG_SYSROOT_DIR has no effect at all, so you need to manually
>>>> prepend it anyway everywhere where they're used. pkg-config does not know
>>>> what variable is a path and what isn't.
>>>>
>>>> Alex
>>>>
>>>

[-- Attachment #2: Type: text/html, Size: 7680 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [OE-core] [RFC] meson needs a pkg-config wrapper script
  2021-11-30 19:39         ` Alexander Kanavin
@ 2021-11-30 20:00           ` Joel Winarske
  2021-11-30 20:03             ` Joel Winarske
  2021-11-30 20:13             ` Alexander Kanavin
  0 siblings, 2 replies; 16+ messages in thread
From: Joel Winarske @ 2021-11-30 20:00 UTC (permalink / raw)
  To: Alexander Kanavin; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 5814 bytes --]

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.


On Tue, Nov 30, 2021 at 11:40 AM Alexander Kanavin <alex.kanavin@gmail.com>
wrote:

> I am seeing in mesonbuild/dependencies/pkgconfig.py
>
>         sysroot = environment.properties[for_machine].get_sys_root()
>         if sysroot:
>             env['PKG_CONFIG_SYSROOT_DIR'] = sysroo
>
> So we probably need to ensure this 'sys_root' is correctly set, and then
> things will simply work?
>
> Alex
>
> On Tue, 30 Nov 2021 at 20:15, Joel Winarske <joel.winarske@gmail.com>
> wrote:
>
>> https://github.com/vkmark/vkmark/blob/master/src/meson.build#L9
>>
>> On Tue, Nov 30, 2021 at 10:53 AM Alexander Kanavin <
>> alex.kanavin@gmail.com> wrote:
>>
>>> I do not quite understand the use case. What is being done with the full
>>> path to the header?
>>>
>>> Alex
>>>
>>> On Tue, 30 Nov 2021 at 19:26, Joel Winarske <joel.winarske@gmail.com>
>>> wrote:
>>>
>>>> This pattern works to get the absolute path of the header:
>>>>
>>>> Yocto
>>>>
>>>>     EXTRA_OEMESON += "--prefix ${STAGING_DIR_TARGET}/usr"
>>>>
>>>> Meson
>>>>
>>>>     vulkan_dep = dependency('vulkan')
>>>>     vulkan_hpp = join_paths([
>>>>         vulkan_dep.get_pkgconfig_variable('includedir',
>>>> define_variable: ['prefix', get_option('prefix')]),
>>>>         'vulkan',
>>>>         'vulkan.hpp'
>>>>         ])
>>>>
>>>> Implementation in build/meson-log.txt
>>>>
>>>> Called
>>>> `/b/github-ci/_work/meta-flutter/rpi4-drm-honister-latest/rpi4/tmp/work/cortexa72-poky-linux/vkmark/git-r0/recipe-sysroot-native/usr/bin/pkg-config
>>>> --define-variable=prefix=/b/github-ci/_work/meta-flutter/rpi4-drm-honister-latest/rpi4/tmp/work/cortexa72-poky-linux/vkmark/git-r0/recipe-sysroot/usr
>>>> --variable=includedir vulkan` -> 0
>>>>
>>>>
>>>> One would expect the following meson to work if STAGING_DIR_TARGET were
>>>> set, as that's how pkg-config works:
>>>>
>>>>     vulkan_dep = dependency('vulkan')
>>>>     vulkan_hpp = join_paths([
>>>>         vulkan_dep.get_pkgconfig_variable('includedir'),
>>>>         'vulkan',
>>>>         'vulkan.hpp'
>>>>         ])
>>>>
>>>> This will always return /usr/include/vulkan/vulkan.hpp regardless of
>>>> PKG_CONFIG_SYSROOT_DIR value.  With PKG_CONFIG_SYSROOT_DIR set, it should
>>>> be /usr/include/vulkan/vulkan.hpp with prepend of PKG_CONFIG_SYSROOT_DIR
>>>> value.
>>>>
>>>>
>>>> Sandbox testing of pkg-config
>>>>
>>>>     $ export
>>>> 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 pkg-config
>>>> --define-variable=prefix=/opt --variable=includedir vulkan
>>>>
>>>> /b/github-ci/_work/meta-flutter/rpi4-drm-honister-latest/raspberrypi4-64/tmp/work/cortexa72-poky-linux/vkmark/git-r0/recipe-sysroot/opt/include
>>>>
>>>>
>>>> meson.cross
>>>>
>>>> Setting sys_root in the properties section of meson.cross (patching
>>>> meson.bbclass) indirectly sets PKG_CONFIG_SYSROOT_DIR.  The setting of
>>>> sys_root is present in nativesdk_meson*.bb, not meson*.bb.
>>>>
>>>> The issue for meson is that they are not passing the
>>>> PKG_CONFIG_SYSROOT_DIR variable to the shell that launches pkg-config.
>>>>
>>>> My proposed work around (this email thread) would fix the behavior.  I
>>>> believe the proper fix is for meson to address upstream.  Still waiting on
>>>> a response from them: https://github.com/mesonbuild/meson/issues/9674
>>>>
>>>>
>>>> Joel
>>>>
>>>> On Tue, Nov 30, 2021 at 9:49 AM Alexander Kanavin <
>>>> alex.kanavin@gmail.com> wrote:
>>>>
>>>>> On Tue, 30 Nov 2021 at 18:20, Joel Winarske <joel.winarske@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Meson does not expose PKG_CONFIG_SYSROOT_DIR to the pkg-config
>>>>>> process.
>>>>>>
>>>>>> Currently meson.cross as generated in meson.bbclass points directly
>>>>>> to the pkg-config executable (no wrapper script).
>>>>>>
>>>>>> PKG_CONFIG_SYSROOT_DIR behaves like a simple string prepend to all
>>>>>> package config variable queries.  So if you want to determine the absolute
>>>>>> path of a variable in .pc you set PKG_CONFIG_SYSROOT_DIR and make your
>>>>>> query.  Currently this is not possible with Yocto+Meson.
>>>>>>
>>>>>> I think a simple wrapper script would resolve this.  This is from
>>>>>> https://autotools.io/pkgconfig/cross-compiling.html:
>>>>>>
>>>>>> #!/bin/sh
>>>>>>
>>>>>> SYSROOT=/build/root
>>>>>>
>>>>>> export PKG_CONFIG_PATH=
>>>>>> export PKG_CONFIG_LIBDIR=${SYSROOT}/usr/lib/pkgconfig:${SYSROOT}/usr/share/pkgconfig
>>>>>> export PKG_CONFIG_SYSROOT_DIR=${SYSROOT}
>>>>>>
>>>>>> exec pkg-config "$@"
>>>>>>
>>>>>>
>>>>>> The wrapper script would be generated per recipe via meson.bbclass,
>>>>>> meson.cross would then reference this wrapper instead of the pkg-config
>>>>>> executable.
>>>>>>
>>>>>> Thoughts?
>>>>>>
>>>>>
>>>>> I don't think this is correct. Meson's way of doing things is that you
>>>>> are not supposed to get the include/library paths directly from pkg-config,
>>>>> but rather use
>>>>> https://mesonbuild.com/Reference-manual_functions.html#dependency and
>>>>> meson will take care of any needed prefixes to the paths.
>>>>>
>>>>> For the custom variables defined in .pc that happen to contain paths,
>>>>> PKG_CONFIG_SYSROOT_DIR has no effect at all, so you need to manually
>>>>> prepend it anyway everywhere where they're used. pkg-config does not know
>>>>> what variable is a path and what isn't.
>>>>>
>>>>> Alex
>>>>>
>>>>

[-- Attachment #2: Type: text/html, Size: 8620 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [OE-core] [RFC] meson needs a pkg-config wrapper script
  2021-11-30 20:00           ` Joel Winarske
@ 2021-11-30 20:03             ` Joel Winarske
  2021-11-30 20:13             ` Alexander Kanavin
  1 sibling, 0 replies; 16+ messages in thread
From: Joel Winarske @ 2021-11-30 20:03 UTC (permalink / raw)
  To: Alexander Kanavin; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 6163 bytes --]

Also all of the above requires this change:
https://github.com/KhronosGroup/Vulkan-Loader/pull/756


On Tue, Nov 30, 2021 at 12:00 PM Joel Winarske <joel.winarske@gmail.com>
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.
>
>
> On Tue, Nov 30, 2021 at 11:40 AM Alexander Kanavin <alex.kanavin@gmail.com>
> wrote:
>
>> I am seeing in mesonbuild/dependencies/pkgconfig.py
>>
>>         sysroot = environment.properties[for_machine].get_sys_root()
>>         if sysroot:
>>             env['PKG_CONFIG_SYSROOT_DIR'] = sysroo
>>
>> So we probably need to ensure this 'sys_root' is correctly set, and then
>> things will simply work?
>>
>> Alex
>>
>> On Tue, 30 Nov 2021 at 20:15, Joel Winarske <joel.winarske@gmail.com>
>> wrote:
>>
>>> https://github.com/vkmark/vkmark/blob/master/src/meson.build#L9
>>>
>>> On Tue, Nov 30, 2021 at 10:53 AM Alexander Kanavin <
>>> alex.kanavin@gmail.com> wrote:
>>>
>>>> I do not quite understand the use case. What is being done with the
>>>> full path to the header?
>>>>
>>>> Alex
>>>>
>>>> On Tue, 30 Nov 2021 at 19:26, Joel Winarske <joel.winarske@gmail.com>
>>>> wrote:
>>>>
>>>>> This pattern works to get the absolute path of the header:
>>>>>
>>>>> Yocto
>>>>>
>>>>>     EXTRA_OEMESON += "--prefix ${STAGING_DIR_TARGET}/usr"
>>>>>
>>>>> Meson
>>>>>
>>>>>     vulkan_dep = dependency('vulkan')
>>>>>     vulkan_hpp = join_paths([
>>>>>         vulkan_dep.get_pkgconfig_variable('includedir',
>>>>> define_variable: ['prefix', get_option('prefix')]),
>>>>>         'vulkan',
>>>>>         'vulkan.hpp'
>>>>>         ])
>>>>>
>>>>> Implementation in build/meson-log.txt
>>>>>
>>>>> Called
>>>>> `/b/github-ci/_work/meta-flutter/rpi4-drm-honister-latest/rpi4/tmp/work/cortexa72-poky-linux/vkmark/git-r0/recipe-sysroot-native/usr/bin/pkg-config
>>>>> --define-variable=prefix=/b/github-ci/_work/meta-flutter/rpi4-drm-honister-latest/rpi4/tmp/work/cortexa72-poky-linux/vkmark/git-r0/recipe-sysroot/usr
>>>>> --variable=includedir vulkan` -> 0
>>>>>
>>>>>
>>>>> One would expect the following meson to work if STAGING_DIR_TARGET
>>>>> were set, as that's how pkg-config works:
>>>>>
>>>>>     vulkan_dep = dependency('vulkan')
>>>>>     vulkan_hpp = join_paths([
>>>>>         vulkan_dep.get_pkgconfig_variable('includedir'),
>>>>>         'vulkan',
>>>>>         'vulkan.hpp'
>>>>>         ])
>>>>>
>>>>> This will always return /usr/include/vulkan/vulkan.hpp regardless of
>>>>> PKG_CONFIG_SYSROOT_DIR value.  With PKG_CONFIG_SYSROOT_DIR set, it should
>>>>> be /usr/include/vulkan/vulkan.hpp with prepend of PKG_CONFIG_SYSROOT_DIR
>>>>> value.
>>>>>
>>>>>
>>>>> Sandbox testing of pkg-config
>>>>>
>>>>>     $ export
>>>>> 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 pkg-config
>>>>> --define-variable=prefix=/opt --variable=includedir vulkan
>>>>>
>>>>> /b/github-ci/_work/meta-flutter/rpi4-drm-honister-latest/raspberrypi4-64/tmp/work/cortexa72-poky-linux/vkmark/git-r0/recipe-sysroot/opt/include
>>>>>
>>>>>
>>>>> meson.cross
>>>>>
>>>>> Setting sys_root in the properties section of meson.cross (patching
>>>>> meson.bbclass) indirectly sets PKG_CONFIG_SYSROOT_DIR.  The setting of
>>>>> sys_root is present in nativesdk_meson*.bb, not meson*.bb.
>>>>>
>>>>> The issue for meson is that they are not passing the
>>>>> PKG_CONFIG_SYSROOT_DIR variable to the shell that launches pkg-config.
>>>>>
>>>>> My proposed work around (this email thread) would fix the behavior.  I
>>>>> believe the proper fix is for meson to address upstream.  Still waiting on
>>>>> a response from them: https://github.com/mesonbuild/meson/issues/9674
>>>>>
>>>>>
>>>>> Joel
>>>>>
>>>>> On Tue, Nov 30, 2021 at 9:49 AM Alexander Kanavin <
>>>>> alex.kanavin@gmail.com> wrote:
>>>>>
>>>>>> On Tue, 30 Nov 2021 at 18:20, Joel Winarske <joel.winarske@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> Meson does not expose PKG_CONFIG_SYSROOT_DIR to the pkg-config
>>>>>>> process.
>>>>>>>
>>>>>>> Currently meson.cross as generated in meson.bbclass points directly
>>>>>>> to the pkg-config executable (no wrapper script).
>>>>>>>
>>>>>>> PKG_CONFIG_SYSROOT_DIR behaves like a simple string prepend to all
>>>>>>> package config variable queries.  So if you want to determine the absolute
>>>>>>> path of a variable in .pc you set PKG_CONFIG_SYSROOT_DIR and make your
>>>>>>> query.  Currently this is not possible with Yocto+Meson.
>>>>>>>
>>>>>>> I think a simple wrapper script would resolve this.  This is from
>>>>>>> https://autotools.io/pkgconfig/cross-compiling.html:
>>>>>>>
>>>>>>> #!/bin/sh
>>>>>>>
>>>>>>> SYSROOT=/build/root
>>>>>>>
>>>>>>> export PKG_CONFIG_PATH=
>>>>>>> export PKG_CONFIG_LIBDIR=${SYSROOT}/usr/lib/pkgconfig:${SYSROOT}/usr/share/pkgconfig
>>>>>>> export PKG_CONFIG_SYSROOT_DIR=${SYSROOT}
>>>>>>>
>>>>>>> exec pkg-config "$@"
>>>>>>>
>>>>>>>
>>>>>>> The wrapper script would be generated per recipe via meson.bbclass,
>>>>>>> meson.cross would then reference this wrapper instead of the pkg-config
>>>>>>> executable.
>>>>>>>
>>>>>>> Thoughts?
>>>>>>>
>>>>>>
>>>>>> I don't think this is correct. Meson's way of doing things is that
>>>>>> you are not supposed to get the include/library paths directly from
>>>>>> pkg-config, but rather use
>>>>>> https://mesonbuild.com/Reference-manual_functions.html#dependency
>>>>>> and meson will take care of any needed prefixes to the paths.
>>>>>>
>>>>>> For the custom variables defined in .pc that happen to contain paths,
>>>>>> PKG_CONFIG_SYSROOT_DIR has no effect at all, so you need to manually
>>>>>> prepend it anyway everywhere where they're used. pkg-config does not know
>>>>>> what variable is a path and what isn't.
>>>>>>
>>>>>> Alex
>>>>>>
>>>>>

[-- Attachment #2: Type: text/html, Size: 9211 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [OE-core] [RFC] meson needs a pkg-config wrapper script
  2021-11-30 20:00           ` Joel Winarske
  2021-11-30 20:03             ` Joel Winarske
@ 2021-11-30 20:13             ` Alexander Kanavin
  2021-11-30 22:37               ` Joel Winarske
  1 sibling, 1 reply; 16+ messages in thread
From: Alexander Kanavin @ 2021-11-30 20:13 UTC (permalink / raw)
  To: Joel Winarske; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 751 bytes --]

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 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

[-- Attachment #2: Type: text/html, Size: 1398 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [OE-core] [RFC] meson needs a pkg-config wrapper script
  2021-11-30 17:20 [RFC] meson needs a pkg-config wrapper script Joel Winarske
  2021-11-30 17:49 ` [OE-core] " Alexander Kanavin
@ 2021-11-30 21:18 ` Ross Burton
  1 sibling, 0 replies; 16+ messages in thread
From: Ross Burton @ 2021-11-30 21:18 UTC (permalink / raw)
  To: Joel Winarske; +Cc: openembedded-core

On Tue, 30 Nov 2021 at 17:20, Joel Winarske <joel.winarske@gmail.com> wrote:
> PKG_CONFIG_SYSROOT_DIR behaves like a simple string prepend to all package config variable queries.  So if you want to determine the absolute path of a variable in .pc you set PKG_CONFIG_SYSROOT_DIR and make your query.  Currently this is not possible with Yocto+Meson.

I should just point out that this is barely possible in a portable
manner: pkgconfig and pkgconf have differing behaviour here, and they
both consider their behaviour correct.

So, good luck with getting absolute paths of variables when sysroots
are involved.

Ross


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [OE-core] [RFC] meson needs a pkg-config wrapper script
  2021-11-30 20:13             ` Alexander Kanavin
@ 2021-11-30 22:37               ` Joel Winarske
  2021-12-01  8:36                 ` Alexander Kanavin
  0 siblings, 1 reply; 16+ messages in thread
From: Joel Winarske @ 2021-11-30 22:37 UTC (permalink / raw)
  To: Alexander Kanavin; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 1951 bytes --]

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 <joel.winarske@gmail.com>
> 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
>
>

[-- Attachment #2: Type: text/html, Size: 3184 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [OE-core] [RFC] meson needs a pkg-config wrapper script
  2021-11-30 22:37               ` Joel Winarske
@ 2021-12-01  8:36                 ` Alexander Kanavin
  2021-12-01  9:11                   ` Eero Aaltonen
       [not found]                   ` <CABKMkPJ+6xA9BtZsv-tcKKssJdhfjA4w7eSxJzNyBOg4Ak2=gw@mail.gmail.com>
  0 siblings, 2 replies; 16+ messages in thread
From: Alexander Kanavin @ 2021-12-01  8:36 UTC (permalink / raw)
  To: Joel Winarske; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 2792 bytes --]

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 <joel.winarske@gmail.com> 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 <joel.winarske@gmail.com>
>> 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
>>
>>

[-- Attachment #2: Type: text/html, Size: 4384 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [OE-core] [RFC] meson needs a pkg-config wrapper script
  2021-12-01  8:36                 ` Alexander Kanavin
@ 2021-12-01  9:11                   ` Eero Aaltonen
       [not found]                   ` <CABKMkPJ+6xA9BtZsv-tcKKssJdhfjA4w7eSxJzNyBOg4Ak2=gw@mail.gmail.com>
  1 sibling, 0 replies; 16+ messages in thread
From: Eero Aaltonen @ 2021-12-01  9:11 UTC (permalink / raw)
  To: alex.kanavin, Joel Winarske; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 3738 bytes --]

You can use `${pcfiledir}/../..` within a pkg-config file to reference
the install path.
Unfortunately the last time I tried it when cross-compiling, the
PKG_CONFIG_SYSROOT_DIR was ended up in the path as a duplicate.

-Eero

On Wed, 2021-12-01 at 09:36 +0100, Alexander Kanavin via
lists.openembedded.org 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 <joel.winarske@gmail.com>
> 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 <
> > > joel.winarske@gmail.com> 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
> > > 
> > > 
> 
> -=-=-=-=-=-=-=-=-=-=-=-Links: You receive all messages sent to this
> group.View/Reply Online (#159019): 
> https://lists.openembedded.org/g/openembedded-core/message/159019Mute
>  This Topic: https://lists.openembedded.org/mt/87407703/6584069Group
> Owner: openembedded-core+owner@lists.openembedded.orgUnsubscribe: ht
> tps://lists.openembedded.org/g/openembedded-core/unsub
> [eero.aaltonen@vaisala.com]-=-=-=-=-=-=-=-=-=-=-=-
> 
> 

[-- Attachment #2: Type: text/html, Size: 6223 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [OE-core] [RFC] meson needs a pkg-config wrapper script
       [not found]                   ` <CABKMkPJ+6xA9BtZsv-tcKKssJdhfjA4w7eSxJzNyBOg4Ak2=gw@mail.gmail.com>
@ 2021-12-01 22:38                     ` Alexander Kanavin
  2021-12-01 23:27                       ` Joel Winarske
       [not found]                       ` <16BCC5463709ABBF.10763@lists.openembedded.org>
  0 siblings, 2 replies; 16+ messages in thread
From: Alexander Kanavin @ 2021-12-01 22:38 UTC (permalink / raw)
  To: Joel Winarske; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 4395 bytes --]

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 <joel.winarske@gmail.com> 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 <alex.kanavin@gmail.com>
> 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 <joel.winarske@gmail.com>
>> 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 <joel.winarske@gmail.com>
>>>> 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
>>>>
>>>>

[-- Attachment #2: Type: text/html, Size: 6828 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [OE-core] [RFC] meson needs a pkg-config wrapper script
  2021-12-01 22:38                     ` Alexander Kanavin
@ 2021-12-01 23:27                       ` Joel Winarske
       [not found]                       ` <16BCC5463709ABBF.10763@lists.openembedded.org>
  1 sibling, 0 replies; 16+ messages in thread
From: Joel Winarske @ 2021-12-01 23:27 UTC (permalink / raw)
  To: Alexander Kanavin; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 4871 bytes --]

Forgot the reply all, not intentional :)

Looks like the build is using the pkgconfig flavor:
meta/recipes-devtools/pkgconfig/pkgconfig_git.bb

Perhaps I just need a PREFERRED_PROVIDER_pkgconfig ?= "pkg-config" and
pkg-config recipe, then perhaps it will just work.

On Wed, Dec 1, 2021 at 2:39 PM Alexander Kanavin <alex.kanavin@gmail.com>
wrote:

> 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 <joel.winarske@gmail.com>
> 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 <alex.kanavin@gmail.com>
>> 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 <joel.winarske@gmail.com>
>>> 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 <joel.winarske@gmail.com>
>>>>> 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
>>>>>
>>>>>

[-- Attachment #2: Type: text/html, Size: 7610 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [OE-core] [RFC] meson needs a pkg-config wrapper script
       [not found]                       ` <16BCC5463709ABBF.10763@lists.openembedded.org>
@ 2021-12-01 23:56                         ` Joel Winarske
  0 siblings, 0 replies; 16+ messages in thread
From: Joel Winarske @ 2021-12-01 23:56 UTC (permalink / raw)
  To: Alexander Kanavin, OE-core

[-- Attachment #1: Type: text/plain, Size: 5694 bytes --]

Actually the recipe pkgconfig_git.bb points to the freedesktop pkg-config
repo, which is used by default.

On Wed, Dec 1, 2021 at 3:27 PM Joel Winarske via lists.openembedded.org
<joel.winarske=gmail.com@lists.openembedded.org> wrote:

> Forgot the reply all, not intentional :)
>
> Looks like the build is using the pkgconfig flavor:
> meta/recipes-devtools/pkgconfig/pkgconfig_git.bb
>
> Perhaps I just need a PREFERRED_PROVIDER_pkgconfig ?= "pkg-config" and
> pkg-config recipe, then perhaps it will just work.
>
> On Wed, Dec 1, 2021 at 2:39 PM Alexander Kanavin <alex.kanavin@gmail.com>
> wrote:
>
>> 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 <joel.winarske@gmail.com>
>> 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 <
>>> alex.kanavin@gmail.com> 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 <joel.winarske@gmail.com>
>>>> 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 <joel.winarske@gmail.com>
>>>>>> 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
>>>>>>
>>>>>>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#159068):
> https://lists.openembedded.org/g/openembedded-core/message/159068
> Mute This Topic: https://lists.openembedded.org/mt/87407703/2167248
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> joel.winarske@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>

[-- Attachment #2: Type: text/html, Size: 9226 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2021-12-01 23:57 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-30 17:20 [RFC] meson needs a pkg-config wrapper script Joel Winarske
2021-11-30 17:49 ` [OE-core] " Alexander Kanavin
2021-11-30 18:25   ` Joel Winarske
2021-11-30 18:53     ` Alexander Kanavin
2021-11-30 19:15       ` Joel Winarske
2021-11-30 19:39         ` Alexander Kanavin
2021-11-30 20:00           ` Joel Winarske
2021-11-30 20:03             ` Joel Winarske
2021-11-30 20:13             ` Alexander Kanavin
2021-11-30 22:37               ` Joel Winarske
2021-12-01  8:36                 ` Alexander Kanavin
2021-12-01  9:11                   ` Eero Aaltonen
     [not found]                   ` <CABKMkPJ+6xA9BtZsv-tcKKssJdhfjA4w7eSxJzNyBOg4Ak2=gw@mail.gmail.com>
2021-12-01 22:38                     ` Alexander Kanavin
2021-12-01 23:27                       ` Joel Winarske
     [not found]                       ` <16BCC5463709ABBF.10763@lists.openembedded.org>
2021-12-01 23:56                         ` Joel Winarske
2021-11-30 21:18 ` Ross Burton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.