[Buildroot] [PATCH 3/3] package/pkg-meson.mk: explicitly specify pkg-config settings

Thomas Petazzoni thomas.petazzoni at bootlin.com
Wed Feb 19 20:38:41 UTC 2020


Hello Arnout,

On Wed,  5 Feb 2020 11:33:04 +0100
"Arnout Vandecappelle (Essensium/Mind)" <arnout at mind.be> wrote:

> 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.
> 
> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout at mind.be>

Unfortunately, this breaks the build of libglib2 in static linking
scenarios:

  http://autobuild.buildroot.net/results/35c/35ce460192581a3ce2866ef5d3cb5391afd68cc5/build-end.log

And now that I have merged the fixes for the erlang an sdbusplus
issues, this libglib2 issue is the #1 issue hitting the autobuilders on
master.

The problem comes from the fact that by skipping the wrapper, you are
no longer passing the --static option to pkg-config when building
statically.

From a quick look at build/lib/mesonbuild/dependencies/base.py in the
Meson code base, it seems like there is some way to have it pass
--static to pkg-config:

        if self.static:
            libcmd.append('--static')

But it's not clear to me how that happens. Perhaps with your better
knowledge of the Meson code base you will have an idea here ?

Of course, we don't want to unconditionally pass --static, as --static
should be passed when using pkg-config to look up for target libraries,
but not when looking up for host libraries, and the whole point of your
initial patch was precisely to leave it up to meson to invoke
pkg-config the "right" way depending on whether it was cross-compiling
something or natively compiling.

Could you help here ?

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


More information about the buildroot mailing list