1

我正在尝试ghc-mod在 windows/x64 上安装 GHC 8.0.1。当我尝试通过安装ghc-mod时,cabal install ghc-mod我收到一条错误消息,说我的 C 编译器不工作(它使用的是与 捆绑在一起的 c 编译器ghc)。

这是输出(我第二次运行命令。它基本上是第一个说的,但减少到错误消息):

C:\Users\******>cabal install ghc-mod
Resolving dependencies...
Configuring old-time-1.1.0.3...
Failed to install old-time-1.1.0.3
Build log ( C:\Users\******\AppData\Roaming\cabal\logs\old-time-1.1.0.3.log ):
Configuring old-time-1.1.0.3...
bash.exe: warning: could not find /tmp, please create!
configure: WARNING: unrecognized options: --with-compiler
checking for gcc... C:\PROGRA~1\Haskell Platform\8.0.1\mingw\bin\gcc.exe 
                    ^ I think the error lies here, as you can see the file path is corrupted but I wasn't able to locate the cause for this
checking whether the C compiler works... no
configure: error: in `/cygdrive/c/Users/******/AppData/Local/Temp/cabal-tmp-6084/old-time-1.1.0.3':
configure: error: C compiler cannot create executables
See `config.log' for more details
cabal: Leaving directory 'C:\Users\******\AppData\Local\Temp\cabal-tmp-6084\old-time-1.1.0.3'
cabal: Error: some packages failed to install:
cpphs-1.20.2 depends on old-time-1.1.0.3 which failed to install.
ghc-mod-5.6.0.0 depends on old-time-1.1.0.3 which failed to install.
haskell-src-exts-1.17.1 depends on old-time-1.1.0.3 which failed to install.
hlint-1.9.35 depends on old-time-1.1.0.3 which failed to install.
old-time-1.1.0.3 failed during the configure step. The exception was:
ExitFailure 77

您能否帮我安装ghc-mod或提供任何其他安装方式。

因为我刚刚开始,所以我已经尝试过重新安装 Haskell,但这并没有任何区别。是的,我添加了 haskell 主页上提供的 3 行。

4

1 回答 1

2

我不能确定,但​​我想我会用我认为正在发生的事情写一个答案。

old-time软件包包含一个configure脚本,这是一个用于(惊喜!)配置软件包的 Unix shell 脚本。Cabal 构建系统允许包自动集成configure,并为它们运行脚本。在 POSIX 系统上,总是有一个很容易获得的 shell。但是,在 Windows 上,情况并非如此。我相信这就是你遇到的问题。

现在棘手的部分:你为什么没有外壳?理论上,Haskell 平台提供了一个 shell。好吧,这是我的猜测:

  • 对于 Stack 的使用,有一个 Haskell 平台错误,其中 Stack 找不到 MSYS 工具,其中包括 shell 脚本。较新版本的 Stack 可以解决此错误,但传入会--no-system-ghc告诉 Stack 忽略任何已安装的工具链并自行管理安装,这比使用 HP 的副本更可靠。
  • 对于阴谋集团的使用,我不太确定。我认为HP 团队决定要求您使用特殊的批处理程序来正确设置环境变量,因此如果您只是cabal install foo从普通命令窗口运行,Cabal 将找不到 MSYS,它会失败。但是,如果没有更多信息,我无法确定情况是否如此。

我个人的建议:卸载 Haskell Platform,并使用推荐的 Stack 安装说明。在您的情况下,这只是下载并运行 64 位 Windows 安装程序

最后:您怀疑的问题实际上不是问题;在 Windows 上,长度超过 8 个字符的路径名可以按照您看到的方式进行压缩(~1末尾带有)。该路径显示中没有任何错误。

于 2016-12-05T20:05:09.433 回答