[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: more bogus meson warnings
From: |
Paolo Bonzini |
Subject: |
Re: more bogus meson warnings |
Date: |
Wed, 3 Nov 2021 09:01:44 +0100 |
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.
So, in general, you _already_ have an improvement over what was there before.
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).
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.
Paolo