What do I need to do if I want to install a new version of GHC?

I am currently using GHC 7.10.1 on my ubuntu 14.04 system, now I have received from the mailing list that a new version containing many bug fixes has been released. Therefore, I am considering updating my GHC.

I know how to install GHC, but I have little knowledge on how to handle packages that I have already installed through cabal . It seems that these packages were installed in ~/.cabal , for example, libs were installed in ~/.cabal/lib/x86_64-linux-ghc-7.10.1 and registered in ~/.ghc/x86_64-linux-7.10.1 .

The path name (... x86_64-linux-7.10.1 ...) seems to suggest that they can only be used by GHC 7.10.1 , so if I want to use the new version of GHC and remove the old GHC 7.10.1 from my systems, do I have to clean them and reinstall these packages?

for example, should I rm -rf ~/.cabal && rm -rf ~/.ghc and reinstall both cabal and GHC? or should I just leave these packages there? if so, will these installed packages be reused by the new GHC?

+5
source share
2 answers

Yes, you need to reinstall packages when updating the compiler.

However, if you delete ~/.ghc , this will remove the packages from the point of view of GHC. You can also delete ~/.cabal and reinstall everything, but binaries in ~/.cabal/bin (including cabal ) will usually work, so it is often easier to save them and save some time (see what is there) . Perhaps some problems may be problems - I think some binary files can be hardcoded using the GHC protocol, so they will be broken, but you can always reinstall them.

~/.cabal/packages contains cache files, so you can delete this. The data will simply be torn down again the next time you run the bondage. If in doubt, just delete it.

You must remove ~/.cabal/lib which contains the compiled packages and will not be compatible with other GHC. Similarly for ~/.cabal/share .

If you did not edit the ~/.cabal/config file manually and want to save the changes, you can delete it and create a new one.

+2
source

You do not need to delete anything. If you install GHC 7.10.2 in the same place where you installed GHC 7.10.1, then all the symbolic links are ghc , ghci , ghc-pkg , etc. It will be overwritten to indicate 7.10.2, but you can still run the versioned programs ghc-7.10.1 ghci-7.10.1 , ghci-7.10.1 , ghc-pkg-7.10.1 , etc., or tell cabal how build using a special compiler with the -w flag. All libraries and library registration data (regardless of whether they came from the GHC, are installed in the user packages database, or are in an isolated software environment) (by default) are stored in subdirectories that depend on the GHC version, so different versions of GHC will not interfere with each others.

If you have low free disk space, I would suggest not deleting GHC 7.10.1. In the end, 7.10.2 was only released yesterday, and if you had a strange problem with 7.10.2, it might be worth checking to see if 7.10.1 was also affected.

+2
source

All Articles