Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] pkg-config file has bad version string #1857

Closed
xbreak opened this issue Sep 23, 2024 · 2 comments
Closed

[BUG] pkg-config file has bad version string #1857

xbreak opened this issue Sep 23, 2024 · 2 comments

Comments

@xbreak
Copy link

xbreak commented Sep 23, 2024

Describe the bug

The pkg-config file version field contains a leading "v" , possibly introduced in 17bc235, which breaks plain version constraints in pkg-config.

What worked in 1.8.3:

$ pkg-config benchmark  'benchmark >= 1.8.0' --modversion
1.8.3
$ pkg-config benchmark  'benchmark' --atleast-version=1.8.0
# note: exit 0

Doesn't work in 1.9.0, 1.8.5 (and possibly 1.8.4):

$ pkg-config benchmark  'benchmark >= 1.8.0' --modversion
Requested 'benchmark >= 1.8.0' but version of benchmark is v1.8.5
$ pkg-config benchmark  'benchmark' --atleast-version=1.8.0
# note: exit 1

System
Which OS, compiler, and compiler version are you using:

  • OS: Linux
  • Compiler and version: n/a

To reproduce

Given release tar ball v1.9.0.tar.gz:

$ tar xzf v1.9.0.tar.gz
$ cd benchmark-1.9.0
$ cmake -DBENCHMARK_ENABLE_TESTING=OFF
...
-- Google Benchmark version: v1.9.0, normalized to 1.9.0
...
$  pkg-config benchmark  'benchmark >= 1.8.0' --modversion
Requested 'benchmark >= 1.8.0' but version of benchmark is v1.8.5
$ PKG_CONFIG_PATH=. pkg-config --modversion 'benchmark > 1.8.0'
Package dependency requirement 'benchmark > 1.8.0' could not be satisfied.
Package 'benchmark' has version 'v1.9.0', required version is '> 1.8.0'

Expected behavior

$ PKG_CONFIG_PATH=. pkg-config --modversion 'benchmark > 1.8.0'
1.9.0

Possible fix

--- cmake/benchmark.pc.in.orig	2024-09-23 09:20:18.558853817 +0000
+++ cmake/benchmark.pc.in	2024-09-23 09:18:31.412725720 +0000
@@ -5,7 +5,7 @@
 
 Name: @PROJECT_NAME@
 Description: Google microbenchmark framework
-Version: @VERSION@
+Version: @NORMALIZED_VERSION@
 
 Libs: -L${libdir} -lbenchmark
 Libs.private: -lpthread @BENCHMARK_PRIVATE_LINK_LIBRARIES@

And ditto for benchmark_main.pc

Additional context

Certain version expressions appear to work, like pkg-config 'benchmark >= v1.8.0', but this does not with --atleast-version, --exact-version and so on.

v1.8.4 reports version v0.0.0 when building from tarball:

$ cmake 
...
-- Google Benchmark version: v0.0.0, normalized to 0.0.0
...
@aespondac

This comment was marked as resolved.

@LebedevRI
Copy link
Collaborator

I presume this issue should have been auto-closed by that PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants