5

我对 Haskell 世界很陌生,我想使用包HaskellCharts。要走的路似乎是使用 cabal,所以我cabal-install从我的存储库安装(我在 Ubuntu 10.04.4 LTS 32 位上)。

我的规格是:

$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.12.1
$ which ghc
/usr/bin/ghc

$ cabal --version
cabal-install version 0.8.0
using version 1.8.0.2 of the Cabal library

HaskellCharts 安装指南(截至 2010 年 5 月 27 日)告诉我

cabal update
cabal install gtk2hs-buildtools
cabal install gtk
cabal install chart

cabal update成功并告诉我有更新版本的 cabal 可用。

$ cabal install gtk2hs-buildtools

然而,产量

Resolving dependencies...
Downloading gtk2hs-buildtools-0.12.3.1...
Configuring gtk2hs-buildtools-0.12.3.1...
cabal: alex is required but it could not be found.
cabal: Error: some packages failed to install:
gtk2hs-buildtools-0.12.3.1 failed during the configure step. The exception
was:
ExitFailure 1

所以我尝试先安装alex,但这也会导致错误,我无法确定其来源:

$ cabal install alex
Resolving dependencies...
Downloading alex-3.0.2...
[1 of 1] Compiling Main             ( /tmp/alex-3.0.219087/alex-3.0.2/Setup.lhs, /tmp/alex-3.0.219087/alex-3.0.2/dist/setup/Main.o )
Linking /tmp/alex-3.0.219087/alex-3.0.2/dist/setup/setup ...
Configuring alex-3.0.2...
Preprocessing executables for alex-3.0.2...
Building alex-3.0.2...
ghc: unrecognised flags: -rtsopts
Usage: For basic information, try the `--help' option.
cabal: Error: some packages failed to install:
alex-3.0.2 failed during the building phase. The exception was:
ExitFailure 1

为了确保问题不会因包的过时版本/不兼容版本等引起,我尝试更新 cabal 本身。

$ cabal install cabal-install

导致

Resolving dependencies...
Warning: network.cabal: Ignoring unknown section type: test-suite
Warning: network.cabal: Ignoring unknown section type: test-suite
Configuring network-2.3.1.0...
configure: WARNING: unrecognized options: --with-compiler
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for an ANSI C-conforming const... yes
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking for stdlib.h... (cached) yes
checking for sys/types.h... (cached) yes
checking for unistd.h... (cached) yes
checking winsock2.h usability... no
checking winsock2.h presence... no
checking for winsock2.h... no
checking ws2tcpip.h usability... no
checking ws2tcpip.h presence... no
checking for ws2tcpip.h... no
checking wspiapi.h usability... no
checking wspiapi.h presence... no
checking for wspiapi.h... no
checking arpa/inet.h usability... yes
checking arpa/inet.h presence... yes
checking for arpa/inet.h... yes
checking netdb.h usability... yes
checking netdb.h presence... yes
checking for netdb.h... yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking netinet/tcp.h usability... yes
checking netinet/tcp.h presence... yes
checking for netinet/tcp.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking sys/uio.h usability... yes
checking sys/uio.h presence... yes
checking for sys/uio.h... yes
checking sys/un.h usability... yes
checking sys/un.h presence... yes
checking for sys/un.h... yes
checking for readlink... yes
checking for symlink... yes
checking for struct msghdr.msg_control... yes
checking for struct msghdr.msg_accrights... no
checking for struct sockaddr.sa_len... no
checking for in_addr_t in netinet/in.h... yes
checking for SO_PEERCRED and struct ucred in sys/socket.h... yes
checking for _head_libws2_32_a in -lws2_32... no
checking for getaddrinfo... yes
checking for gai_strerror... yes
checking whether AI_ADDRCONFIG is declared... yes
checking whether AI_ALL is declared... yes
checking whether AI_NUMERICSERV is declared... yes
checking whether AI_V4MAPPED is declared... yes
checking whether IPV6_V6ONLY is declared... yes
checking for sendfile in sys/sendfile.h... yes
checking for sendfile in sys/socket.h... no
checking for gethostent... yes
checking for accept4... yes
configure: creating ./config.status
config.status: creating network.buildinfo
config.status: creating include/HsNetworkConfig.h
configure: WARNING: unrecognized options: --with-compiler
Preprocessing library network-2.3.1.0...
Building network-2.3.1.0...
[ 1 of 10] Compiling Network.URI      ( Network/URI.hs, dist/build/Network/URI.o )

Network/URI.hs:580:24:
    Couldn't match expected type `Char' against inferred type `[Char]'
      Expected type: GenParser Char () Char
      Inferred type: URIParser String
    In the first argument of `notFollowedBy', namely `regName'
    In a stmt of a 'do' expression: notFollowedBy regName
cabal: Error: some packages failed to install:
HTTP-4000.2.3 depends on network-2.3.1.0 which failed to install.
cabal-install-0.10.2 depends on network-2.3.1.0 which failed to install.
network-2.3.1.0 failed during the building phase. The exception was:
ExitFailure 1

尝试network通过自己安装软件包会cabal install network产生完全相同的错误。

我试过

$ ghc-pkg check

打印这个:

There are problems in package QuickCheck-2.5:
  import-dirs: /home/kenny/.cabal/lib/QuickCheck-2.5/ghc-6.12.1 doesn't exist or isn't a directory
  library-dirs: /home/kenny/.cabal/lib/QuickCheck-2.5/ghc-6.12.1 doesn't exist or isn't a directory
  file Test/QuickCheck/All.hi is missing
  file Test/QuickCheck/Function.hi is missing
  file Test/QuickCheck.hi is missing
  file Test/QuickCheck/Arbitrary.hi is missing
  file Test/QuickCheck/Gen.hi is missing
  file Test/QuickCheck/Monadic.hi is missing
  file Test/QuickCheck/Modifiers.hi is missing
  file Test/QuickCheck/Property.hi is missing
  file Test/QuickCheck/Test.hi is missing
  file Test/QuickCheck/Text.hi is missing
  file Test/QuickCheck/Poly.hi is missing
  file Test/QuickCheck/State.hi is missing
  file Test/QuickCheck/Exception.hi is missing
  cannot find libHSQuickCheck-2.5.a on library path
There are problems in package Chart-0.16:
  import-dirs: /home/kenny/.cabal/lib/Chart-0.16/ghc-6.12.1 doesn't exist or isn't a directory
  library-dirs: /home/kenny/.cabal/lib/Chart-0.16/ghc-6.12.1 doesn't exist or isn't a directory
  file Graphics/Rendering/Chart.hi is missing
  file Graphics/Rendering/Chart/Types.hi is missing
  file Graphics/Rendering/Chart/Renderable.hi is missing
  file Graphics/Rendering/Chart/Axis.hi is missing
  file Graphics/Rendering/Chart/Axis/Floating.hi is missing
  file Graphics/Rendering/Chart/Axis/Indexed.hi is missing
  file Graphics/Rendering/Chart/Axis/Int.hi is missing
  file Graphics/Rendering/Chart/Axis/LocalTime.hi is missing
  file Graphics/Rendering/Chart/Axis/Types.hi is missing
  file Graphics/Rendering/Chart/Axis/Unit.hi is missing
  file Graphics/Rendering/Chart/Layout.hi is missing
  file Graphics/Rendering/Chart/Legend.hi is missing
  file Graphics/Rendering/Chart/Simple.hi is missing
  file Graphics/Rendering/Chart/Simple/Internal.hi is missing
  file Graphics/Rendering/Chart/Grid.hi is missing
  file Graphics/Rendering/Chart/Plot.hi is missing
  file Graphics/Rendering/Chart/Plot/Types.hi is missing
  file Graphics/Rendering/Chart/Plot/Annotation.hi is missing
  file Graphics/Rendering/Chart/Plot/AreaSpots.hi is missing
  file Graphics/Rendering/Chart/Plot/Bars.hi is missing
  file Graphics/Rendering/Chart/Plot/Candle.hi is missing
  file Graphics/Rendering/Chart/Plot/ErrBars.hi is missing
  file Graphics/Rendering/Chart/Plot/FillBetween.hi is missing
  file Graphics/Rendering/Chart/Plot/Hidden.hi is missing
  file Graphics/Rendering/Chart/Plot/Lines.hi is missing
  file Graphics/Rendering/Chart/Plot/Pie.hi is missing
  file Graphics/Rendering/Chart/Plot/Points.hi is missing
  file Graphics/Rendering/Chart/SparkLine.hi is missing
  cannot find libHSChart-0.16.a on library path
