On Tue, 30 Nov 2021 at 18:20, Joel Winarske <[email protected]> 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
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#158985): 
https://lists.openembedded.org/g/openembedded-core/message/158985
Mute This Topic: https://lists.openembedded.org/mt/87407703/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to