cabal-install and Debian
Asked Answered
H

4

13

So, this is a bit of a personal problem, but maybe people will have good advice or workarounds.

The problem is about installing cabal-install and haskell-platform under Debian.

When you apt-get install haskell-platform, it ships with cabal-install, and its command cabal is available.

Now this cabal-install is not up-to-date:

> which cabal
/usr/bin/cabal
> /usr/bin/cabal --version
cabal-install version 0.8.0
using version 1.8.0.2 of the Cabal library

But, my understanding of running cabal update is that it updates cabal, but since it is not a "Debian thingy", it puts it in ~/.cabal/bin/.

> ~/.cabal/bin/cabal --version
cabal-install version 0.8.2
using version 1.8.0.2 of the Cabal library

Now my system has 2 cabals, and the one I get by typing cabal is not the one I want to use... Because it'll keep updating the other one instead of itself, and is therefore ineffective.

So what I did was I aliased it in my ~/.bashrc:

alias cabal='~/.cabal/bin/cabal'

Now:

> cabal --version
cabal-install version 0.8.2
using version 1.8.0.2 of the Cabal library

So, my final questions:

  • Is there a deb repository that holds cabal 0.8.2?
  • Could my current solution lead to problems? (For instance, which cabal still points to my useless /usr/bin/cabal, so if scripts use this command they'll get fooled...)
  • Did someone come up with a better solution? (Mine is a bit ad-hoc but that's all I could come up to with my poor knowledge of what is happening behind the scenes...)
  • Please correct me if anything I say above is wrong or inaccurate.
Hydnocarpate answered 21/3, 2011 at 16:52 Comment(5)
+1. I don't get why Haskell needs its own package manager, while other languages get by without one.Illustrate
Lots of languages have their own package manager? For instance RubyGems is extremely popular in the Ruby community.Spacing
gem for ruby, pip or easy_install for python, maven and its derivatives for Java,... For people who extensively use third party libraries, relying on the OS package management system is not always the best option. Specially on conservative OS's like Debian. I must keep up with the latest releases of some libraries under heavy development (as a client, not as a dev) and it would be hell to manually install them every time.Sabra
Haskell doesn't have a package manager. It has a build manager, which knows how to resolve build dependencies. If you've already built the library, Cabal will be of no help to you, and you should use apt or yum or pacman instead.Constructivism
@harpo: The reason is that Windows/Mac lack such basic facilities (at least in a sane sense), and so their users don’t know any better than to create their own updater for each app and package manager for each language. All they know is ”app stores”. It’s like how in my country, government workers will print out e-mails, put them on the copying machine, and scan them in again, to make a copy. Have mercy on their souls. ;)Matthieu
B
13

What I do is installing cabal with the --global flag. This will install cabal into /usr/local/bin/cabal, thus it will always superseed the Debian packages cabal.

Another way, is to generally avoid the Debian packages and install the Haskell platform straight from its source. This approach is also better, if you always want to have the latest releases of the Haskell libs.

Boastful answered 21/3, 2011 at 17:7 Comment(3)
This is interesting. So what I did to make it work is: > su > cabal update > cabal install cabal-install --global > exit > (here I removed my alias from my .bashrc and reopened the terminal) and now it works good! Thanks.Hydnocarpate
No it won’t. It doesn’t install anything to /usr/local/lib.Matthieu
@Evi1M4chine This may have changed since I wrote the answer. I don't do Haskell anymore unfortunately.Boastful
T
11

I keep my user-local $HOME/.cabal/bin in the front of the PATH. I install only ghc6, ghc6-prof, ghc6-doc and cabal-install from the distribution packages. I don't use distribution cabal-install for anything more than to bootstrap the new ~/.cabal. All the rest I install with cabal install, including the newer cabal itself.

When I want to use newer GHC, I deploy it in /usr/local/stow/ghcVERSION, and enable it with GNU stow (it adds symlinks in /usr/local which, again, has precedence in my PATH). When I want to switch back to the distribution GHC I just run stow -D to remove all symbolic links to it.

I consider using cabal-dev to have project-specific cabal installations, and avoid broken dependencies which happen with cabal from time to time.

As a matter of fact I don't use Haskell Platform at all because I don't need all of it and find it easier to be able to install individual libraries. I do not install distribution libraries, because not all of them are available or are exactly the versions I need; and it is much easier to control conflicts if all of them are installed in the same place (~/.cabal in my case). I do not install anything with --global, because I think it is wrong and difficult to rollback.

Tahsildar answered 21/3, 2011 at 17:47 Comment(1)
Thank you, it's interesting. I might switch to this if I encounter any problem/annoyance.Hydnocarpate
P
4

Of course this information gets out of date, but yes, Debian unstable and testing have, at the time of writing, cabal-install 0.10.2.

Generally, the Debian packaging of Haskell stuff is aimed at users who want a set of packages that is known to work together, i.e. no dependency hell, at the expense of not always having the latest and greatest. This includes cabal-install. I use cabal-install from the repositories, and only to install those libraries that have not been packaged for Debian yet.

Disclaimer: I am one of the guys that create those packages for Debian.

Pears answered 21/9, 2011 at 20:47 Comment(1)
Fair enough, I understand that you can't satisfy everyone's needs, and there are not so tedious alternatives.Hydnocarpate
T
1

On Ubuntu I also tend to install GHC via stow, ignoring the system packages altogether.

One slight twist from jetxee's approach is that I do install the Haskell Platform (from source), lumping it in with the GHC stow directory. I suppose I ought to call the paths /usr/local/stow/haskell-platform-VERSION, but I tend to use /usr/local/stow/ghc-VERSION instead.

Taboret answered 22/3, 2011 at 13:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.