There are problems in package data-accessor-template-0.2.1.9:
  import-dirs: /home/kenny/.cabal/lib/data-accessor-template-0.2.1.9/ghc-6.12.1 doesn't exist or isn't a directory
  library-dirs: /home/kenny/.cabal/lib/data-accessor-template-0.2.1.9/ghc-6.12.1 doesn't exist or isn't a directory
  file Data/Accessor/Template.hi is missing
  file Data/Accessor/Template/Example.hi is missing
  cannot find libHSdata-accessor-template-0.2.1.9.a on library path
There are problems in package utility-ht-0.0.8:
  import-dirs: /home/kenny/.cabal/lib/utility-ht-0.0.8/ghc-6.12.1 doesn't exist or isn't a directory
  library-dirs: /home/kenny/.cabal/lib/utility-ht-0.0.8/ghc-6.12.1 doesn't exist or isn't a directory
  file Data/Bool/HT.hi is missing
  file Data/Eq/HT.hi is missing
  file Data/Function/HT.hi is missing
  file Data/Ix/Enum.hi is missing
  file Data/List/HT.hi is missing
  file Data/List/Key.hi is missing
  file Data/List/Match.hi is missing
  file Data/Maybe/HT.hi is missing
  file Data/Monoid/HT.hi is missing
  file Data/Ord/HT.hi is missing
  file Data/Record/HT.hi is missing
  file Data/String/HT.hi is missing
  file Data/Tuple/HT.hi is missing
  file Control/Monad/HT.hi is missing
  file Control/Functor/HT.hi is missing
  file Data/Strictness/HT.hi is missing
  file Text/Read/HT.hi is missing
  file Text/Show/HT.hi is missing
  file Data/Bool/HT/Private.hi is missing
  file Data/List/HT/Private.hi is missing
  file Data/List/Key/Private.hi is missing
  file Data/List/Match/Private.hi is missing
  file Data/Function/HT/Private.hi is missing
  file Data/Record/HT/Private.hi is missing
  cannot find libHSutility-ht-0.0.8.a on library path
There are problems in package data-accessor-0.2.2.2:
  import-dirs: /home/kenny/.cabal/lib/data-accessor-0.2.2.2/ghc-6.12.1 doesn't exist or isn't a directory
  library-dirs: /home/kenny/.cabal/lib/data-accessor-0.2.2.2/ghc-6.12.1 doesn't exist or isn't a directory
  file Data/Accessor.hi is missing
  file Data/Accessor/Basic.hi is missing
  file Data/Accessor/Container.hi is missing
  file Data/Accessor/Show.hi is missing
  file Data/Accessor/Tuple.hi is missing
  file Data/Accessor/BinaryRead.hi is missing
  file Data/Accessor/MonadState.hi is missing
  file Data/Accessor/Example.hi is missing
  file Data/Accessor/Private.hi is missing
  file Data/Accessor/MonadStatePrivate.hi is missing
  cannot find libHSdata-accessor-0.2.2.2.a on library path
