【问题标题】:cabal-install 1.20.0.0 fails to install on OS Xcabal-install 1.20.0.0 无法在 OS X 上安装
【发布时间】:2014-05-02 16:11:22
【问题描述】:

在 OS X 10.9.2 上,我全新安装了 GHC 平台。 (之前有安装,但我相信我通过删除 /Library/Haskell/Users/username/Library/Haskell 将其删除。)该平台随附 Cabal 1.16。我想要最新的支持沙盒的 Cabal,所以我跑了:

cabal update
cabal install cabal --reinstall

一切顺利。但后来我也尝试升级cabal-install

cabal install cabal-install -v

失败,输出如下:

Reading available packages...
Choosing modular solver.
Resolving dependencies...
Ready to install cabal-install-1.20.0.0
Waiting for install task to finish...
Extracting
/Users/username/Library/Haskell/repo-cache/hackage.haskell.org/cabal-install/1.20.0.0/cabal-install-1.20.0.0.tar.gz
to
/var/folders/jt/ywln8_hn75q1yfkhnpcs1bzh0000gn/T/cabal-install-1.20.0.0-51744...
Updating cabal-install.cabal with the latest revision from the index.
Configuring cabal-install-1.20.0.0...
Flags chosen: old-directory=False
Dependency Cabal ==1.20.0.0: using Cabal-1.20.0.0
Dependency HTTP ==4000.2.8: using HTTP-4000.2.8
Dependency array ==0.4.0.1: using array-0.4.0.1
Dependency base ==4.6.0.1: using base-4.6.0.1
Dependency bytestring ==0.10.0.2: using bytestring-0.10.0.2
Dependency containers ==0.5.0.0: using containers-0.5.0.0
Dependency directory ==1.2.0.1: using directory-1.2.0.1
Dependency filepath ==1.3.0.1: using filepath-1.3.0.1
Dependency mtl ==2.1.2: using mtl-2.1.2
Dependency network ==2.4.1.2: using network-2.4.1.2
Dependency pretty ==1.1.1.0: using pretty-1.1.1.0
Dependency process ==1.1.0.2: using process-1.1.0.2
Dependency random ==1.0.1.1: using random-1.0.1.1
Dependency stm ==2.4.2: using stm-2.4.2
Dependency time ==1.4.0.1: using time-1.4.0.1
Dependency unix ==2.6.0.1: using unix-2.6.0.1
Dependency zlib ==0.5.4.1: using zlib-0.5.4.1

/var/folders/jt/ywln8_hn75q1yfkhnpcs1bzh0000gn/T/51744.c:1:12:
     warning: control reaches end of non-void function [-Wreturn-type]
int foo() {}
           ^
