我是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
如何解决这个问题?
答案 0 :(得分:1)
TL; DR: cabal install encoding -f-systemencoding
I found a few forum posts on this topic。最重要的是
缺少的标题是langinfo.h - 它起源于哪里我不知道, 因为我没有使用Msys / MinGW或Cygwin,我的Cygwin是 这些天很大。
从那里,我在Cygwin网站上查看了langinfo.h的位置。 Turns out it comes with the default install of Cygwin.这就是它的道路:
usr/include/langinfo.h
So I installed Cygwin,(实际上我已经安装了它)然后我像这样运行cabal安装:
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'
我现在又被困了。
我从一位名叫fryguybob的绅士那里得到了一些关于IRC的帮助。这是您可以安装它的另一种方式:cabal install encoding -f-systemencoding
。这对我有用