How to install PCAP for ruby on Windows-Collection of common programming errors
This must be a relatively newb question but I am still stuck. I know there is a simple solution to this. I’ve done some googling but could not find an exact answer. Here is the error I get…
C:\Ruby193\include\ruby-1.9.1\i386-mingw32>gem install pcap
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing pcap:
ERROR: Failed to build gem native extension.
C:/Ruby193/bin/ruby.exe extconf.rb
checking for socket() in -lsocket... no
checking for gethostbyname() in -lxnet... no
checking for hstrerror()... no
checking for pcap.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Clearly I am missing some libraries but I not know how to get these nor do I know where they should be located when attempting to install pcap.
mkmf.log
have_library: checking for socket() in -lsocket... -------------------- no
"gcc -o conftest -IC:/Ruby193/include/ruby-1.9.1/i386-mingw32 -IC:/Ruby193/include/ruby-1.9.1/ruby/backward -IC:/Ruby193/include/ruby-1.9.1 -I. -I/usr/local/include conftest.c -L. -LC:/Ruby193/lib -L/usr/local/lib -lmsvcrt-ruby191 -lshell32 -lws2_32 -limagehlp "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include
4: #include
5: int main() {return 0;}
/* end */
"gcc -o conftest -IC:/Ruby193/include/ruby-1.9.1/i386-mingw32 -IC:/Ruby193/include/ruby-1.9.1/ruby/backward -IC:/Ruby193/include/ruby-1.9.1 -I. -I/usr/local/include conftest.c -L. -LC:/Ruby193/lib -L/usr/local/lib -lmsvcrt-ruby191 -lsocket -lshell32 -lws2_32 -limagehlp "
c:/users/user/downloads/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot find -lsocket
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include
4: #include
5:
6: /*top*/
7: int main() {return 0;}
8: int t() { void ((*volatile p)()); p = (void ((*)()))socket; return 0; }
/* end */
"gcc -o conftest -IC:/Ruby193/include/ruby-1.9.1/i386-mingw32 -IC:/Ruby193/include/ruby-1.9.1/ruby/backward -IC:/Ruby193/include/ruby-1.9.1 -I. -I/usr/local/include conftest.c -L. -LC:/Ruby193/lib -L/usr/local/lib -lmsvcrt-ruby191 -lsocket -lshell32 -lws2_32 -limagehlp "
conftest.c: In function 't':
conftest.c:8:1: error: too few arguments to function 'socket'
c:\users\user\downloads\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/winsock2.h:553:35: note: declared here
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include
4: #include
5:
6: /*top*/
7: int main() {return 0;}
8: int t() { socket(); return 0; }
/* end */
--------------------
have_library: checking for gethostbyname() in -lxnet... -------------------- no
"gcc -o conftest -IC:/Ruby193/include/ruby-1.9.1/i386-mingw32 -IC:/Ruby193/include/ruby-1.9.1/ruby/backward -IC:/Ruby193/include/ruby-1.9.1 -I. -I/usr/local/include conftest.c -L. -LC:/Ruby193/lib -L/usr/local/lib -lmsvcrt-ruby191 -lxnet -lshell32 -lws2_32 -limagehlp "
c:/users/user/downloads/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot find -lxnet
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include
4: #include
5:
6: /*top*/
7: int main() {return 0;}
8: int t() { void ((*volatile p)()); p = (void ((*)()))gethostbyname; return 0; }
/* end */
"gcc -o conftest -IC:/Ruby193/include/ruby-1.9.1/i386-mingw32 -IC:/Ruby193/include/ruby-1.9.1/ruby/backward -IC:/Ruby193/include/ruby-1.9.1 -I. -I/usr/local/include conftest.c -L. -LC:/Ruby193/lib -L/usr/local/lib -lmsvcrt-ruby191 -lxnet -lshell32 -lws2_32 -limagehlp "
conftest.c: In function 't':
conftest.c:8:1: error: too few arguments to function 'gethostbyname'
c:\users\user\downloads\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/winsock2.h:555:57: note: declared here
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include
4: #include
5:
6: /*top*/
7: int main() {return 0;}
8: int t() { gethostbyname(); return 0; }
/* end */
--------------------
have_func: checking for hstrerror()... -------------------- no
"gcc -o conftest -IC:/Ruby193/include/ruby-1.9.1/i386-mingw32 -IC:/Ruby193/include/ruby-1.9.1/ruby/backward -IC:/Ruby193/include/ruby-1.9.1 -I. -I/usr/local/include conftest.c -L. -LC:/Ruby193/lib -L/usr/local/lib -lmsvcrt-ruby191 -lshell32 -lws2_32 -limagehlp "
conftest.c: In function 't':
conftest.c:8:53: error: 'hstrerror' undeclared (first use in this function)
conftest.c:8:53: note: each undeclared identifier is reported only once for each function it appears in
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include
4: #include
5:
6: /*top*/
7: int main() {return 0;}
8: int t() { void ((*volatile p)()); p = (void ((*)()))hstrerror; return 0; }
/* end */
"gcc -o conftest -IC:/Ruby193/include/ruby-1.9.1/i386-mingw32 -IC:/Ruby193/include/ruby-1.9.1/ruby/backward -IC:/Ruby193/include/ruby-1.9.1 -I. -I/usr/local/include conftest.c -L. -LC:/Ruby193/lib -L/usr/local/lib -lmsvcrt-ruby191 -lshell32 -lws2_32 -limagehlp "
C:\Users\USER\AppData\Local\Temp\ccbjKHSc.o:conftest.c:(.text+0x19): undefined reference to `hstrerror'
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include
4: #include
5:
6: /*top*/
7: int main() {return 0;}
8: int t() { hstrerror(); return 0; }
/* end */
--------------------
have_header: checking for pcap.h... -------------------- no
"gcc -E -IC:/Ruby193/include/ruby-1.9.1/i386-mingw32 -IC:/Ruby193/include/ruby-1.9.1/ruby/backward -IC:/Ruby193/include/ruby-1.9.1 -I. -I/usr/local/include conftest.c -o conftest.i"
conftest.c:5:18: fatal error: pcap.h: No such file or directory
compilation terminated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include
4: #include
5: #include
/* end */
--------------------