cabal-install problem with alex dependency in bytestring-lexing

Hi all, With a base system with just ghc and cabal-install, if I try to install bytestring-lexing I get: $ cabal install bytestring-lexing Resolving dependencies... Configuring bytestring-lexing-0.4.0... cabal: The program alex version >=2.3 is required but it could not be found. cabal: Error: some packages failed to install: bytestring-lexing-0.4.0 failed during the configure step. The exception was: ExitFailure 1 The cabal file for bytestring-lexing contains Build-Tools: alex >= 2.3 Is there any way to make the cabal install of bytestring-lexing force the install of alex first? Cheers, Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/

Hi, Am Freitag, den 16.03.2012, 21:00 +1100 schrieb Erik de Castro Lopo:
With a base system with just ghc and cabal-install, if I try to install bytestring-lexing I get:
$ cabal install bytestring-lexing Resolving dependencies... Configuring bytestring-lexing-0.4.0... cabal: The program alex version >=2.3 is required but it could not be found. cabal: Error: some packages failed to install: bytestring-lexing-0.4.0 failed during the configure step. The exception was: ExitFailure 1
The cabal file for bytestring-lexing contains
Build-Tools: alex >= 2.3
Is there any way to make the cabal install of bytestring-lexing force the install of alex first?
no, cabal-install does not automatically install build-tools at all, only Cabal checks them for compilation. I guess the reason is that build-tools needs to be put on the PATH, and that is beyond the scope of cabal-install. Greetings, Joachim -- Joachim "nomeata" Breitner Debian Developer nomeata@debian.org | ICQ# 74513189 | GPG-Keyid: 4743206C JID: nomeata@joachim-breitner.de | http://people.debian.org/~nomeata

Joachim Breitner wrote:
no, cabal-install does not automatically install build-tools at all, only Cabal checks them for compilation. I guess the reason is that build-tools needs to be put on the PATH, and that is beyond the scope of cabal-install.
This is rather sub-optimal. One place where people are running into this problem is when installing Yesod. Yesod depends on warp which depends on bytestring-lexing which requires alex at build time. The problem is that many of the people trying out Yesod are newcomers to Haskell. They are going to try "cabal install yesod" and have it fail because alex is missing. This is not a good introduction Haskell/Yesod. Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/

On 16 March 2012 21:56, Erik de Castro Lopo
Joachim Breitner wrote:
no, cabal-install does not automatically install build-tools at all, only Cabal checks them for compilation. I guess the reason is that build-tools needs to be put on the PATH, and that is beyond the scope of cabal-install.
This is rather sub-optimal.
It is, but the only way it would work is for cabal-install be much closer to a _real_ package management system: * Needs to keep track of installed packages. This is achieved in recent versions with a ~/.cabal/world file. * Keep track of which versions are installed. The world file states which versions it was *told* to install, not which are currently installed. For libraries, it doesn't matter: it gets that information from ghc-pkg. For binaries, this doesn't work (since there's no required standard for version reporting in Haskell build-tools). * Ensure that binaries are installed to somewhere in the PATH (not possible AFAIK). One trivial solution is to assume ~/.cabal/bin is on the PATH and to ignore system-wide packages, which I think is even *more* sub-optimal (why install a new version of alex when it's already available?). -- Ivan Lazar Miljenovic Ivan.Miljenovic@gmail.com http://IvanMiljenovic.wordpress.com

Ivan Lazar Miljenovic wrote:
One trivial solution is to assume ~/.cabal/bin is on the PATH and to ignore system-wide packages, which I think is even *more* sub-optimal (why install a new version of alex when it's already available?).
The tool should only install alex in ~/.cabal/bin if alex is not already available. Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/

On 17 March 2012 09:02, Erik de Castro Lopo
Ivan Lazar Miljenovic wrote:
One trivial solution is to assume ~/.cabal/bin is on the PATH and to ignore system-wide packages, which I think is even *more* sub-optimal (why install a new version of alex when it's already available?).
The tool should only install alex in ~/.cabal/bin if alex is not already available.
So how does it know whether the *correct version* is available? Add --version parsers for every single possible build-tool to cabal-install? -- Ivan Lazar Miljenovic Ivan.Miljenovic@gmail.com http://IvanMiljenovic.wordpress.com

On Mar 16, 2012 3:12 PM, "Ivan Lazar Miljenovic"
On 17 March 2012 09:02, Erik de Castro Lopo
wrote: Ivan Lazar Miljenovic wrote:
One trivial solution is to assume ~/.cabal/bin is on the PATH and to ignore system-wide packages, which I think is even *more* sub-optimal (why install a new version of alex when it's already available?).
The tool should only install alex in ~/.cabal/bin if alex is not already available.
So how does it know whether the *correct version* is available? Add --version parsers for every single possible build-tool to cabal-install?
That is (probably) how it knows that the necessary version of alex is not available. There actually is a standard format for checking version numbers of the core haskell build tools: --numeric-version produces output that is easily parsed (and matches the default parser for cabal Program values). I'm not at a computer to check alex specifically right now, but I'm fairly certain it is one of the builtin Programs that cabal can check. (you can also write your own, and put them in setup.hs if you need a special build tool.) There is, of course, nothing that says ask the build tools are going to be available on hackage (or even in haskell). I'm not sure how to fix this, really. We could make the build tools section produce more detailed instructions for installing missing tools in the case that cabal can't install them. -Rogan
-- Ivan Lazar Miljenovic Ivan.Miljenovic@gmail.com http://IvanMiljenovic.wordpress.com
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Alex is supplied as part of the Platform though which is the
recommended system for beginners, is Yesod currently in advance of the
Platform?
On 16 March 2012 10:56, Erik de Castro Lopo
The problem is that many of the people trying out Yesod are newcomers to Haskell. They are going to try "cabal install yesod" and have it fail because alex is missing. This is not a good introduction Haskell/Yesod.

The Yesod docs all state very explicitly that we depend on the Haskell
Platform, and in particular that alex needs to be installed. However,
that doesn't stop this issue from confusing people.
I think a good short term solution could be what Alan Zimmerman did
with language-javascript: include the files generated by alex in the
tarball, so that there is no alex dependency for installing from
Hackage. You would only need alex for developing.
Ideally I think cabal-install should be able to handle installation of
build tools- possibly to its own private folder where it's properly
versioned.
Michael
On Fri, Mar 16, 2012 at 4:37 PM, Stephen Tetley
Alex is supplied as part of the Platform though which is the recommended system for beginners, is Yesod currently in advance of the Platform?
On 16 March 2012 10:56, Erik de Castro Lopo
wrote: The problem is that many of the people trying out Yesod are newcomers to Haskell. They are going to try "cabal install yesod" and have it fail because alex is missing. This is not a good introduction Haskell/Yesod.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (6)
-
Erik de Castro Lopo
-
Ivan Lazar Miljenovic
-
Joachim Breitner
-
Michael Snoyman
-
Rogan Creswick
-
Stephen Tetley