qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: more bogus meson warnings


From: Peter Maydell
Subject: Re: more bogus meson warnings
Date: Wed, 3 Nov 2021 12:19:26 +0000

On Wed, 3 Nov 2021 at 08:01, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> On Tue, Nov 2, 2021 at 2:38 PM Peter Maydell <peter.maydell@linaro.org> wrote:
> > I tried my static-system build config today; meson bogus
> > complaints include:
> >
> > WARNING: Static library 'pulse' not found for dependency 'libpulse',
> > may not be statically linked
> > WARNING: Static library 'pulsecommon-11.1' not found for dependency
> > 'libpulse', may not be statically linked
> > WARNING: Static library 'asound' not found for dependency 'alsa', may
> > not be statically linked
> > WARNING: Static library 'spice-server' not found for dependency
> > 'spice-server', may not be statically linked
> > WARNING: Static library 'cacard' not found for dependency 'libcacard',
> > may not be statically linked
> >
> > We asked for static linking, this should result in
> > "OK, no static library present, ignore optional feature",
> > not "decide we found the library and emit a warning message".
>
> I think I explained this already, but what happens is that:
>
> 1) Meson retrieves the flags from pkg-config. It sanity checks the -l
> flags, and cannot find the library. It prints a warning because maybe
> it's looking in the wrong places, the path to the library might be
> provided by --extra-ldflags or another place that is not in gcc
> --print-search-dirs.
>
> 2) Therefore the root cause is that a .pc file is present but not
> suitable for static linking. With the test in configure, the problem
> would still be there, except it would not be detected and would just
> break at the time of the final link.

This is not my experience. I find that:
 * test in configure: configure doesn't enable the thing
 * test in meson: meson produces a WARNING, but goes ahead anyway,
   and then the final link fails

> So, in general, you _already_ have an improvement over what was there before.

Well, in practice what happened was that before the recent changes
configure correctly didn't put dynamic libraries into the link line,
and so my configure options resulted in a successful build.
After these recent changes to move stuff from configure to meson,
meson is putting dynamic libraries into the link line, and the
build fails until I add extra --disable-foo to the configure arguments.
This is not what I would consider an improvement.

> For the specific case of Spice, you didn't need a separate
> --disable-spice argument because Spice did have a "compile a test
> program" step in configure, unlike basically every other $pkg_config
> invocation. Marc-André didn't bring it over to Meson, and that was
> fine with me because (IMO) this kind of slight difference between one
> dependency and all the others is just a maintenance hassle.
>
> > Has header "snappy-c.h" : YES
> > Library snappy found: YES
> > ../../meson.build:1141: WARNING: could not link libsnappy, disabling
> > Has header "lzo/lzo1x.h" : YES
> > Library lzo2 found: YES
> > ../../meson.build:1158: WARNING: could not link liblzo2, disabling
> >
> > meson should just decide it doesn't have snappy and lzo2,
> > without emitting the warning.
>
> These are two different tests:
>
> - the "header present" and "library present" tests are done with 
> cc.find_library
>
> - the "does a basic program" link is done with cc.links.
>
> The warning is emitted in the case where the files are present but the
> test program fails. Of course, Meson doesn't have a crystal ball for
> the cc.links test when it says that the static lzo2 library is there
> (apparently it is).

They're two tests under the hood, but they both need to pass
for us to be able to use the feature. If they don't both pass,
then meson should just quietly say "OK, we don't have this thing"
(ie it could print a "Something or other: NO" line, but it should
not be printing a "WARNING" line).

> I have tried "../configure --without-default-features --enable-snappy
> --static" and it correctly fails with "../meson.build:1110:2: ERROR: C
> static library 'snappy' not found". Likewise, "../configure --static"
> prints dozen of warnings of the previous kind for missing static
> libraries in pkg-config files; for snappy, however, it correctly
> prints
>
> Has header "snappy-c.h" : YES
> Library snappy found: NO
>
> without any warning. If you send me your config-host.mak and
> meson-logs/meson-log.txt I can check what's going on here. If you
> would like a different wording such as "could not link liblzo2 test
> program, disabling", that can be done too, of course.

I just want meson to follow the convention that we have had for
years, which is:
 * if I say --enable-foo, then failing to find foo should be an
   error
 * if I say --disable-foo, then don't probe for foo at all
 * if I say nothing, then probe for the various things we need to
   enable the foo feature, and if they're not presentor not usable
   for some reason then just quietly don't enable the foo option

I specifically do *not* want meson to print anything saying
"WARNING" for case 3, because this should be a fairly normal
state of affairs.

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]