4

我正在尝试在 win32/cygwin 上编译 Network.HTTP ( http://hackage.haskell.org/package/network )。但是,它确实失败并显示以下消息:

Setup.hs: Missing dependency on a foreign library:
* Missing (or bad) header file: HsNet.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.

不幸的是,它没有提供更多线索。HsNet.h 包含 sys/uio.h,实际上不应该包含它,并且应该正确配置。

4

3 回答 3

3

Don't use cygwin, instead follow Johan Tibells way

Installing MSYS

Install the latest Haskell Platform. Use the default settings.

Download version 1.0.11 of MSYS. You'll need the following files:
    MSYS-1.0.11.exe
    msysDTK-1.0.1.exe
    msysCORE-1.0.11-bin.tar.gz

The files are all hosted on haskell.org as they're quite hard to find in the official MinGW/MSYS repo.

Run MSYS-1.0.11.exe followed by msysDTK-1.0.1.exe. The former asks you if you want to run a normalization step. You can skip that.

Unpack msysCORE-1.0.11-bin.tar.gz into C:\msys\1.0. Note that you can't do that using an MSYS shell, because you can't overwrite the files in use, so make a copy of C:\msys\1.0, unpack it there, and then rename the copy back to C:\msys\1.0.

Add C:\Program Files\Haskell Platform\VERSION\mingw\bin to your PATH. This is neccesary if you ever want to build packages that use a configure script, like network, as configure scripts need access to a C compiler.

These steps are what Tibell uses to compile the Network package for win and I have used this myself successfully several times on most of the haskell platform releases.

于 2013-06-13T10:52:01.917 回答
1

可以在 win32/cygwin 上构建网络。上述步骤虽然有用(由 Jonke),但可能不是必需的。

在执行配置步骤时,指定

runghc Setup.hs configure  --configure-option="--build=mingw32"

以便为 mingw32 配置库,否则如果您尝试链接或使用网络库,您将获得链接或“未定义的引用”。

于 2013-09-13T05:38:02.357 回答
1

与@Yogesh Sajanikar 的回答相结合,使它对我有用(在win64/cygwin 上):

  • 确保您路径上的 gcc 不是 Mingw/Cygwin,而是 C:\ghc\ghc-6.12.1\mingw\bin\gcc.exe

(跑

export PATH="/cygdrive/.../ghc-7.8.2/mingw/bin:$PATH" 

cabal install network在Cygwin shell 中运行之前)

于 2014-06-27T16:37:18.047 回答