神秘的阴谋安装问题 [英] mysterious cabal-install problems

查看:151
本文介绍了神秘的阴谋安装问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

  $ cabal安装时间

$ cabal安装随机

$ ghc-pkg list随机
/ 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

看起来像随机取决于时间,并且cabal想要在有新版本后重新安装它的时间可用?并且因为两个 random-1.0.0.2 cabal会感到困惑,并且总是认为它不是最新的,因为它正在查看第一个?



ghc-pkg check 找不到任何错误。

解决方案

<我将描述迄今为止为我工作的解决方法。我已经尝试了很多不同的东西,但我只会在这里描述这种尝试。



(btw:我正在使用Mac OS X 10.6.4并且您的结果可能在不同系统上有所不同)




  • 我从源代码安装了GHC 6.12.3。

  • 我删除了 / usr / bin 中的符号链接(对于 ghc ghci ghc-pkg runhaskell )添加到我以前的GHC中,它是Haskell Platform 2010.1.0.1安装程序中的一个。

  • 我安装了 cabal-install使用它的 bootstrap.sh 脚本。

  • 我安装了修补版本的随机 haskell98 包。差异只是在它们的 .cabal 文件中


      random 的版本高达 1.0.0.2.1 ,并将其依赖于时间更改为 time == 1.1。*
    • 颠簸 haskell98 的版本高达 1.0.1.1.1 就是这样


  • 我运行了 cabal update cabal upgrade 查看哪些软件包已过期。我做了 cabal install 那些。我相信这有助于更快地达到稳定状态。 (请注意, syb 的安装失败,并且 cabal install parsec 表示在<$ c时没有任何关系$ c $>

    我证实了我的通过在阶段之间运行 ghc-pkg check 来完成设置。有时会中断,因为一个软件包被重新安装到以前的版本上,并且版本号相同,并且依赖它的软件包需要重新安装。当发生这种情况时,我再次打破了软件包。

    我也使用下面的程序来验证我的设置不包含两个具有相同版本的软件包:

      import Data.List(sort)
    import Data.Maybe (fromJust)
    导入System.IO(hGetContents)
    导入System.Process(CreateProcess(std_out),StdStream(CreatePipe),createProcess,shell)
    $ b main :: IO )
    main = do
    pkgListRaw< -
    createProcess(shellghc-pkg list){std_out = CreatePipe}
    >>> = hGetContents。来自Just。 sndOfFourTup
    让pkgListSorted =排序。筛选器(非空)$行pkgListRaw
    putStrLn。
    unlines。 map(dropWhile(=='')。fst)。
    过滤器(uncurry(==))。 zip pkgListSorted $ tail pkgListSorted
    其中
    sndOfFourTup(_,x,_,_)= x




    • I cabal install ed hlint yesod haddock HDBC-mysql hakyll 和其他软件包,然后我一次又一次地编辑上一个列表直到我的设置达到稳定状态,其中 cabal install 不会重新安装任何这些程序。

    • 编译和工作。所有似乎都很好




    注意:


    • 我无法使Haskell Platform 2010.1.0.1正常工作。在我升级到GHC 6.12.3后,事情只对我有效。具有讽刺意味的是,这违背了GHC下载页面上的建议: >

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


      • 这种解决方法可能在未来某个时候也会中断。我想这可能会在几个月内发生。像 random 这样的核心库将会得到更新,然后依赖问题将再次开始解开。那么我/你将不得不花费时间来修复我们的设置。也许那时需要升级到更新的GHC。但是谁知道呢,也许这将会是一个老版本,随着hackage软件包得到更新以解决与依赖相关的问题,它会变得稳定。作为对您的服务,我会在时间到来的时候更新这个问题和答案。 (假设其他人也有这个问题,到目前为止我已经证实Simon Marlow和Peaker也面临这个问题)

      • 破坏(如果其中任何一个是真的,那么设置被破坏):


        • 无效

        • ghc-pkg check 表示它已损坏

        • 上面这个答案的源代码的简短程序发现您有一个包使用完全相同的版本安装两次

        • cabal update ,然后循环 cabal install 我上面写的软件包列表,或者另一个列表(最好是一个有很多依赖关系的大软件包)。如果你永远不会达到稳定状态(循环的一次迭代总是重新安装某些东西),那么你的设置就会被破坏。 警告:此步骤可能会破坏您当前正在运行的Haskell设置。如果您对这些设置感到好奇或愿意在破解之后修复您的设置(这一过程可能非常耗时),请执行此操作。
        • 我想知道你的设置是否损坏或工作。这可以帮助我。例如,如果我们发现GHC 6.10设置工作正常,I / U可以在推荐某人试用Haskell等时向用户推荐这些设置。


        >

        我希望这可以帮助其他人面对相同或类似的问题。非常感谢Simon Marlow和John!

        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.

        解决方案

        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!

        这篇关于神秘的阴谋安装问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