Meson: Meson fails to find dependency even though it does find it

Created on 8 Jul 2018  路  9Comments  路  Source: mesonbuild/meson

I've added a new dependency to my build, libcaca:

caca_dep = dependency('caca', version : '>= 0.99.beta14', required : get_option('caca'))
option('caca',
    type : 'feature',
    value : 'auto',
    description : 'Enable/disable caca support')

When I run ninja reconfigure I get:

Dependency caca found: NO

yet the meson log has this to say:

Determining dependency 'caca' with pkg-config executable '/usr/local/bin/pkg-config'
Called `/usr/local/bin/pkg-config --modversion caca` -> 0
0.99.beta19
Dependency caca found: NO

So clearly it finds it but then it claims it does not?!

bug dependencies pkgconfig

Most helpful comment

If you'd like to work on this, the pkg-config version compare algorithm is well-known (the same as rpm's) although pkgconf's implementation might be easier to read. We need to change our version_compare() function to use that same algorithm.

All 9 comments

This is because our version comparison doesn't handle non-numeric characters very well.

Why does meson rolls its own version compare and does not rely on pkg-config for that?

Because we need to support other dependency providers than pkg-config.

Sure but if the tool you use for lookup already supports giving you the right version, why not use that? And for dependency providers that do not offer that, you could do the version compare in meson?

(I probably miss some caveat here why this can't work)

pkg-config does not have a way to both check whether the dependency is new enough and also tell us what the version is, so we'd have to call it twice just to do a single version check, and then we also support multiple version requirements for a dependency, so once for each. This quickly becomes unworkable.

We also need the version checking code to work the same for all dependencies, like Jussi said, and the results must be consistent because the same dependency is often provided in three different ways on different systems: pkg-config, config-tool, internal (subproject).

Thanks for clarifying.

If you'd like to work on this, the pkg-config version compare algorithm is well-known (the same as rpm's) although pkgconf's implementation might be easier to read. We need to change our version_compare() function to use that same algorithm.

My python skills are not that good that I would end up writing not completely horrible code for this, so I don't think I should do this.

I realized I've actually written rpmvercmp in python once already: https://github.com/jon-turney/calm/blob/master/calm/version.py, so maybe I can take a quick look at this...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ystreet picture ystreet  路  5Comments

adamryczkowski picture adamryczkowski  路  4Comments

z33ky picture z33ky  路  5Comments

matthiasclasen picture matthiasclasen  路  4Comments

amitdo picture amitdo  路  6Comments