神秘的阴谋集团安装问题

发布于 2024-09-06 21:22:53 字数 721 浏览 10 评论 0原文

全新安装“Haskell Platform”。 (OS X Snow-Leopard & Platform 2010.1.0.1),这样做会导致简单的序列导致非常奇怪的 cabal install 行为:

$ cabal install time

$ cabal install random

$ ghc-pkg list random
/Library/Frameworks/GHC.framework/Versions/612/usr/lib/ghc-6.12.1/package.conf.d
   random-1.0.0.2
/Users/yairc/.ghc/i386-darwin-6.12.1/package.conf.d
   random-1.0.0.2

random-1.0.0.2 在我的计算机中安装了两次系统。现在每次执行cabal install random都会重新安装random-1.0.0.2

看起来random依赖于time,并且cabal想要在有新版本的time可用后重新安装它?并且因为两个 random-1.0.0.2 阴谋集团感到困惑,并且总是认为它不是最新的,因为它正在查看第一个?

ghc-pkg check 未发现任何错误。

With a clean install of the "Haskell Platform". (OS X Snow-Leopard & Platform 2010.1.0.1), doing this causes simple sequence causes very weird cabal install behaviour:

$ cabal install time

$ cabal install random

$ ghc-pkg list random
/Library/Frameworks/GHC.framework/Versions/612/usr/lib/ghc-6.12.1/package.conf.d
   random-1.0.0.2
/Users/yairc/.ghc/i386-darwin-6.12.1/package.conf.d
   random-1.0.0.2

random-1.0.0.2 is installed twice in my system. and now doing cabal install random reinstalls random-1.0.0.2 every time.

Looks like random depends on time, and cabal wants to reinstall it after there's a new version of time available? And because of two random-1.0.0.2 cabal is confused and always thinks it's not up to date because it's looking at the first one?

ghc-pkg check finds no errors.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

久光 2024-09-13 21:22:53

请这样做

ghc-pkg check

输出

ghc-pkg list -v

,如果没有显示错误,让我们看看编辑

cabal install random -v

:我可以使用 GHC 6.12.1 重现您的问题,但不能使用 6.12.2 重现您的问题,使用完全相同版本的 cabal-安装(0.8.0)。我会调查一下。

编辑2报告为阴谋集团中的错误 -安装。

Please do

ghc-pkg check

and if that shows no errors, let's see the output from

ghc-pkg list -v

and

cabal install random -v

Edit: I can reproduce your problem with GHC 6.12.1, but not with 6.12.2, using exactly the same version of cabal-install (0.8.0). I'll look into it.

Edit 2: reported as a bug in cabal-install.

凡尘雨 2024-09-13 21:22:53

我有两种可能的解决方案,这两种解决方案都有些危险,但应该可以让您正常安装。我很高兴西蒙关注这个,因为这对我来说听起来像是某种错误。为了获得有效的安装,我会首先尝试以下操作:

ghc-pkg unregister random

然后执行 ghc-pkg list random 以查看安装的内容。我猜测(但我不确定)您仍然拥有 /Library/Frameworks 版本(来自平台),但新安装的版本将会消失。如果是这种情况,请继续执行下一步。如果不是,您可能需要彻底重新安装平台。

假设平台随机仍然存在,请执行以下操作:

cabal unpack random

cd 到其解压到的目录,然后通过将版本更改为 1.0.0.2.1 来编辑 .cabal 文件(添加另一个字段并将其递增 1)。然后从该目录安装 cabal,它应该安装新的随机文件。由于它的版本与平台随机版本不同,因此两者可以安全地共存。

您可以直接从以下位置删除注册文件,而不是执行 ghc-pkg 取消注册

/Users/yairc/.ghc/i386-darwin-6.12.1/package.conf.d

文件名将附加一个哈希值,因此您需要查看目录内容才能实际获取值。只需删除该文件,从那时起 ghc-pkg 和 cabal 就看不到它了。这不会影响平台安装(因此从这个意义上来说它更安全),但仍然有可能对其他已安装的软件包进行软管连接。之后,您可以通过解压并增加上述版本来重新安装随机包。

I have two possible solutions, both of which are somewhat dangerous but should get you a working installation. I'm glad Simon's following this because it sounds like some sort of bug to me. To get a working installation, I would try the following first:

ghc-pkg unregister random

then do ghc-pkg list random to see what's installed. I would guess (but I'm not sure) that you'll still have the /Library/Frameworks version (from the Platform) but the newly-installed version will be gone. If this is the case, proceed to the next step. If it isn't you'll probably need to do a clean reinstall of the platform.

Assuming the platform random is still present, do this:

cabal unpack random