There are problems in package mtl-2.1.2:
  import-dirs: /home/kenny/.cabal/lib/mtl-2.1.2/ghc-6.12.1 doesn't exist or isn't a directory
  library-dirs: /home/kenny/.cabal/lib/mtl-2.1.2/ghc-6.12.1 doesn't exist or isn't a directory
  file Control/Monad/Cont.hi is missing
  file Control/Monad/Cont/Class.hi is missing
  file Control/Monad/Error.hi is missing
  file Control/Monad/Error/Class.hi is missing
  file Control/Monad/Identity.hi is missing
  file Control/Monad/List.hi is missing
  file Control/Monad/RWS.hi is missing
  file Control/Monad/RWS/Class.hi is missing
  file Control/Monad/RWS/Lazy.hi is missing
  file Control/Monad/RWS/Strict.hi is missing
  file Control/Monad/Reader.hi is missing
  file Control/Monad/Reader/Class.hi is missing
  file Control/Monad/State.hi is missing
  file Control/Monad/State/Class.hi is missing
  file Control/Monad/State/Lazy.hi is missing
  file Control/Monad/State/Strict.hi is missing
  file Control/Monad/Trans.hi is missing
  file Control/Monad/Writer.hi is missing
  file Control/Monad/Writer/Class.hi is missing
  file Control/Monad/Writer/Lazy.hi is missing
  file Control/Monad/Writer/Strict.hi is missing
  cannot find libHSmtl-2.1.2.a on library path
There are problems in package transformers-0.3.0.0:
  import-dirs: /home/kenny/.cabal/lib/transformers-0.3.0.0/ghc-6.12.1 doesn't exist or isn't a directory
  library-dirs: /home/kenny/.cabal/lib/transformers-0.3.0.0/ghc-6.12.1 doesn't exist or isn't a directory
  file Control/Applicative/Backwards.hi is missing
  file Control/Applicative/Lift.hi is missing
  file Control/Monad/IO/Class.hi is missing
  file Control/Monad/Trans/Class.hi is missing
  file Control/Monad/Trans/Cont.hi is missing
  file Control/Monad/Trans/Error.hi is missing
  file Control/Monad/Trans/Identity.hi is missing
  file Control/Monad/Trans/List.hi is missing
  file Control/Monad/Trans/Maybe.hi is missing
  file Control/Monad/Trans/Reader.hi is missing
  file Control/Monad/Trans/RWS.hi is missing
  file Control/Monad/Trans/RWS/Lazy.hi is missing
  file Control/Monad/Trans/RWS/Strict.hi is missing
  file Control/Monad/Trans/State.hi is missing
  file Control/Monad/Trans/State/Lazy.hi is missing
  file Control/Monad/Trans/State/Strict.hi is missing
  file Control/Monad/Trans/Writer.hi is missing
  file Control/Monad/Trans/Writer/Lazy.hi is missing
  file Control/Monad/Trans/Writer/Strict.hi is missing
  file Data/Functor/Compose.hi is missing
  file Data/Functor/Constant.hi is missing
  file Data/Functor/Identity.hi is missing
  file Data/Functor/Product.hi is missing
  file Data/Functor/Reverse.hi is missing
  cannot find libHStransformers-0.3.0.0.a on library path
