Jump to content

Installing winpcap and configure it with cygwin


hisoka

Recommended Posts

When I put the ./configure command in my Cygwin terminal to compile a source code program , I got this error :

ERROR! Libpcap library/headers not found.
TCPDUMP/LIBPCAP public repository is a good place to fetch one
if libpcap library is installed, use the --with-libpcap-* options
to specify pathes to include and library files locations.


So , because I have windows xp as an operating system , I downloaded winpcap from this link :

WinPcap · Developer Resources

I extracted it to Cygwin directory which is C:\cygwin , then followed this link to configure winpcap with cygwin :

help installing libpcap on cygwin - Stack Overflow

In the second link , someone talked about installing some libraries :

"

  1. Be sure you have installed Winpcap libraries and that they are in your path by typing:
    which packet.dll which wpcap.dll

because I do not have both dll , I downloaded both of them from this link :


wpcap.dll download missing file - DllDump


then put them in C:\WINDOWS\system32 .Moreover , I did exactly what second link said :

  1. Copy libraries like this:
    • WpdPack\Lib\libpacket.a to cygwin\lib\
    • WpdPack\Lib\libwpcap.a to cygwin\lib\
  2. Create a folder cygwin\usr\include\pcap\
  3. Copy all headers from WpdPack\Include to cygwin\usr\include\winpcap\
  4. Be sure you have installed Winpcap libraries and that they are in your path by typing:
    which packet.dll which wpcap.dll

But when I followed the rest which is :




Building example using Cygwin
Open a cygwin prompt to WpdPack\Examples-pcap\basic_dump\ and execute:
basic_dump:


and tried to execute the basic_dump, basic_dump_ex and iflist commands , I got basic_dump : command not found
basic_dump_ex : command not found
iflist : command not found


So I added path C:\cygwin\WpdPack\Examples-pcap\basic_dump in windows environment variable

 

but to my surprise I still got command not found when I run the command above

 

What should I do ? or what I am missing ?

 

Link to comment
Share on other sites

I listed all the files in this directory /cygdrive/c/WpdPack/Examples-pcap/basic_dump and this is what I got :

basic_dump.c basic_dump.dsp basic_dump.dsw basic_dump.vcproj GNUmakefile


As you can see there is NO basic_dump with .exe extension

the command : ls -l basic_dump.* gives me this :

-rwxr-x---+ 1 Administrator None 2737 Dec 23 2008 basic_dump.c
-rwxr-x---+ 1 Administrator None 4558 May 20 2005 basic_dump.dsp
-rwxr-x---+ 1 Administrator None 543 May 20 2005 basic_dump.dsw
-rwxr-x---+ 1 Administrator None 7671 Jul 24 2009 basic_dump.vcproj



these commands :
cd /cygdrive/c/WpdPack/
find . -name "basic_dump.*"
give me this result:

./Examples-pcap/basic_dump/basic_dump.c
./Examples-pcap/basic_dump/basic_dump.dsp
./Examples-pcap/basic_dump/basic_dump.dsw
./Examples-pcap/basic_dump/basic_dump.vcproj
./Examples-remote/misc/basic_dump.c
./Examples-remote/misc/basic_dump.dsp
./Examples-remote/misc/basic_dump.vcproj


Moreover , I looked for an .exe file in all the folder of WpdPack but I could not find any file with .exe extension nothing special , the problem still persists frown.gif

Link to comment
Share on other sites

you're supposed to compile the executable yourself

 

 

There is no executable file .

 

I tried to compile the files in basic_dump_ex using cygwin :

 

/cygdrive/c/WpdPack/Examples-pcap/basic_dump_ex

 

$make

 

but I got this :

 

cc -g -O -mno-cygwin -I ../../include -c -o basic_dump_ex.o basic_dump_ex.c

cc: error: unrecognized command line option ‘-mno-cygwin’

GNUmakefile:17: recipe for target 'basic_dump_ex.o' failed

