Cabal安装抱怨"<内置>:0:4:词法错误(UTF-8解码错误)"

wen*_*ong 3 haskell utf-8 cabal windows-7

我使用的是带有语言环境zh_CN和ghc-7.0.4的Windows 7

cmd.exe的默认代码页是936.

> cabal install ghc-mod
Resolving dependencies...
Configuring ghc-syb-utils-0.2.1.0...
Preprocessing library ghc-syb-utils-0.2.1.0...
Building ghc-syb-utils-0.2.1.0...

<built-in>:0:4: lexical error (UTF-8 decoding error)
cabal: Error: some packages failed to install:
ghc-mod-1.10.7 depends on ghc-syb-utils-0.2.1.0 which failed to install.
ghc-syb-utils-0.2.1.0 failed during the building phase. The exception was:
ExitFailure 1
Run Code Online (Sandbox Code Playgroud)

我已尝试更改代码页并重新安装,但获得相同的输出.

> chcp 65001
> cabal install ghc-mod
Run Code Online (Sandbox Code Playgroud)

一些包可以成功构建:

xml-1.3.12 textmath-0.6.0.3 tagsoup-0.12.6

有些包会失败:

temporary-1.1.2.3 utf8-string-0.3.7 pandoc-types-1.9.0.2 json-0.5

小智 5

我遇到了同样的问题.我不知道原因是否相同,但试试

set LANG=C
Run Code Online (Sandbox Code Playgroud)

在你运行cabal之前.在我的情况下,这解决了问题.