There are problems in package Cabal-1.14.0:
  import-dirs: /home/kenny/.cabal/lib/Cabal-1.14.0/ghc-6.12.1 doesn't exist or isn't a directory
  library-dirs: /home/kenny/.cabal/lib/Cabal-1.14.0/ghc-6.12.1 doesn't exist or isn't a directory
  file Distribution/Compiler.hi is missing
  file Distribution/InstalledPackageInfo.hi is missing
  file Distribution/License.hi is missing
  file Distribution/Make.hi is missing
  file Distribution/ModuleName.hi is missing
  file Distribution/Package.hi is missing
  file Distribution/PackageDescription.hi is missing
  file Distribution/PackageDescription/Configuration.hi is missing
  file Distribution/PackageDescription/Parse.hi is missing
  file Distribution/PackageDescription/Check.hi is missing
  file Distribution/PackageDescription/PrettyPrint.hi is missing
  file Distribution/ParseUtils.hi is missing
  file Distribution/ReadE.hi is missing
  file Distribution/Simple.hi is missing
  file Distribution/Simple/Build.hi is missing
  file Distribution/Simple/Build/Macros.hi is missing
  file Distribution/Simple/Build/PathsModule.hi is missing
  file Distribution/Simple/BuildPaths.hi is missing
  file Distribution/Simple/Bench.hi is missing
  file Distribution/Simple/Command.hi is missing
  file Distribution/Simple/Compiler.hi is missing
  file Distribution/Simple/Configure.hi is missing
  file Distribution/Simple/GHC.hi is missing
  file Distribution/Simple/LHC.hi is missing
  file Distribution/Simple/Haddock.hi is missing
  file Distribution/Simple/Hpc.hi is missing
  file Distribution/Simple/Hugs.hi is missing
  file Distribution/Simple/Install.hi is missing
  file Distribution/Simple/InstallDirs.hi is missing
  file Distribution/Simple/JHC.hi is missing
  file Distribution/Simple/LocalBuildInfo.hi is missing
  file Distribution/Simple/NHC.hi is missing
  file Distribution/Simple/PackageIndex.hi is missing
  file Distribution/Simple/PreProcess.hi is missing
  file Distribution/Simple/PreProcess/Unlit.hi is missing
  file Distribution/Simple/Program.hi is missing
  file Distribution/Simple/Program/Ar.hi is missing
  file Distribution/Simple/Program/Builtin.hi is missing
  file Distribution/Simple/Program/Db.hi is missing
  file Distribution/Simple/Program/HcPkg.hi is missing
  file Distribution/Simple/Program/Hpc.hi is missing
  file Distribution/Simple/Program/Ld.hi is missing
  file Distribution/Simple/Program/Run.hi is missing
  file Distribution/Simple/Program/Script.hi is missing
  file Distribution/Simple/Program/Types.hi is missing
  file Distribution/Simple/Register.hi is missing
  file Distribution/Simple/Setup.hi is missing
  file Distribution/Simple/SrcDist.hi is missing
  file Distribution/Simple/Test.hi is missing
  file Distribution/Simple/UHC.hi is missing
  file Distribution/Simple/UserHooks.hi is missing
  file Distribution/Simple/Utils.hi is missing
  file Distribution/System.hi is missing
  file Distribution/TestSuite.hi is missing
  file Distribution/Text.hi is missing
  file Distribution/Verbosity.hi is missing
  file Distribution/Version.hi is missing
  file Distribution/Compat/ReadP.hi is missing
  file Language/Haskell/Extension.hi is missing
  file Distribution/GetOpt.hi is missing
  file Distribution/Compat/Exception.hi is missing
  file Distribution/Compat/CopyFile.hi is missing
  file Distribution/Compat/TempFile.hi is missing
  file Distribution/Simple/GHC/IPI641.hi is missing
  file Distribution/Simple/GHC/IPI642.hi is missing
  file Paths_Cabal.hi is missing
  cannot find libHSCabal-1.14.0.a on library path
There are problems in package zlib-0.5.3.3:
  import-dirs: /home/kenny/.cabal/lib/zlib-0.5.3.3/ghc-6.12.1 doesn't exist or isn't a directory
  library-dirs: /home/kenny/.cabal/lib/zlib-0.5.3.3/ghc-6.12.1 doesn't exist or isn't a directory
  file Codec/Compression/GZip.hi is missing
  file Codec/Compression/Zlib.hi is missing
  file Codec/Compression/Zlib/Raw.hi is missing
  file Codec/Compression/Zlib/Internal.hi is missing
  file Codec/Compression/Zlib/Stream.hi is missing
  cannot find libHSzlib-0.5.3.3.a on library path
