I wanted to use the header files for avahi in gnome-control-center. However, when I add the dependency in meson.build file, it gives me this error.

But pkg-config seems to work on the system.

This is how I added the dependency is meson.build

Do I also need to configure something else?
I have already tried using
avahi_client_dep = dependency('avahi-client', method : 'system') but get the same error.
Can someone help?
Adding a module for avahi in the flatpak's manifest worked.