Haskell cabal:C编译器无法创建可执行文件
我正在尝试在windows/x64上为ghc 8.0.1安装Haskell cabal:C编译器无法创建可执行文件,haskell,compiler-errors,cabal,ghc-mod,Haskell,Compiler Errors,Cabal,Ghc Mod,我正在尝试在windows/x64上为ghc 8.0.1安装ghc mod。当我试图通过cabal install ghc mod安装ghc mod时,我收到一个错误,说我的C编译器不工作(它使用的是与ghc捆绑的C编译器) 以下是输出(我第二次运行该命令时的输出,基本上是第一次运行时的输出,但减少为错误消息): 请您帮助我安装ghc mod 我已经尝试重新安装Haskell,因为我刚刚开始,但这没有任何区别。 是的,我添加了haskell主页上提供的3行内容 我不能确定,但我想我会写一个我认为
ghc mod
。当我试图通过cabal install ghc mod
安装ghc mod
时,我收到一个错误,说我的C编译器不工作(它使用的是与ghc
捆绑的C编译器)
以下是输出(我第二次运行该命令时的输出,基本上是第一次运行时的输出,但减少为错误消息):
请您帮助我安装ghc mod
我已经尝试重新安装Haskell,因为我刚刚开始,但这没有任何区别。
是的,我添加了haskell主页上提供的3行内容 我不能确定,但我想我会写一个我认为正在发生的事情的答案
old-time
包包含一个configure
脚本,这是一个Unix shell脚本,用于(出乎意料地!)配置包。Cabal构建系统允许包自动集成配置
,并为它们运行脚本。在POSIX系统上,总是有一个容易获得的shell。然而,在Windows上,情况并非如此。我相信这就是你遇到的问题
现在棘手的部分是:为什么你没有一个外壳?理论上,Haskell平台运送一个外壳。好吧,以下是我的猜测:
- 对于堆栈使用,堆栈在某些地方找不到MSYS工具,其中包括shell脚本。较新版本的Stack解决了这个问题,但是传入
——没有系统ghc
告诉Stack忽略任何已安装的工具链并管理安装本身,这比使用HP的拷贝更可靠
- 对于阴谋集团的使用,我不太确定。我认为HP团队决定要求您使用一个特殊的批处理程序来正确设置环境变量,因此,如果您只是从正常的命令窗口运行
cabal install foo
,cabal将无法找到MSYS,它将失败。然而,如果没有更多的信息,我无法确定情况是否如此
我个人的建议:卸载Haskell平台,然后使用。对你来说,这只是一个问题
最后:你怀疑的问题实际上不是问题;在Windows上,长度超过8个字符的路径名可以按您看到的方式进行压缩(结尾是~1
)。路径显示中没有任何错误。config.log
说了什么?不幸的是,我不知道它在哪里,你能给我一个提示吗?在Windows上,我会使用堆栈:当然,我也试过了,但是,由于堆栈构建在cabal
之上,我在运行stack installghc mod
时会遇到相同的错误,请尝试使用--no system ghc参数来堆栈,这将迫使它安装自己的工具链,而不是使用Haskell平台工具链。Stack的下一个版本将使该设置成为默认设置。
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