简体   繁体   English

如果我想安装新版本的GHC,我该怎么办?

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

Currently, I am using GHC 7.10.1 on my ubuntu 14.04 system, just now I got noticed from mailing list that a new version containing a lot of bug fixes has been released. 目前,我在我的ubuntu 14.04系统上使用GHC 7.10.1 ,刚才我从邮件列表中注意到已发布包含大量bug修复的新版本。 So I am considering updating my GHC. 所以我正在考虑更新我的GHC。

I know how to install GHC, however, I have little knowledge about how to deal with packages I have already installed through cabal . 我知道如何安装GHC,但是,我对如何处理已通过cabal安装的软件包知之甚少。 It seems that those packages were installed into ~/.cabal , for example, libs were installed into ~/.cabal/lib/x86_64-linux-ghc-7.10.1 and registered in ~/.ghc/x86_64-linux-7.10.1 . 似乎这些软件包安装在~/.cabal ,例如,libs安装在~/.cabal/lib/x86_64-linux-ghc-7.10.1并在~/.ghc/x86_64-linux-7.10.1

The path name(...x86_64-linux-7.10.1...) seems to be suggesting that they could only be used by GHC 7.10.1 , so if I want to use a new version GHC and remove the old ghc 7.10.1 from my system, should I clean them up and reinstall those packages? 路径名(... x86_64-linux-7.10.1 ...)似乎暗示它们只能由GHC 7.10.1 ,所以如果我想使用新版本的GHC并删除旧的ghc 7.10.1从我的系统,我应该清理它们并重新安装这些包吗?

for example, should I rm -rf ~/.cabal && rm -rf ~/.ghc and reinstall both cabal and GHC? 例如,我应该rm -rf ~/.cabal && rm -rf ~/.ghc并重新安装cabal和GHC? or should I just leave those packages there? 或者我应该把那些包留在那里? if so, would those installed packages get reused by the new GHC? 如果是这样,那些已安装的软件包是否会被新的GHC重用?

Yes, you need to reinstall the packages when you update the compiler. 是的,您需要在更新编译器时重新安装软件包。

However, if you delete ~/.ghc then that removes the packages from GHC's point of view. 但是,如果删除~/.ghc ,则会从GHC的角度删除包。 You can also delete ~/.cabal and reinstall everything, but binaries in ~/.cabal/bin (including cabal ) will usually still work, so often it's easier to keep these and save some time (have a look to see what's there). 您也可以删除~/.cabal并重新安装所有内容,但~/.cabal/bin (包括cabal )中的二进制文件通常仍然有效,因此通常更容易保留这些并节省一些时间(看看有什么) 。 There might be problems with some - I think some binaries may have the GHC path hard coded internally, so will break, but you can always reinstall them. 某些可能存在问题 - 我认为某些二进制文件可能在内部硬编码GHC路径,因此会中断,但您可以随时重新安装它们。

~/.cabal/packages contains cached downloads so it's up to you whether you delete that. ~/.cabal/packages包含缓存下载,因此您是否删除它是由您自己决定的。 The data will just be pulled down again next time your run cabal. 下次运行时,数据将再次下拉。 If in doubt just delete it. 如果有疑问,只需删除它。

You should delete ~/.cabal/lib which contains the compiled packages and won't be compatible with a different GHC. 你应该删除包含已编译软件包的~/.cabal/lib ,并且不兼容不同的GHC。 Likewise for ~/.cabal/share . 同样适用于~/.cabal/share

Unless you've edited your ~/.cabal/config file by hand and want to keep the changes you can delete that too and a new one will be created. 除非您~/.cabal/config编辑了~/.cabal/config文件并希望保留更改,否则也可以删除它,并创建一个新文件。

You don't need to remove anything. 不需要删除任何东西。 If you install GHC 7.10.2 in the same location that you installed GHC 7.10.1, then all the symlinks ghc , ghci , ghc-pkg etc. will be overwritten to point to 7.10.2, but you can still run the versioned programs ghc-7.10.1 , ghci-7.10.1 , ghc-pkg-7.10.1 , etc., or tell cabal to build with a specific compiler with the -w flag. 如果在安装GHC 7.10.1的相同位置安装GHC 7.10.2,那么所有符号链接ghcghcighc-pkg等都将被覆盖以指向7.10.2,但您仍然可以运行版本化程序ghc-7.10.1ghci-7.10.1ghc-pkg-7.10.1等,或告诉cabal用特定的编译器和-w标志构建。 All libraries and library registration information (whether they came with GHC, are installed in the user package database, or are in a sandbox) are (by default) stored under GHC version-specific subdirectories, so different versions of GHC will not interfere with each other. 所有库和库注册信息(无论是随GHC一起提供,是安装在用户包数据库中,还是安装在沙箱中)都是(默认情况下)存储在GHC版本特定的子目录下,因此不同版本的GHC不会干扰每个其他。

If you're not running low on disk space I would suggest not removing GHC 7.10.1. 如果您的磁盘空间不足,我建议不要删除GHC 7.10.1。 After all 7.10.2 was released just yesterday, and if you encounter a strange issue with 7.10.2, it might be worth checking whether 7.10.1 was also affected. 毕竟7.10.2刚刚在昨天发布,如果遇到7.10.2的奇怪问题,可能值得检查7.10.1是否也受到影响。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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