Advice on Multiple GHC installations

I would like to have several versions of ghc installed simultaneously, on the handful of Ubuntu systems I work on. In the past, I have had just a single version of ghc installed on each system, usually the most recent stable generic Linux binary installation. Three questions: 1. Does there exist an `experimental' apt repository for Ubuntu anywhere which packages versions of ghc more recent than 6.8? 2. If I cannot install multiple ghc versions from a different apt repository, does anyone have advice for how to work with multiple simultaneous installations? A how-to guide or anything like that? 3. Does having multiple installations break cabal at all? I'd like to be able to use ghc 6.12.* by default, but be able to selectively choose an older toolchain for compatibility purposes, bug hunting, etc. Thanks! Sincerely, Brad

Excerpts from Bradford Larsen's message of Mon Apr 12 23:28:53 +0200 2010:
I would like to have several versions of ghc installed simultaneously, on the handful of Ubuntu systems I work on. In the past, I have had just a single version of ghc installed on each system, usually the most recent stable generic Linux binary installation.
Three questions: 1. Does there exist an `experimental' apt repository for Ubuntu anywhere which packages versions of ghc more recent than 6.8? 2. If I cannot install multiple ghc versions from a different apt repository, does anyone have advice for how to work with multiple simultaneous installations? A how-to guide or anything like that? 3. Does having multiple installations break cabal at all? I'd like to be able to use ghc 6.12.* by default, but be able to selectively choose an older toolchain for compatibility purposes, bug hunting, etc.
Have a look at hack-nix. However only recent ghcs are supported well. This means you have to install the Nix package manager. (-> www.nixos.org). http://github.com/MarcWeber/hack-nix Marc Weber