cd to the directory it's unpacked into, and edit the .cabal file by bumping the version to 1.0.0.2.1 (add another field and increment it by one). Then cabal install from that directory and it should install the new random. Since this has a different version than the platform random, the two can safely co-exist.

Rather than doing the ghc-pkg unregister, you can directly delete the registration file from

/Users/yairc/.ghc/i386-darwin-6.12.1/package.conf.d

the file name will have a hash appended to it, so you'll need to look at the directory contents to actually get the value. Just delete the file and ghc-pkg and cabal shouldn't see it from then on. This won't touch the platform installation (so it's safer in that sense), but the potential is still there to hose other installed packages. After this, you can re-install the random package by unpacking and incrementing the version as above.

生寂 2024-09-13 21:22:53

我将描述迄今为止对我有用的解决方法。我尝试了很多不同的事情,但我只会在这里描述有效的尝试。

(顺便说一句:我使用的是 Mac OS X 10.6.4,不同系统上的结果可能会有所不同)

  • 我从源代码安装了 GHC 6.12.3。不要删除以前的 GHC,因为构建 GHC 需要它。
  • 我删除了 /usr/bin 中的符号链接(对于 ghcghcighc-pkg>runhaskell) 到我之前的 GHC,它来自 Haskell Platform 2010.1.0.1 安装程序。
  • 我使用它的 bootstrap.sh 脚本安装了 cabal-install 。
  • 我安装了 randomhaskell98 软件包的修补版本。差异仅在于它们的 .cabal 文件中
    • random的版本提升至1.0.0.2.1,并将其对time的依赖更改为time == 1.1.*
    • haskell98 的版本提升至 1.0.1.1.1,仅此而已
  • 我运行 cabal update 和 < code>cabal Upgrade 查看哪些软件包已过期。我cabal install那些。我相信这有助于更快地达到稳定状态。 (请注意,syb 的安装失败,cabal install parsec 表示没有什么可做的,而 cabal Upgrade 的说法不同。所以我离开了仅这两个包)

我通过在阶段之间运行 ghc-pkg check 来验证我的设置是否正确。有时它会中断,因为在具有相同版本号的先前版本上重新安装了软件包,并且需要重新安装依赖于它的软件包。当这种情况发生时,我会再次cabal install损坏的软件包。

我还使用以下程序来验证我的安装程序不包含两个具有相同版本的软件包:

import Data.List (sort)
import Data.Maybe (fromJust)
import System.IO (hGetContents)
import System.Process (CreateProcess (std_out), StdStream (CreatePipe), createProcess, shell)

main :: IO ()
main = do
    pkgListRaw <-
        createProcess (shell "ghc-pkg list") { std_out = CreatePipe }
        >>= hGetContents . fromJust . sndOfFourTup
    let pkgListSorted = sort . filter (not . null) $ lines pkgListRaw
    putStrLn .
        unlines . map (dropWhile (== ' ') . fst) .
        filter (uncurry (==)) . zip pkgListSorted $ tail pkgListSorted
    where
        sndOfFourTup (_, x, _, _) = x
  • I cabal installed hlint, yesod< /code>、haddockHDBC-mysqlhakyll 等软件包,然后我 cabal install 了前面的一次又一次地列出,直到我的设置达到“稳定状态”,其中 cabal install 不会重新安装任何这些。

  • 我验证了我正在编写的程序现在可以编译并运行。现在一切似乎都很好

注意:

  • 我无法让 Haskell Platform 2010.1.0.1 工作。在我升级到 GHC 6.12.3 后,一切才对我有用。讽刺的是(?),这违背了 GHC 下载页面上的建议:

停下来!

对于大多数用户,我们建议安装 Haskell Platform 而不是 GHC。当前的 Haskell 平台版本包括最近的 GHC 版本以及一些其他工具(例如 cabal),以及一组更大的已知可以协同工作的库。

  • 这个解决方法也可能在未来的某个时候被打破。我想这可能会在几个月后发生。像 random 这样的核心库将得到更新,然后依赖性问题将再次开始解决。然后我/你将不得不花时间来修复我们的设置。也许那时需要升级到更新的 GHC。但谁知道呢,也许这将是一个较旧的版本,随着 hackage 包的更新以解决依赖相关问题,该版本将变得稳定。作为对您的服务,我会在适当的时候更新这个问题和答案。 (假设其他人也遇到这个问题。到目前为止,我验证了 Simon Marlow 和 Peaker 也面临这个问题)

  • 知道你的 Haskell 设置是否损坏的方法(如果其中任何一个为真,则设置已损坏):

    • 没有任何作用
    • ghc-pkg check 表示它已损坏
    • 我在上面的答案中放入其源代码的短程序发现您安装了两次版本完全相同的软件包
    • cabal update 然后循环 cabal install 我上面编写的软件包列表或另一个列表(最好是一个包含大量依赖项的大列表)。如果您从未达到稳定状态(循环的迭代总是会重新安装某些内容),那么您的设置就会被破坏。 警告:此步骤可能会破坏您当前运行的 Haskell 设置。如果您对 Maso 感到好奇或愿意在设置损坏后修复它(这个过程可能很耗时),请执行此操作
  • 我想知道您的设置是否损坏或正常工作。这可以帮助我。例如,如果我们发现 GHC 6.10 设置运行良好,I/U 可以在推荐某人尝试 Haskell 等时向人们推荐这些设置。