make: *** [basic_dump_ex.o] Error 1

 

In some articles , it is stated that deleting -mno-cygwin , solve the problem . However I cannot find it this -mno-cygwin .

 

now I deleted the -mno-cygwin and I got a new error :

cc -g -O  -I ../../include -c -o basic_dump.o basic_dump.c
basic_dump.c: In function ‘main’:
basic_dump.c:27:3: warning: implicit declaration of function ‘exit’ [-Wimplicit-function-declaration]
   exit(1);
   ^
basic_dump.c:27:3: warning: incompatible implicit declaration of built-in function ‘exit’
basic_dump.c:27:3: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
basic_dump.c: In function ‘packet_handler’:
basic_dump.c:99:3: error: ‘VOID’ undeclared (first use in this function)
  (VOID)(param);
   ^
basic_dump.c:99:3: note: each undeclared identifier is reported only once for each function it appears in
GNUmakefile:17: recipe for target 'basic_dump.o' failed
make: *** [basic_dump.o] Error 1

 

 

Edited by hisoka
Link to comment
Share on other sites

It sounds like the C code is missing a #include directive for stdlib.h

 

 

So I added #include "stdlib.h" and the error disappeared . However , another error emerged :

basic_dump.c:99:3: error: ‘VOID’ undeclared (first use in this function)
  (VOID)(param);

So I changed

int main ()

with

void main()

and again the error disappeared . However hundred of error emerged after that :

cc -g -O  -I ../../include -c -o basic_dump.o basic_dump.c
basic_dump.c: In function ‘main’:
basic_dump.c:25:5: error: expected expression before ‘)’ token
  if() == -1)
     ^
basic_dump.c:25:12: error: expected statement before ‘)’ token
  if() == -1)
            ^
basic_dump.c:27:3: error: too few arguments to function ‘fprintf’
   fprintf();
   ^
basic_dump.c:28:3: error: too few arguments to function ‘exit’
   exit();
   ^
basic_dump.c:32:6: error: expected expression before ‘)’ token
  for()
      ^
basic_dump.c:32:6: error: expected expression before ‘)’ token
basic_dump.c:34:3: error: too few arguments to function ‘printf’
   printf();
   ^
basic_dump.c:35:7: error: expected expression before ‘)’ token
   if ()
       ^
basic_dump.c:36:4: error: too few arguments to function ‘printf’
    printf()\n", d->description);
    ^
basic_dump.c:36:4: error: stray ‘\’ in program
basic_dump.c:36:14: warning: missing terminating " character
    printf()\n", d->description);
              ^
basic_dump.c:36:4: error: missing terminating " character
    printf()\n", d->description);
    ^
basic_dump.c:38:4: error: stray ‘\’ in program
    printf()\n");
    ^
basic_dump.c:38:14: warning: missing terminating " character
    printf()\n");
              ^
basic_dump.c:38:4: error: missing terminating " character
    printf()\n");
    ^
basic_dump.c:41:5: error: expected expression before ‘)’ token
  if()
     ^
basic_dump.c:43:3: error: too few arguments to function ‘printf’
   printf();
   ^
basic_dump.c:44:10: warning: ‘return’ with a value, in function returning void
   return -1;
          ^
basic_dump.c:47:2: error: too few arguments to function ‘printf’
  printf():",i);
  ^
basic_dump.c:47:10: error: expected ‘;’ before ‘:’ token
  printf():",i);
          ^
basic_dump.c:47:11: warning: missing terminating " character
  printf():",i);
           ^
basic_dump.c:47:10: error: missing terminating " character
  printf():",i);
          ^
basic_dump.c:50:5: error: expected expression before ‘)’ token
  if()
     ^
basic_dump.c:52:3: error: too few arguments to function ‘printf’
   printf();
   ^
basic_dump.c:54:3: error: too few arguments to function ‘pcap_freealldevs’
   pcap_freealldevs();
   ^
