pkg-config uses a more general version scheme #163

Open
bos opened this Issue May 24, 2012 · 12 comments

Comments

Projects
None yet
Contributor

bos commented May 24, 2012

(Imported from Trac #170, reported by @dcoutts on 2007-11-05)

From HsOpenSSL.cabal

  --PkgConfig-Depends: openssl >= 0.9.7l
  -- We really should use this instead of the configure
  -- script but Cabal 1.2.2.0 can't handle the weird version
  -- scheme of OpenSSL.
For example:
$ pkg-config --modversion openssl
0.9.8f
Currently Cabal tries to map pkg-config versions to the standard Version type which only allows for a sequence of numbers.

pkg-config uses just strings to represent package versions. It uses code lifted from rpm to compare version strings. See the compare_versions function in pkg-gconfig-0.22/pkg.c from http://pkgconfig.freedesktop.org/releases/pkg-config-0.22.tar.gz

Contributor

bos commented May 24, 2012

(Imported comment by @dcoutts on 2007-11-05)

A possibly-better reference for the rpm version string comparison code:
rpmEVRcmp

Contributor

bos commented May 24, 2012

(Imported comment by guest on 2008-01-26)

I got

$ cabal install
Resolving dependencies...
Configuring alsa-core-0.5.0.1...
cabal: parsing output of pkg-config --modversion failed
cabal: Error: some packages failed to install:
alsa-core-0.5.0.1 failed during the configure step. The exception was:
ExitFailure 1
because
$ pkg-config --modversion alsa
1.0.14a
I remember that Cabal had functions for parsing version numbers with tags, would this help here?

Newer ALSA versions do not seem to have the version tag anymore.

Contributor

bos commented May 24, 2012

(Imported comment by guest on 2011-03-05)

How about using pkg-config's --atleast-version option? Then Cabal does not need to parse the version number at all.

Contributor

bos commented May 24, 2012

(Imported comment by @dcoutts on 2011-03-05)

We do need to parse the version because people can use arbitrarily complicated version constraints, not just ">= x.y". I think we just need to do it properly and have pkg-config versions use a different type internally than Version, and use different version comparison code.

Owner

tibbe commented May 5, 2014

Closing as there's been no activity in years.

We're cleaning up the bug tracker to make it useful again and are thus closing bugs that haven't seen any activity in a long time. Please re-open (or file a new bug) if the problem reappears.

@tibbe tibbe closed this May 5, 2014

Contributor

mietek commented Jul 30, 2014

This is still an issue.

With pkgconfig-depends: openssl, Cabal fails as follows:

$ cabal build
Resolving dependencies...
Configuring foo-0.0.1...
cabal: parsing output of pkg-config --modversion failed

This is due to the openssl version number format:

$ pkg-config --modversion openssl
0.9.8y

@dcoutts dcoutts reopened this Jul 30, 2014

@ttuegel ttuegel added this to the _|_ milestone Apr 23, 2015

Collaborator

BardurArantsson commented Jun 25, 2015

@mietek Do you have the ability and/or inclination to help with fixing this issue? If you're keen the Cabal developers are going to be very grateful for any manpower you can offer. Given how long this has gone unaddressed, I fear it'll go on being unresolved otherwise.

I propose this be closed -- if @mietek wants he can reopen. (But please only do so if you want to help address it or know somebody who can.)

Owner

hvr commented Aug 17, 2015

@23Skidoo
For the record, pkg-config seems to use the same version comparison that rpm uses (or used at some point), see http://cgit.freedesktop.org/pkg-config/tree/rpmvercmp.c

Contributor

nomeata commented Nov 3, 2015

I have been observing that when building bindings-sane on Debian. @mtolly, are you still planning to fix this?

Contributor

mtolly commented Nov 10, 2015

My apologies, this has fallen off my radar for a while now. In #2730 you can see that it got a bit more complicated, and as far as I could tell, clear decisions weren't really reached regarding where the extra tags should be allowed, and whether they should be ignored or actually used for comparison (and, what comparison function should be used). In addition my own reason for needing the fix mostly went away. So, anyone else is certainly free to pick this back up.

kenta2 commented Feb 10, 2017

Yet one more package that this bug affects is hlibBladeRF-0.1.0.6 which depends on libbladeRF. Ubuntu 14.04 provides
$ pkg-config --modversion libbladeRF
0.10.0-0.9.0.15.8ba2499

This one almost parses correctly as a tag; the only issue is that simpleParse in Cabal/Distribution/Text.hs assumes tags are Char.isAlphaNum, but the period is not alphanumeric.

@ezyang ezyang modified the milestones: Triaged, Mar 7, 2017

Contributor

ezyang commented Mar 7, 2017

Perhaps, as a stopgap, we should just truncate the version string at the point where it stops looking like a normal version? This should be easy to implement, should be a very small change, and will get more packages compiling than before.

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