我希望这可以帮助其他面临相同或类似问题的人。非常感谢西蒙·马洛和约翰!

I'll describe the work-around that worked so far for me. I've tried many different things but I'll only described here the attempt that worked.

(btw: I'm using Mac OS X 10.6.4 and your results might be different on different systems)

  • I installed GHC 6.12.3 from source. Don't remove your previous GHC as building GHC requires it.
  • I removed the symlinks at /usr/bin (for ghc, ghci, ghc-pkg, and runhaskell) to my previous GHC which was the one from the Haskell Platform 2010.1.0.1 installer.
  • I installed cabal-install using it's bootstrap.sh script.
  • I installed patched versions of the random and haskell98 packages. The differences are just in their .cabal files
    • bumped random's version up to 1.0.0.2.1 and changed it dependency on time to be time == 1.1.*
    • bumped haskell98's versions up to 1.0.1.1.1 and that's it
  • I ran cabal update and cabal upgrade to see which packages are out of date. I did cabal install those. I believe that this helps reach a stable-state faster. (note that syb's install failed and that cabal install parsec said there's nothing to do about it when cabal upgrade said differently. So I left those two packages alone)

I validated that my setup is ok by running ghc-pkg check between stages. Sometimes it breaks because a package gets reinstalled over a previous version with same version number and packages that depended on it need to be reinstalled. When that happens I cabal install the broken packages again.

I also used the following program to verify that my setup doesn't contain two packages with the same version:

import Data.List (sort)
import Data.Maybe (fromJust)
import System.IO (hGetContents)
import System.Process (CreateProcess (std_out), StdStream (CreatePipe), createProcess, shell)

main :: IO ()
main = do
    pkgListRaw <-
        createProcess (shell "ghc-pkg list") { std_out = CreatePipe }
        >>= hGetContents . fromJust . sndOfFourTup
    let pkgListSorted = sort . filter (not . null) $ lines pkgListRaw
    putStrLn .
        unlines . map (dropWhile (== ' ') . fst) .
        filter (uncurry (==)) . zip pkgListSorted $ tail pkgListSorted
    where
        sndOfFourTup (_, x, _, _) = x
  • I cabal installed hlint, yesod, haddock, HDBC-mysql, hakyll and other packages and then I cabal installed the previous list again and again until my setup reached a "stable state" in which cabal install doesn't reinstall any of those.

  • I verified that my own programs I'm working on now compile and work. All seems to be fine now

Notes:

  • I couldn't get Haskell Platform 2010.1.0.1 to work. Things only worked for me after I upgraded to GHC 6.12.3. Ironically (?), this goes against the recommendation on GHC's download page:

Stop!

For most users, we recommend installing the Haskell Platform instead of GHC. The current Haskell Platform release includes a recent GHC release as well as some other tools (such as cabal), and a larger set of libraries that are known to work together.

  • This work-around will probably break sometime in the future as well. I guess that this will probably happen in a few months. A core library like random will get updated and then dependency problems will start to unravel again. Then I'll/you'll have to spend time on getting our setups fixed. Perhaps then it would require upgrading to a newer GHC. But who knows, maybe then it will be an older release that will become stable as hackage packages get updated to solve dependency related problems. As a service to you, I will update this question and answer when the time comes. (Assuming that others are having this problem too. So far I validated that Simon Marlow and Peaker face this problem too)

  • Ways to know that your Haskell setup is broken (if any of these is true then the setup is broken):

    • Nothing works
    • ghc-pkg check says that it is broken
    • The short program whose source I put in this answer above finds that you have a package installed twice with the exact same version
    • cabal update and then cycle cabal installing the list of packages I wrote above, or another list (preferably a big one with lots of dependencies). If you never reach a stable-state (an iteration of the cycle always reinstalls something) then your setup is broken. WARNING: This step may destroy your currently functioning Haskell setup. Do this if you are maso-curious or willing to fix your setup after it breaks (a process which might be time consuming)
  • I would like to know whether your setups are broken or working. This could help me. For example if we find that GHC 6.10 setups are working fine, I/U could recommend those setups to people on the occasion of recommending to someone to try out Haskell etc.

I hope that this helps others facing the same or similar problems. Many thanks to Simon Marlow and John!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文