help installing libpcap on cygwin

scatman picture scatman · Mar 7, 2010 · Viewed 15.9k times · Source

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.

Answer

camino picture camino · Mar 23, 2013

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.