In file included from ../../include/pcap.h:45:0,
                 from basic_dump.c:9:
../../include/pcap/pcap.h:349:6: note: declared here
 void pcap_freealldevs(pcap_if_t *);
      ^
basic_dump.c:55:10: warning: ‘return’ with a value, in function returning void
   return -1;
          ^
basic_dump.c:59:6: error: expected expression before ‘)’ token
  for();
      ^
basic_dump.c:59:6: error: expected expression before ‘)’ token
basic_dump.c:71:3: error: too few arguments to function ‘fprintf’
   fprintf();
   ^
basic_dump.c:73:3: error: too few arguments to function ‘pcap_freealldevs’
   pcap_freealldevs();
   ^
In file included from ../../include/pcap.h:45:0,
                 from basic_dump.c:9:
../../include/pcap/pcap.h:349:6: note: declared here
 void pcap_freealldevs(pcap_if_t *);
      ^
basic_dump.c:74:10: warning: ‘return’ with a value, in function returning void
   return -1;
          ^
basic_dump.c:77:2: error: too few arguments to function ‘printf’
  printf();
  ^
basic_dump.c:80:2: error: too few arguments to function ‘pcap_freealldevs’
  pcap_freealldevs();
  ^
In file included from ../../include/pcap.h:45:0,
                 from basic_dump.c:9:
../../include/pcap/pcap.h:349:6: note: declared here
 void pcap_freealldevs(pcap_if_t *);
      ^
basic_dump.c:83:2: error: too few arguments to function ‘pcap_loop’
  pcap_loop();
  ^
In file included from ../../include/pcap.h:45:0,
                 from basic_dump.c:9:
../../include/pcap/pcap.h:299:5: note: declared here
 int pcap_loop(pcap_t *, int, pcap_handler, u_char *);
     ^
basic_dump.c:85:2: error: too few arguments to function ‘pcap_close’
  pcap_close();
  ^
In file included from ../../include/pcap.h:45:0,
                 from basic_dump.c:9:
../../include/pcap/pcap.h:298:6: note: declared here
 void pcap_close(pcap_t *);
      ^
basic_dump.c:86:9: warning: ‘return’ with a value, in function returning void
  return 0;
         ^
basic_dump.c: In function ‘packet_handler’:
basic_dump.c:100:3: error: expected expression before ‘)’ token
  ()();
   ^
basic_dump.c:101:3: error: expected expression before ‘)’ token
  ()();
   ^
basic_dump.c:104:17: error: ‘header’ undeclared (first use in this function)
  local_tv_sec = header->ts.tv_sec;
                 ^
basic_dump.c:104:17: note: each undeclared identifier is reported only once for each function it appears in
basic_dump.c:105:8: error: too few arguments to function ‘localtime’
  ltime=localtime();
        ^
In file included from /usr/include/sys/types.h:20:0,
                 from ../../include/pcap/pcap.h:46,
                 from ../../include/pcap.h:45,
                 from basic_dump.c:9:
/usr/include/time.h:59:12: note: declared here
 struct tm *_EXFUN(localtime,(const time_t *_timer));
            ^
basic_dump.c:106:2: error: too few arguments to function ‘strftime’
  strftime();
  ^
basic_dump.c:108:2: error: too few arguments to function ‘printf’
  printf();
  ^
GNUmakefile:17: recipe for target 'basic_dump.o' failed
make: *** [basic_dump.o] Error 1
Edited by hisoka
Link to comment
Share on other sites

does all these errors emerged because I changed

 int main

with

void main 

and if yes so how to correct the error :

basic_dump.c:99:3: error: ‘VOID’ undeclared (first use in this function)
  (VOID)(param);

????

Link to comment
Share on other sites

I knew that that source code is nothing more than ing piece of and crap and the one who writes it should be ashamed from putting it there to be downloaded . It made me only lost my time and my nerves for nothing :(

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...