1 warning generated.
Using Cabal-1.16.0 compiled by ghc-7.6
Using compiler: ghc-7.6.3
Using install prefix:
/Users/username/Library/Haskell/ghc-7.6.3/lib/cabal-install-1.20.0.0
Binaries installed in:
/Users/username/Library/Haskell/ghc-7.6.3/lib/cabal-install-1.20.0.0/bin
Libraries installed in:
/Users/username/Library/Haskell/ghc-7.6.3/lib/cabal-install-1.20.0.0/lib
Private binaries installed in:
/Users/username/Library/Haskell/ghc-7.6.3/lib/cabal-install-1.20.0.0/libexec
Data files installed in:
/Users/username/Library/Haskell/ghc-7.6.3/lib/cabal-install-1.20.0.0/share
Documentation installed in:
/Users/username/Library/Haskell/ghc-7.6.3/lib/cabal-install-1.20.0.0/doc
Using alex version 3.0.5 found on system at: /usr/bin/alex
Using ar found on system at: /usr/bin/ar
No c2hs found
No cpphs found
No ffihugs found
Using gcc version 4.2.1 found on system at: /usr/bin/gcc
Using ghc version 7.6.3 found on system at: /usr/bin/ghc
Using ghc-pkg version 7.6.3 found on system at: /usr/bin/ghc-pkg
No greencard found
Using haddock version 2.13.2 found on system at: /usr/bin/haddock
Using happy version 1.18.10 found on system at: /usr/bin/happy
No hmake found
Using hpc version 0.6 found on system at: /usr/bin/hpc
Using hsc2hs version 0.67 found on system at: /usr/bin/hsc2hs
No hscolour found
No hugs found
No jhc found
Using ld found on system at: /usr/bin/ld
No lhc found
No lhc-pkg found
No nhc98 found
Using pkg-config version 0.28 found on system at: /usr/local/bin/pkg-config
Using ranlib found on system at: /usr/bin/ranlib
Using strip found on system at: /usr/bin/strip
Using tar found on system at: /usr/bin/tar
No uhc found
creating dist/build
creating dist/build/autogen
Building cabal-install-1.20.0.0...
Preprocessing executable 'cabal' for cabal-install-1.20.0.0...
Building executable cabal...
creating dist/build/cabal
creating dist/build/cabal/cabal-tmp
Building C Sources.
creating dist/build/cabal/cabal-tmp
/usr/bin/ghc -c -odir dist/build/cabal/cabal-tmp -Idist/build/cabal/cabal-tmp -optc-O2 -package-db dist/package.conf.inplace -package-id Cabal-1.20.0.0-ed0a7e0a5adc8ca1f9e6d405d3a3d56c -package-id HTTP-4000.2.8-cdf033f9d7051824f52cd5101df67509 -package-id array-0.4.0.1-3b78425c10ff2dad7acf7e8c8ae014c3 -package-id base-4.6.0.1-6c351d70a24d3e96f315cba68f3acf57 -package-id bytestring-0.10.0.2-bf7aaeef3f644374cd7d5a9066cd9017 -package-id containers-0.5.0.0-ab1dae9a94cd3cc84e7b2805636ebfa2 -package-id directory-1.2.0.1-b2c415ae3fe3357f80678150b6da5a3c -package-id filepath-1.3.0.1-b12cbe18566fe1532a1fda4c85e31cbe -package-id mtl-2.1.2-94c72af955e94b8d7b2f359dadd0cb62 -package-id network-2.4.1.2-28b12b2ed8a678ffb29bc07483d3d363 -package-id pretty-1.1.1.0-66181c695e6a2e173ba2088cf55cc396 -package-id process-1.1.0.2-d20d01635195e5ac2ebee73032c7fe84 -package-id random-1.0.1.1-ecb94a9408452ed74f22425077442903 -package-id stm-2.4.2-b5d718b1a5f1fbcdb61a336aef0c2130 -package-id time-1.4.0.1-10dc4804a19dc0000fab79908f1a9f50 -package-id unix-2.6.0.1-1b262a42f35f597365016088e0cde399 -package-id zlib-0.5.4.1-13ba81ac0d7e6f3bdf1ee5ddce4e9aab cbits/getnumcores.c
<command line>: cannot satisfy -package-id HTTP-4000.2.8-cdf033f9d7051824f52cd5101df67509
    (use -v for more information)
Failed to install cabal-install-1.20.0.0
World file is already up to date.
cabal: Error: some packages failed to install:
cabal-install-1.20.0.0 failed during the building phase. The exception was:
ExitFailure 1

我对 Haskell 包装不是特别熟悉。错误似乎是说找不到包HTTP-4000.2.8-cdf033f9d7051824f52cd5101df67509。我不知道校验和,但从the docs 可以清楚地看出确实存在版本 4000.2.8。

如何清除此错误并获取最新的cabal-install

编辑:这是 ghc-pkg describe HTTP 的输出,根据 cmets 的要求:

WARNING: cache is out of date: /Library/Frameworks/GHC.framework/Versions/7.6.3-x86_64/usr/lib/ghc-7.6.3/package.conf.d/package.cache
  use 'ghc-pkg recache' to fix.
name: HTTP
version: 4000.2.8
id: HTTP-4000.2.8-cdf033f9d7051824f52cd5101df67509
license: BSD3
copyright:
maintainer: Ganesh Sittampalam <http@projects.haskell.org>
stability:
homepage: https://github.com/haskell/HTTP
package-url:
synopsis: A library for client-side HTTP
description: The HTTP package supports client-side web programming in Haskell. It lets you set up
             HTTP connections, transmitting requests and processing the responses coming back, all
             from within the comforts of Haskell. It's dependent on the network package to operate,
             but other than that, the implementation is all written in Haskell.
             .
             A basic API for issuing single HTTP requests + receiving responses is provided. On top
             of that, a session-level abstraction is also on offer  (the @BrowserAction@ monad);
             it taking care of handling the management of persistent connections, proxies,
             state (cookies) and authentication credentials required to handle multi-step
             interactions with a web server.
             .
             The representation of the bytes flowing across is extensible via the use of a type class,
             letting you pick the representation of requests and responses that best fits your use.
             Some pre-packaged, common instances are provided for you (@ByteString@, @String@.)
             .
             Here's an example use:
             .
             >
             >    do
             >      rsp <- Network.HTTP.simpleHTTP (getRequest "http://www.haskell.org/")
             >              -- fetch document and return it (as a 'String'.)
             >      fmap (take 100) (getResponseBody rsp)
             >
             >    do
             >      (_, rsp)
             >         <- Network.Browser.browse $ do
             >               setAllowRedirects True -- handle HTTP redirects
             >               request $ getRequest "http://www.haskell.org/"
             >      return (take 100 (rspBody rsp))
