meson: dependency() can yield incorrectly cached dependencies on regen if the actual dependency went away

systemd checks for a library like this:

    libqrencode = dependency('libqrencode',
                             required : want_qrencode == 'true')
    have = libqrencode.found()

On a minimal Arch Linux system this does not show anything on the console (“Dependency libqrencode found:”). The library is not installed, however, “have” is true!

When setting “method : ‘pkg-config’,”, the check works.

Diffing the whole meson output between the minimal system and my also Arch Linux based development system actual system reveals several missing dependency checks in the output…

Presumably, the minimal system is missing something which breaks the meson dependency check when using auto…

This appeared during investigation/tests around this issue: https://github.com/systemd/systemd/issues/7367

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Comments: 19 (18 by maintainers)

Most upvoted comments

So… not sure if this is a bug or an unexpected feature, but after touch meson.build && ninja -C build, the lines for the dependencies tests are not printed again. It’s not immediately obvious if the tests themselves are being performed.

It seems that they are not. I can reproduce the issue like this:

sudo dnf build-dep systemd
git clone https://github.com/systemd/systemd
meson -Dman=false build
ninja -C build
sudo dnf remove  qrencode-devel
touch meson.build
ninja -C build

In the reconfiguration phase, qrencode is not rechecked and the build fails with ../src/journal/journal-qrcode.c:22:10: fatal error: qrencode.h: No such file or directory.