[Buildroot] [PATCH 1/1] package/gobject-introspection: fix host version of .pc file for wrapper

James Hilliard james.hilliard1 at gmail.com
Sun May 3 11:56:40 UTC 2020


On Sun, May 3, 2020 at 5:48 AM Thomas Petazzoni
<thomas.petazzoni at bootlin.com> wrote:
>
> Hello James,
>
> On Sat, 2 May 2020 13:36:04 -0600
> James Hilliard <james.hilliard1 at gmail.com> wrote:
>
> > > > +define HOST_GOBJECT_INTROSPECTION_INSTALL_WRAPPERS
> > > > +     # Set prefix to /usr because pkg-config appends the sysroot directory
> > > > +     $(SED) "s%^prefix=.*%prefix=\/usr%g" \
> > > > +             $(HOST_DIR)/usr/lib/pkgconfig/gobject-introspection-1.0.pc
> > >
> > > No, the host variant of pkg-config should not append the sysroot
> > > directory. If it does, then it is wrong.
> > Well this was when building the target package that uses the host
> > pkgconfig libdir.
>
> And? According to 4e0bc29993376613d200e892d491e31ea5a49622, Meson has
> some understanding of when it is using pkg-config to find libraries to
> build native code or to build target code.
Right, that's not the problem, the problem is we install g-ir-scanner wrappers
only to target, in meson for some reason g-ir-scanner is considered a native
dependency and hence meson looks for the host version rather than the target.
See here:
https://github.com/mesonbuild/meson/blob/0.54.1/mesonbuild/modules/gnome.py#L420
>
> As you can see in this commit:
>
> -pkgconfig = '@HOST_DIR@/usr/bin/pkg-config'
> +pkgconfig = '@HOST_DIR@/bin/pkgconf'
>
> Meson is no longer going through our pkg-config wrapper that passes the
> right environment variables to ensure pkg-config returns values valid
> for building target code.
>
> Since Meson goes through $(HOST_DIR)/bin/pkgconf directly, we do not
> pass any specific sysroot argument to pkg-config. It is up to Meson to
> pass the appropriate sysroot value when working with target code, and
> to not pass any sysroot value when working on native code.
>
> See the commit log of 4e0bc29993376613d200e892d491e31ea5a49622:
>
>     meson is able to distinguish between host (= native) and target (=
>     cross) compilation. It will explicitly pass different options to
>     pkg-config to distinguish them. Therefore, we don't need to use the
>     pkg-config wrapper when using meson, and can instead pass the pkg-config
>     settings through the cross-compilation.conf.
>
>     This is important because in some situations (e.g. for the Python
>     configuration), meson sets the PKG_CONFIG_LIBDIR variable to a different
>     value before calling pkg-config. Relying on our wrapper script doesn't
>     work in that case (except if the script would unconditionally set
>     PKG_CONFIG_LIBDIR, which it doesn't do at the moment).
>
>     Add the sys_root and pkg_config_lib settings to cross-compilation.conf
>     and use pkgconf directly instead of the wrapper.
>
>     Note that this requires us to substitute STAGING_DIR as well, with an
>     absolute path. This is not a big deal since cross-compilation.conf is
>     regenerated for every package.
>
> Best regards,
>
> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com


More information about the buildroot mailing list