3

我是 haskell 的新手,我正在做一个微不足道的项目,但我需要运行cabal install encoding. 但是,当我这样做时,它给了我这个错误:

Configuring encoding-0.6.7.2...
setup.exe: Missing dependency on a foreign library:
* Missing (or bad) header file: system_encoding.h
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.
If the header file does exist, it may contain errors that are caught by the C
compiler at the preprocessing stage. In this case you can re-run configure
with the verbosity flag -v3 to see the error messages.
cabal.exe: Error: some packages failed to install:
encoding-0.6.7.2 failed during the configure step. The exception was:
ExitFailure 1

如何解决这个问题?

4

1 回答 1

1

TL;博士: cabal install encoding -f-systemencoding


我发现了一些关于这个主题的论坛帖子。说的最重要的是

缺少的标头是 langinfo.h - 我不知道它的来源,因为我在 Msys/MinGW 或 Cygwin 中都没有它,而且这些天我的 Cygwin 相当大。

从那里,我在 Cygwin 网站上查看了 langinfo.h 的位置。 原来它带有 Cygwin 的默认安装。这是它的路径:

usr/include/langinfo.h

所以我安装了 Cygwin,(实际上我已经安装了它)然后我像这样运行 cabal install :

cabal install encoding --extra-include-dirs='C:\cygwin\usr\include'

那注册包没有问题。


更新

尽管这确实允许您注册包,但您不能使用它。当我尝试 GHCi 时给了我这个错误:

Loading package encoding-0.6.7.2 ... linking ... ghc: unable to load package `encoding-0.6.7.2'

我现在又被困住了。

更新 2

我从一位名叫fryguybob 的绅士那里得到了一些关于IRC 的帮助。这是您可以安装它的另一种方式:cabal install encoding -f-systemencoding. 这对我有用

于 2013-03-15T03:52:45.620 回答