2
votes

I cannot install pcap package under Windows 7 (64 bit). Anybody know how to do that?

Error message if I run "cabal install pcap":

cabal.exe: Missing dependency on a foreign library:

  • Missing (or bad) header file: pcap.h
  • Missing C library: pcap

I downloaded WinPcap 4.1.2 Developers Pack from here: http://www.winpcap.org/devel.htm

Installed MinGW/MSYS from scratch. Tried both: prepackaged GHC 7-6.2 (ghc-7.6.2-x86_64-unknown-mingw32.tar.bz2) and compiled it myself under MinGW/MSYS.

There seems to be multiple problems:

  1. When I provide include path to pcap.h (--extra-include-dirs), I can do "cabal configure" successfully, but it fails on "cabal build" with "netinet/in.h" not found.

  2. If I install netinet/in.h by running under MSYS "mingw-get install msys-core-dev", then I'm getting tons of different type already defined messages.

  3. WinPCap Developers Pack do not have libpcap.a (it has libwpcap.a). And it looks like there is no 64 bit version of it. Do I need to compile it myself?

I would appreciate if anybody can suggest how such situations normally handled for cabal packages under Windows.

2

2 Answers

2
votes

WinPCap Developers Pack do not have libpcap.a (it has libwpcap.a).

Correct. For better or worse, while the library is called "libpcap" on UN*X, and is thus linked with the flag -lpcap, it's called "WinPcap" on Windows, and the .a file is called "libwpcap.a", meaning that if you build an application with UN*X-style tools, it would be linked with the flag -lwpcap.

So, no, even if you're using UN*X-style files on Windows, you don't use the same flags to link a pcap-based program that you do on UN*X.

And, yes, you would have to compile a 64-bit version yourself; whilst they offer a 64-bit version of the .lib file for use with the Microsoft build tools, they don't appear to offer a 64-bit version of the .a file for use with more UN*X-like tools.

0
votes

Have you tried just making netinet/in.h available? My recollection was that this was used to generate the Haskell equivalents. You may not need anything else. Warning: I last worked on this package 7 years ago.