category: Network
author: Warrick Gray <warrick.gray@hotmail.com>
exposed: True
exposed-modules: Network.BufferType Network.Stream
                 Network.StreamDebugger Network.StreamSocket Network.TCP
                 Network.HTTP Network.HTTP.Headers Network.HTTP.Base
                 Network.HTTP.Stream Network.HTTP.Auth Network.HTTP.Cookie
                 Network.HTTP.Proxy Network.HTTP.HandleStream Network.Browser
hidden-modules: Network.HTTP.Base64 Network.HTTP.MD5Aux
                Network.HTTP.Utils Paths_HTTP
trusted: False
import-dirs: /Library/Haskell/ghc-7.6.3/lib/HTTP-4000.2.8/lib
library-dirs: /Library/Haskell/ghc-7.6.3/lib/HTTP-4000.2.8/lib
hs-libraries: HSHTTP-4000.2.8
extra-libraries:
extra-ghci-libraries:
include-dirs:
includes:
depends: array-0.4.0.1-3b78425c10ff2dad7acf7e8c8ae014c3
         base-4.6.0.1-6c351d70a24d3e96f315cba68f3acf57
         bytestring-0.10.0.2-bf7aaeef3f644374cd7d5a9066cd9017
         mtl-2.1.2-94c72af955e94b8d7b2f359dadd0cb62
         network-2.4.1.2-28b12b2ed8a678ffb29bc07483d3d363
         old-time-1.1.0.1-4096e5c0be1f1ff8883115216d1bc5d1
         parsec-3.1.3-a8edfa168176dff038c6dcd45a539942
hugs-options:
cc-options:
ld-options:
framework-dirs:
frameworks:
haddock-interfaces: /Library/Haskell/ghc-7.6.3/lib/HTTP-4000.2.8/doc/html/HTTP.haddock
haddock-html: /Library/Haskell/ghc-7.6.3/lib/HTTP-4000.2.8/doc/html
pkgroot: "/Library/Frameworks/GHC.framework/Versions/7.6.3-x86_64/usr/lib/ghc-7.6.3"

【问题讨论】:

  • ghc-pkg describe HTTP 的输出是什么 - 具体来说,您安装的软件包的校验和是否与 cabal 指定的校验和匹配(在“无法满足”行)?
  • 我已编辑问题以包含该信息。是的,校验和匹配。两者都是 cdf033f9d7051824f52cd5101df67509。
  • ghc-pkg 说你应该recache。如果这不能解决问题,那么我不知道还有什么可能。
  • 谢谢!这至少使它编译。但奇怪的是,我最终还是使用了 cabal-install 1.6。我的目标是从 1.8 获得沙盒功能。有什么想法吗?
  • 手动指定版本:cabal install cabal-install-&lt;version&gt;,它尝试安装1.20,但这不一定会替换旧版本,因为haskell平台将可执行文件放在与cabal-install不同的位置。

标签: haskell cabal


【解决方案1】:

解决方案分为两部分。

首先,我必须做ghc-pkg recache。然后,我必须通过运行cabal install cabal-install-1.20.0.0 明确请求最新版本的cabal-install。我不清楚为什么要获得像cabal-install 这样基本的东西的最新版本就需要这些步骤中的任何一个。但至少现在有解决方案。

【讨论】:

  • 我添加了一个类似的问题。这也对我有用。出于奇怪的原因,我不得不做一个sudo
  • @mb14,你知道安装的文件去哪了吗?对我来说,他们进入了 ~/Library/Haskell,它应该可以在没有 sudo 的情况下编写。您无法写入该文件夹或其任何子文件夹吗?
  • 他们在/Library/Haskell。我不记得我是如何安装它的。可能使用haskell平台包。
  • 这就是原因。 /Library 是用户没有写入权限的系统文件夹。 ~/图书馆属于用户。
  • 当您在 OSX 上使用 haskell-platform 运行 ghc-pkg recache 时,您需要使用 sudo 运行它,因为它默认重新缓存全局包。这些包缓存在/Library/Frameworks/GHC.framework/ 内,因此是“根区域”。运行ghc-pkg recache --user~/Library/Haskell 中的包运行它(与~/.ghc 相关)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-01-22
  • 1970-01-01
  • 1970-01-01
  • 2014-04-14
  • 2016-06-01
  • 2012-05-03
  • 2015-01-21
相关资源
最近更新 更多