help installing libpcap on cygwin

梦想与她 提交于 2019-12-05 03:00:23

问题


i was trying to install libpcap under cygwin on windows 7 but i had this error: $ ./configure . . . . . configure: error: see the INSTALL for more info

how can i solve this? i am using libpcap-1.0.0 which is the latest version.


回答1:


I know this is a late reply, but I just went through the same install issues on Windows 7.

On Windows, you should use Winpcap: http://www.winpcap.org/




回答2:


http://mathieu.carbou.free.fr/wiki/index.php?title=How_to_install_Winpcap_/_Libpcap_under_Cygwin

libpcap develop pack can be found from http://www.winpcap.org/devel.htm

steps in detail as follows:

Setup Winpcap

  1. Download and unzip the pack. We will use for this example WpdPack_4_0_1.zip.

  2. Copy libraries like this:

    • WpdPack\Lib\libpacket.a to cygwin\lib\
    • WpdPack\Lib\libwpcap.a to cygwin\lib\
  3. Create a folder cygwin\usr\include\pcap\

  4. Copy all headers from WpdPack\Include to cygwin\usr\include\winpcap\

  5. Be sure you have installed Winpcap libraries and that they are in your path by typing:

    which packet.dll
    which wpcap.dll
    

For me they are in /cygdrive/c/WINDOWS/system32/

Building example using Cygwin

Open a cygwin prompt to WpdPack\Examples-pcap\basic_dump\ and execute:

basic_dump:

CFLAGS="-g -Wall -mno-cygwin -I /usr/include/pcap"
LIBS="-lwpcap"
PROG="basic_dump"
gcc $CFLAGS -c $PROG.c
gcc $CFLAGS -o $PROG.exe $PROG.o $LIBS
./$PROG.exe

basic_dump_ex:

CFLAGS="-g -Wall -mno-cygwin -I /usr/include/pcap"
LIBS="-lwpcap"
PROG="basic_dump_ex"
gcc $CFLAGS -c $PROG.c
gcc $CFLAGS -o $PROG.exe $PROG.o $LIBS
./$PROG.exe

iflist:

CFLAGS="-g -Wall -mno-cygwin -I /usr/include/pcap"
LIBS="-lwpcap"
PROG="iflist"
gcc $CFLAGS -c $PROG.c
gcc $CFLAGS -o $PROG.exe $PROG.o $LIBS
./$PROG.exe

pcap_filter (and others):

I think you can catch the pattern ;) Only replace PROG=... by the program name and it should compile.

UDPdump:

CFLAGS="-g -Wall -mno-cygwin -I /usr/include/pcap"
LIBS="-lwpcap -lwsock32"
PROG="UDPdump"
gcc $CFLAGS -c $PROG.c
gcc $CFLAGS -o $PROG.exe $PROG.o $LIBS
./$PROG.exe

You can test by doing a Time Synchronization with pool.ntp.org for example.




回答3:


The libpcap source includes part, but not all, of the Windows support. The mechanisms used to capture network traffic are very OS-dependent (which is why libpcap exists - to hide that detail from applications).

On UN*Xes, the mechanism is part of the OS, so libpcap doesn't have to provide that mechanism.

On Windows, there's no such mechanism in the OS, so WinPcap combines a kernel-mode driver, a low-level library that talks to the driver, and a module for libpcap that uses the low-level library.

The libpcap source doesn't include the driver or the low-level library, so it's not sufficient to build a version of libpcap for Windows.

As the other answers indicate, you need WinPcap.



来源:https://stackoverflow.com/questions/2396251/help-installing-libpcap-on-cygwin

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!