There are problems in package colour-2.3.3:
  import-dirs: /home/kenny/.cabal/lib/colour-2.3.3/ghc-6.12.1 doesn't exist or isn't a directory
  library-dirs: /home/kenny/.cabal/lib/colour-2.3.3/ghc-6.12.1 doesn't exist or isn't a directory
  file Data/Colour.hi is missing
  file Data/Colour/SRGB.hi is missing
  file Data/Colour/SRGB/Linear.hi is missing
  file Data/Colour/CIE.hi is missing
  file Data/Colour/CIE/Illuminant.hi is missing
  file Data/Colour/RGBSpace.hi is missing
  file Data/Colour/RGBSpace/HSL.hi is missing
  file Data/Colour/RGBSpace/HSV.hi is missing
  file Data/Colour/Names.hi is missing
  file Data/Colour/Internal.hi is missing
  file Data/Colour/Chan.hi is missing
  file Data/Colour/RGB.hi is missing
  file Data/Colour/Matrix.hi is missing
  file Data/Colour/CIE/Chromaticity.hi is missing
  cannot find libHScolour-2.3.3.a on library path
There are problems in package Cabal-1.10.2.0:
  import-dirs: /home/kenny/.cabal/lib/Cabal-1.10.2.0/ghc-6.12.1 doesn't exist or isn't a directory
  library-dirs: /home/kenny/.cabal/lib/Cabal-1.10.2.0/ghc-6.12.1 doesn't exist or isn't a directory
  file Distribution/Compiler.hi is missing
  file Distribution/InstalledPackageInfo.hi is missing
  file Distribution/License.hi is missing
  file Distribution/Make.hi is missing
  file Distribution/ModuleName.hi is missing
  file Distribution/Package.hi is missing
  file Distribution/PackageDescription.hi is missing
  file Distribution/PackageDescription/Configuration.hi is missing
  file Distribution/PackageDescription/Parse.hi is missing
  file Distribution/PackageDescription/Check.hi is missing
  file Distribution/ParseUtils.hi is missing
  file Distribution/ReadE.hi is missing
  file Distribution/Simple.hi is missing
  file Distribution/Simple/Build.hi is missing
  file Distribution/Simple/Build/Macros.hi is missing
  file Distribution/Simple/Build/PathsModule.hi is missing
  file Distribution/Simple/BuildPaths.hi is missing
  file Distribution/Simple/Command.hi is missing
  file Distribution/Simple/Compiler.hi is missing
  file Distribution/Simple/Configure.hi is missing
  file Distribution/Simple/GHC.hi is missing
  file Distribution/Simple/LHC.hi is missing
  file Distribution/Simple/Haddock.hi is missing
  file Distribution/Simple/Hugs.hi is missing
  file Distribution/Simple/Install.hi is missing
  file Distribution/Simple/InstallDirs.hi is missing
  file Distribution/Simple/JHC.hi is missing
  file Distribution/Simple/LocalBuildInfo.hi is missing
  file Distribution/Simple/NHC.hi is missing
  file Distribution/Simple/PackageIndex.hi is missing
  file Distribution/Simple/PreProcess.hi is missing
  file Distribution/Simple/PreProcess/Unlit.hi is missing
  file Distribution/Simple/Program.hi is missing
  file Distribution/Simple/Program/Ar.hi is missing
  file Distribution/Simple/Program/Builtin.hi is missing
  file Distribution/Simple/Program/Db.hi is missing
  file Distribution/Simple/Program/HcPkg.hi is missing
  file Distribution/Simple/Program/Ld.hi is missing
  file Distribution/Simple/Program/Run.hi is missing
  file Distribution/Simple/Program/Script.hi is missing
  file Distribution/Simple/Program/Types.hi is missing
  file Distribution/Simple/Register.hi is missing
  file Distribution/Simple/Setup.hi is missing
  file Distribution/Simple/SrcDist.hi is missing
  file Distribution/Simple/Test.hi is missing
  file Distribution/Simple/UHC.hi is missing
  file Distribution/Simple/UserHooks.hi is missing
  file Distribution/Simple/Utils.hi is missing
  file Distribution/System.hi is missing
  file Distribution/TestSuite.hi is missing
  file Distribution/Text.hi is missing
  file Distribution/Verbosity.hi is missing
  file Distribution/Version.hi is missing
  file Distribution/Compat/ReadP.hi is missing
  file Language/Haskell/Extension.hi is missing
  file Distribution/GetOpt.hi is missing
  file Distribution/Compat/Exception.hi is missing
  file Distribution/Compat/CopyFile.hi is missing
  file Distribution/Compat/TempFile.hi is missing
  file Distribution/Simple/GHC/IPI641.hi is missing
  file Distribution/Simple/GHC/IPI642.hi is missing
  file Paths_Cabal.hi is missing
  cannot find libHSCabal-1.10.2.0.a on library path

The following packages are broken, either because they have a problem
listed above, or because they depend on a broken package.
QuickCheck-2.5
Chart-0.16
data-accessor-template-0.2.1.9
utility-ht-0.0.8
data-accessor-0.2.2.2
mtl-2.1.2
transformers-0.3.0.0
Cabal-1.14.0
zlib-0.5.3.3
colour-2.3.3
Cabal-1.10.2.0

我重新安装了上面提到的所有软件包cabal install --reinstall $PACKAGE。在此之后,除了Cabal-1.10.2.0之外ghc-pkg check不再产生错误。我觉得很奇怪的是

$ cabal install --reinstall Cabal

尝试安装 Cabal-1.14.0,这似乎工作正常,但ghc-pkg check仍然抱怨缺少或损坏的 Cabal-1.10.2.0。

关于网络包安装不成功的堆栈跟踪在我看来好像网络包本身没有正确构建(似乎有编译错误?)。

我也使用 sudo 尝试了整个过程,但没有任何区别。我还发现cabal-install-0.10.2 在构建阶段失败,它处理类似的神秘“无法安装包”错误,但问题似乎并没有真正解决。

我在这里做什么?目前,对我来说,它看起来像是一个非常糟糕的阴谋集团。对此我有什么可以做的,或者我应该忘记它并从 Haskell 网站下载 Haskell 平台?

4

1 回答 1

5

最简单的解决方案是从头开始升级,从 GHC 开始。版本 6.12 是旧的。但是,如果由于某种原因您不能或不想升级 GHC,这里有一些旨在帮助您解决每个问题的提示。

cabal:需要 alex,但找不到。

你的本能cabal install alex是正确的反应。

ghc:无法识别的标志:-rtsopts

看起来你有一个老式的 GHC;该-rtsopts标志是在 GHC 7 中添加的(我在您的问题后面看到您正在运行 6.12)。您可能应该尝试安装 alex 的旧版本——也许是 6.12 的同时代版本,它是在 2.5 年前左右发布的。或者,如果您认为它仍应支持 GHC6,请向 alex 维护者投诉。另一种选择是尝试自己修复它;.cabal查看与 alex 捆绑的文件,看看是否只是删除-rtsopts标志可以让事情继续下去。

无法将预期类型“Char”与推断类型“[Char]”匹配

不太确定这一点,但听起来network' 的依赖项的版本界限不够严格。同样,一种解决方案是尝试安装较旧版本的网络,另一种解决方案是尝试通过更改network's.cabal文件自行修复它。老实说,这听起来像是你谈论的所有问题中最难解决的问题。

notFollowedBy(编辑添加:) 根据关于#haskell 的一些讨论, parsec-2 和 parsec-3 之间的类型似乎发生了变化。因此,这可能就像将网络的 cabal 文件中的依赖项提高到 parsec >= 3 而不是 >= 2 一样简单。

ghc-pkg check仍然不断抱怨缺少或损坏的 Cabal-1.10.2.0

GHC 能够跟踪单个库的多个版本,因此安装新版本Cabal不会修复旧版本。您可以要求 cabal-install 重新安装特定版本以尝试修复此问题;例如

cabal install --reinstall Cabal-1.10.2.0
于 2012-08-22T07:48:20.957 回答