Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/haskell/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Networking 在win32/cygwin上编译haskell模块网络_Networking_Haskell - Fatal编程技术网

Networking 在win32/cygwin上编译haskell模块网络

Networking 在win32/cygwin上编译haskell模块网络,networking,haskell,Networking,Haskell,我正在尝试在win32/cygwin上编译Network.HTTP()。但是,它确实会失败,并显示以下消息: 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

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

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,实际上不应该包括它,应该正确配置。

不要使用cygwin,而是按照下面的方法

安装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.

这些步骤是Tibell用来为win编译网络包的,我自己也曾在大多数haskell平台版本上多次成功地使用过这些步骤。

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

在执行配置步骤时,指定

runghc Setup.hs configure  --configure-option="--build=mingw32"
因此,库是为mingw32配置的,否则,如果您尝试链接或使用网络库,您将获得链接或“未定义的引用”。

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

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


在运行
cabal安装网络之前
在Cygwin shell中)

您的帖子说network.HTTP,但是您的url和引用是指向网络包的。我也成功地使用了MSYS2进行网络编译。以下是一些好的实践(包括MSYS2安装):
export PATH="/cygdrive/.../ghc-7.8.2/mingw/bin:$PATH"