简体   繁体   中英

How do you install packages/libraries without Cabal or Cabal-Install?

I'm trying to set up Haskell from scratch, on Ubuntu 11.04, without using the outdated Debian repository or Haskell-Platform.

I've installed GHC-7.0.4 from source with no problem, and now need to install Cabal (which appears to already be included in GHC in /usr/local/lib/ghc-7.0.4/Cabal-1.10.2.0) and Cabal Install .

The latter specifies several dependencies ( parsec and network ), each of which has several dependencies of their own ( mtl , text , etc).

What's the command to install these packages, that I downloaded from hackage in tar.gz form?

Unpack, then runhaskell doesn't work.

I see Setup.lhs, but it's not clear what that's for or how to use it.

Most of the Haskell documentation I've found assumes you've installed from a repo or Haskell-Package and doesn't really explain this well.

cabal-install has a shell script that does this. If you download it from hackage and install it, you can start bootstrap.sh to install cabal-install . You can then use it to install other packages.

There are two different packages: Cabal and cabal-install . Cabal is a library, and cabal-install is an executable named cabal .

To install a package, cabal-install is an optional convenience wrapper around Cabal, but Cabal is required.

According to http://hackage.haskell.org/trac/ghc/wiki/Commentary/Libraries , Cabal is a 'zero-boot' package, so when you build GHC, Cabal and its dependencies are built for you automatically.

You can use ghc-pkg executable to check which packages are already installed:

# ghc-pkg list

Check if Cabal is in the list after you build GHC. If yes, you can install more packages without cabal-install using this documentation:

http://haskell.org/haskellwiki/Cabal/How_to_install_a_Cabal_package

I suggest you to install cabal-install first, and then install everything else using cabal-install executable. A usual commandine for global installation is this:

# runhaskell Setup configure
# runhaskell Setup build
# sudo runhaskell Setup install

Unpack a package tarball and run the commands in the folder with Setup.hs or Setup.lhs files. Note that a per-user non-root installation is also supported - Use runhaskell Setup configure --user

When you install cabal executable and its dependencies this way, use cabal install {package-name} to install more packages.

Note that Haskell Platform exists mostly because of the pain of installing cabal-install by yourself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM