Haskell Cabal:C编译器无法创建可执行文件



我正在尝试在Windows/X64上安装GHC 8.0.1的ghc-mod。当我尝试通过cabal install ghc-mod安装ghc-mod时,我会出现一个错误,说我的C编译器不起作用(它使用的是与ghc捆绑的C-Compiler)。

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

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******AppDataRoamingcaballogsold-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~1Haskell Platform8.0.1mingwbingcc.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******AppDataLocalTempcabal-tmp-6084old-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行。

我无法肯定地知道,但是想我会用我认为正在进行的答案。

old-time软件包包含一个configure脚本,该脚本是一个用于(惊喜!)配置软件包的Unix Shell脚本。Cabal Build System允许软件包自动集成configure,并将为其运行脚本。在POSIX系统上,总有一个容易获得的外壳。但是,在窗户上,事实并非如此。我相信这就是您遇到的问题。

现在棘手的部分:为什么您有外壳?从理论上讲,Haskell平台发出了外壳。好吧,这是我的猜测:

  • 对于堆栈使用情况,有一个Haskell Platform错误,堆栈无法找到包括Shell脚本的MSYS工具。堆栈的较新版本围绕此错误工作,但是传递--no-system-ghc告诉Stack忽略任何已安装的工具链并管理安装本身,这比使用HP的副本更可靠。
  • 对于Cabal使用,我不确定。我 think HP团队决定要求您使用特殊的批处理程序正确设置环境变量,因此,如果您只从普通命令窗口运行cabal install foo,Cabal将不会找到MSYS,并且会失败。但是,没有更多信息,我无法确定是这种情况。

我的个人建议:卸载Haskell平台,并使用推荐的堆栈安装说明。就您而言,这只是下载和运行64位Windows安装程序。

最后:您怀疑的问题实际上不是一个问题;在Windows上,路径名超过8个字符可以以您看到的方式压缩(最后使用~1)。该路径显示中没有任何越野车。

最新更新