I would like to have several versions of ghc installed simultaneously, on the handful of Ubuntu systems I work on. In the past, I have had just a single version of ghc installed on each system, usually the most recent stable generic Linux binary installation.
I just recently announced multi-ghc to solve this problem (for me at least). http://github.com/spl/multi-ghc
Three questions: 1. Does there exist an `experimental' apt repository for Ubuntu anywhere which packages versions of ghc more recent than 6.8?
I don't know, but multi-ghc doesn't depend on (or use) any package manager. It's currently made up of a Bash script, a Makefile, and some directory naming conventions. This is both good (since it can be run on any system that has bash and make) and bad (since it means you have to configure your system to support building or using GHC yourself). 2. If I cannot install multiple ghc versions from a different apt
repository, does anyone have advice for how to work with multiple simultaneous installations? A how-to guide or anything like that?
multi-ghc has a README and the script has usage information.
3. Does having multiple installations break cabal at all? I'd like to be able to use ghc 6.12.* by default, but be able to selectively choose an older toolchain for compatibility purposes, bug hunting, etc.
One of the main goals of multi-ghc was to allow for a different cabal-install configuration for each GHC. It uses symbolic links to switch between versions. If you're running Linux on x86, then you should be able to use many of the binary tarballs available at http://www.haskell.org/ghc/dist/ . I can't promise all of them work, because I haven't tested them all. If you try out multi-ghc, please let me know how it goes. I deem its current state "good enough" to let other people use, but I'm sure it can improve. I'm happy to take feedback and/or patches. Regards, Sean

On 2010-04-12 22:28, Bradford Larsen wrote:
2. If I cannot install multiple ghc versions from a different apt repository, does anyone have advice for how to work with multiple simultaneous installations? A how-to guide or anything like that?
I install GHC under /usr/local/stow/ghc-<version>/ by using the --prefix flag when configuring the binary packages. I have seven versions installed at the moment: $ cd /usr/local/stow/ $ ls -d ghc* ghc-6.10.1 ghc-6.10.2 ghc-6.10.3 ghc-6.10.4 ghc-6.12.1 ghc-6.8.2 ghc-6.8.3 Using stow (http://www.gnu.org/software/stow/) I can then pick one version which is available directly under /usr/local (via symlinks). To use GHC 6.12.1: $ sudo stow ghc-6.12.1 To switch to GHC 6.10.4: $ sudo stow -D ghc-6.12.1 $ sudo stow ghc-6.10.4 If I want to use a non-default version to build something with cabal-install I use the --with-compiler flag: cabal install --with-compiler=/usr/local/stow/ghc-<version>/bin/ghc <package> -- /NAD

On Apr 13, 2010, at 9:19 AM, Nils Anders Danielsson wrote:
On 2010-04-12 22:28, Bradford Larsen wrote:
2. If I cannot install multiple ghc versions from a different apt repository, does anyone have advice for how to work with multiple simultaneous installations? A how-to guide or anything like that?
I install GHC under /usr/local/stow/ghc-<version>/ by using the --prefix flag when configuring the binary packages.
Why not just use symbolic links? I too have multiple installations of ghc (at the moment, only two), and I choose between them using a symbolic link: book % ls -l /usr/local | grep ghc lrwxr-xr-x 1 root wheel 10 Jan 12 00:05 ghc -> ghc-6.12.1 drwxr-xr-x 7 dave wheel 238 Dec 25 10:46 ghc-6.10.4 drwxr-xr-x 7 dave wheel 238 Jan 8 21:52 ghc-6.12.1 (/usr/local/ghc/bin is on my PATH.) My install scripts use the --prefix flag. I also make the actual installations user-writeable, so that I DON'T have to use sudo at any point after setting up the directories. This gives me a nice proof that no script I then call is messing up other parts of my system. (One can still accidentally still do something "locally", creating an unannounced subdirectory of $HOME e.g. using cabal-install.) I follow this strategy for pretty much any program that I care about. I only believe in scattering program parts through /usr/local/[bin,lib,doc] if I believe they will work, will never need upgrading for the life of my OS, and "La La La I can't hear you!" I'm going to pretend they don't even exist once I'm done installing. GHC is way too important to be treated that way, so I follow (roughly) Nils' strategy.

Why not just use symbolic links? I too have multiple installations of ghc (at the moment, only two), and I choose between them using a symbolic link:
book % ls -l /usr/local | grep ghc lrwxr-xr-x 1 root wheel 10 Jan 12 00:05 ghc -> ghc-6.12.1 drwxr-xr-x 7 dave wheel 238 Dec 25 10:46 ghc-6.10.4 drwxr-xr-x 7 dave wheel 238 Jan 8 21:52 ghc-6.12.1
(/usr/local/ghc/bin is on my PATH.)
My install scripts use the --prefix flag.
This sounds very similar to what I do with multi-ghc. I just use a Bash script to manage the symlinks for me and a Makefile to do the configure/make install. That's really all multi-ghc is at the moment.
I also make the actual installations user-writeable, so that I DON'T have to use sudo at any point after setting up the directories. This gives me a nice proof that no script I then call is messing up other parts of my system. (One can still accidentally still do something "locally", creating an unannounced subdirectory of $HOME e.g. using cabal-install.)
To sudo or not to sudo: doesn't matter to me (or multi-ghc). :) GHC is way too important to be treated that way, so I follow (roughly) Nils'
strategy.
The use of stow also seems similar, though perhaps more general. I currently keep track of the "current" GHC, and it seems stow may not do that, though I doubt it should be difficult to extend. Regards, Sean

On 2010-04-13 15:08, Dave Bayer wrote:
Why not just use symbolic links?
When using stow I am just using symbolic links (and directories), except that I don't need to create them all manually, and I can remove all of them with a single command. I don't need to modify my PATH.
I only believe in scattering program parts through /usr/local/[bin,lib,doc] if I believe they will work, will never need upgrading for the life of my OS [...]
When using stow you can easily uninstall things: just use "stow -D" to remove the symbolic links (and directories which only contain such links), and then you can delete the single directory which contains all the files. -- /NAD

Many choices were suggested! For now, I have decided to go with stow.
I installed 3 versions of GHC in /usr/local/stow, and installed
cabal-install locally (i.e. to my home directory), built with ghc
6.12.1. I'm not sure that this is the best way to go about this, but
it's what I'm working with for now. I experimented a little bit, and
switching between default ghc versions seems to work, not breaking my
installation of cabal-install in my home directory.
I seriously considered the simpler `manual symlink' approach, or even
just installing in sequence to /usr/local 6.8.3, 6.10.4, and 6.12.1.
These alternatives could both permit having several versions of ghc in
my PATH simultaneously (e.g., /usr/local/bin/ghc-6.10.4 and
/usr/local/bin/ghc-6.12.1). With stow, only the currently selected
`installed' ghc binaries will show up in /usr/local/bin.
Thanks,
Brad
On Tue, Apr 13, 2010 at 11:30 AM, Nils Anders Danielsson
On 2010-04-13 15:08, Dave Bayer wrote:
Why not just use symbolic links?
When using stow I am just using symbolic links (and directories), except that I don't need to create them all manually, and I can remove all of them with a single command. I don't need to modify my PATH.
I only believe in scattering program parts through /usr/local/[bin,lib,doc] if I believe they will work, will never need upgrading for the life of my OS [...]
When using stow you can easily uninstall things: just use "stow -D" to remove the symbolic links (and directories which only contain such links), and then you can delete the single directory which contains all the files.
-- /NAD _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
participants (5)
-
Bradford Larsen
-
Dave Bayer
-
Marc Weber
-
Nils Anders Danielsson
-
Sean Leather