Ticket #331 (new defect)

Opened 4 years ago

Last modified 5 months ago

pkg-config error messages could be better

Reported by: duncan Owned by:
Priority: normal Milestone:
Component: Cabal library Version: 1.4.0.1
Severity: normal Keywords:
Cc: Difficulty: very easy (<1 hour)
GHC Version: 6.8.2 Platform:

Description

Currently if you cabal install X11-xft but don't have the xft development package installed you get this during configure:

cabal: The pkg-config package xft is required but it could not be found.

What is not immediately clear is that this is a native package and thus not something that cabal-install could have gone and fetched. So the wording of this message could be improved. Perhaps mentioning both in general terms and then specifically. For example saying that the development files for xft are not installed and that the user probably can and should install a native package that provides it. Specifically it's looking for a xft.pc file that pkg-config uses to tell is what compiler flags to use to use xft.

A related problem is that the message is somewhat lost in the noise because we print the error to stdout rather than throwing it as an exception that we could print in the final summary. This problem is particulary bad when we have to have error message cross process boundaries, ie when cabal-install invokes a setup program.

Change History

follow-up: ↓ 2   Changed 3 years ago by joe

I took a stab at rewording the message, trying to clarify the fact that it's not a hackage package while still keeping the message short. Here's a patch:

 http://heme.elem.com/darcs/cabal/ticket-331/_darcs/patches/20090916150213-e31fe-f523ea38606c6292de44980c2d51bd1bc8110e59.gz

in reply to: ↑ 1 ; follow-up: ↓ 3   Changed 2 years ago by duncan

Replying to joe:

I took a stab at rewording the message, trying to clarify the fact that it's not a hackage package while still keeping the message short. Here's a patch:

Thanks Joe but the change you suggest is making the message more low-level with this talk about pkg-config --modversion

-  notFound     = "The pkg-config package " ++ pkg ++ versionRequirement
-              ++ " is required but it could not be found."
+  notFound     = "The development package " ++ pkg ++ versionRequirement
+              ++ " is required but it could not be found using pkg-config --modversion"

The users who are confused about this message are confused about whether it's talking about a system package or a Haskell package. They've probably never heard of pkg-config and do not know what it does.

I think it's ok to have a slightly longer message, perhaps more along the lines of what we show for missing C libs:

Setup.hs: Missing dependency on a foreign library:
* Missing header file: foo.h
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.

in reply to: ↑ 2   Changed 2 years ago by joe

Replying to duncan:

They've probably never heard of pkg-config and do not know what it does.

True. (I did not.) But phrasing it as "pkg-config --modversion" gives the user the hint that it's an executable (with a man page). The long version would have pointed me in the right direction too. Either way, I think it's worthwhile to cite the exact command Cabal ran. This gives the user a starting place for troubleshooting if there is a problem with the user's system installation or they're on an unusual platform, eg.

  Changed 5 months ago by elga

  Changed 5 months ago by edouard

Termine le parcours du combattant ! les procedures, aujourd'hui tres simplifiees, sont accessibles en quelques clics seulement.  simyo

Note: See TracTickets for help on using tickets.