Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to install more than one ghc and change each installation's binary name?

Tags:

haskell

Suppose I want to use different versions of GHC, each of them with a different binary name.

Question 1. Can I use ./configure --prefix=ghc-some-version-dir for each of the installations and create symbolic links ghc-7.4.1, ghc-7.6.2, ghc-head without problems?

That is, after the installation and creation of binaries from source code. Using virtual environments would still be needed for building projects and its dependencies.

Question 2. What prevents us from uploading ghc to Hackage with a package name ghc-version having a binary name that depends on its version? e.g. one could cabal install ghc-version-7.6.2 and get a binary ghc-7.6.2 in ~/.cabal/bin

like image 802
Carlos López-Camey Avatar asked Mar 27 '13 22:03

Carlos López-Camey


2 Answers

You don't need to do anything special. GHC already installs all of its executables with versioned names and links from the non-versioned name to the most recently installed version, e.g. a link from "ghc" to "ghc-7.6.1" or whatever you installed last. When you build from the repository, the version number is quite long and includes the date you built it.

I don't know for sure why GHC isn't on Hackage, but I presume it's because the build system is very complicated, and that cabal-izing it (and maintaining the cabalization) would be more work than it's worth.

like image 112
Daniel Wagner Avatar answered Oct 20 '22 10:10

Daniel Wagner


There are several soluttions

  • Just use chroot
  • Use a package manager that handles multiple versions of the same library/software such as nix
  • There are scripts which have been written to handle this such as https://github.com/spl/multi-ghc
  • Use gnu stow as described in Brent Yorgey blog post.
  • Ben Millwood has a solution where he just uses the -w flag, read his comment at:https://plus.google.com/u/0/100165496075034135269/posts/VU9FupRvRbU
like image 32
Davorak Avatar answered Oct 20 '22 08:10

Davorak