{"id":7352,"date":"2014-06-07T02:30:21","date_gmt":"2014-06-07T02:30:21","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/06\/07\/how-to-install-pcap-for-ruby-on-windows-collection-of-common-programming-errors\/"},"modified":"2014-06-07T02:30:21","modified_gmt":"2014-06-07T02:30:21","slug":"how-to-install-pcap-for-ruby-on-windows-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/06\/07\/how-to-install-pcap-for-ruby-on-windows-collection-of-common-programming-errors\/","title":{"rendered":"How to install PCAP for ruby on Windows-Collection of common programming errors"},"content":{"rendered":"<p>This must be a relatively newb question but I am still stuck. I know there is a simple solution to this. I&#8217;ve done some googling but could not find an exact answer. Here is the error I get&#8230;<\/p>\n<pre><code>C:\\Ruby193\\include\\ruby-1.9.1\\i386-mingw32&gt;gem install pcap\nTemporarily enhancing PATH to include DevKit...\nBuilding native extensions.  This could take a while...\nERROR:  Error installing pcap:\n        ERROR: Failed to build gem native extension.\n\n        C:\/Ruby193\/bin\/ruby.exe extconf.rb\nchecking for socket() in -lsocket... no\nchecking for gethostbyname() in -lxnet... no\nchecking for hstrerror()... no\nchecking for pcap.h... no\n*** extconf.rb failed ***\nCould not create Makefile due to some reason, probably lack of\nnecessary libraries and\/or headers.  Check the mkmf.log file for more\ndetails.  You may need configuration options.\n<\/code><\/pre>\n<p>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.<\/p>\n<p>mkmf.log<\/p>\n<pre><code>    have_library: checking for socket() in -lsocket... -------------------- no\n\n\"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  \"\nchecked program was:\n\/* begin *\/\n1: #include \"ruby.h\"\n2: \n3: #include \n4: #include \n5: int main() {return 0;}\n\/* end *\/\n\n\"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  \"\nc:\/users\/user\/downloads\/mingw\/bin\/..\/lib\/gcc\/mingw32\/4.5.2\/..\/..\/..\/..\/mingw32\/bin\/ld.exe: cannot find -lsocket\ncollect2: ld returned 1 exit status\nchecked program was:\n\/* begin *\/\n1: #include \"ruby.h\"\n2: \n3: #include \n4: #include \n5: \n6: \/*top*\/\n7: int main() {return 0;}\n8: int t() { void ((*volatile p)()); p = (void ((*)()))socket; return 0; }\n\/* end *\/\n\n\"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  \"\nconftest.c: In function 't':\nconftest.c:8:1: error: too few arguments to function 'socket'\nc:\\users\\user\\downloads\\mingw\\bin\\..\/lib\/gcc\/mingw32\/4.5.2\/..\/..\/..\/..\/include\/winsock2.h:553:35: note: declared here\nchecked program was:\n\/* begin *\/\n1: #include \"ruby.h\"\n2: \n3: #include \n4: #include \n5: \n6: \/*top*\/\n7: int main() {return 0;}\n8: int t() { socket(); return 0; }\n\/* end *\/\n\n--------------------\n\nhave_library: checking for gethostbyname() in -lxnet... -------------------- no\n\n\"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  \"\nc:\/users\/user\/downloads\/mingw\/bin\/..\/lib\/gcc\/mingw32\/4.5.2\/..\/..\/..\/..\/mingw32\/bin\/ld.exe: cannot find -lxnet\ncollect2: ld returned 1 exit status\nchecked program was:\n\/* begin *\/\n1: #include \"ruby.h\"\n2: \n3: #include \n4: #include \n5: \n6: \/*top*\/\n7: int main() {return 0;}\n8: int t() { void ((*volatile p)()); p = (void ((*)()))gethostbyname; return 0; }\n\/* end *\/\n\n\"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  \"\nconftest.c: In function 't':\nconftest.c:8:1: error: too few arguments to function 'gethostbyname'\nc:\\users\\user\\downloads\\mingw\\bin\\..\/lib\/gcc\/mingw32\/4.5.2\/..\/..\/..\/..\/include\/winsock2.h:555:57: note: declared here\nchecked program was:\n\/* begin *\/\n1: #include \"ruby.h\"\n2: \n3: #include \n4: #include \n5: \n6: \/*top*\/\n7: int main() {return 0;}\n8: int t() { gethostbyname(); return 0; }\n\/* end *\/\n\n--------------------\n\nhave_func: checking for hstrerror()... -------------------- no\n\n\"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  \"\nconftest.c: In function 't':\nconftest.c:8:53: error: 'hstrerror' undeclared (first use in this function)\nconftest.c:8:53: note: each undeclared identifier is reported only once for each function it appears in\nchecked program was:\n\/* begin *\/\n1: #include \"ruby.h\"\n2: \n3: #include \n4: #include \n5: \n6: \/*top*\/\n7: int main() {return 0;}\n8: int t() { void ((*volatile p)()); p = (void ((*)()))hstrerror; return 0; }\n\/* end *\/\n\n\"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  \"\nC:\\Users\\USER\\AppData\\Local\\Temp\\ccbjKHSc.o:conftest.c:(.text+0x19): undefined reference to `hstrerror'\ncollect2: ld returned 1 exit status\nchecked program was:\n\/* begin *\/\n1: #include \"ruby.h\"\n2: \n3: #include \n4: #include \n5: \n6: \/*top*\/\n7: int main() {return 0;}\n8: int t() { hstrerror(); return 0; }\n\/* end *\/\n\n--------------------\n\nhave_header: checking for pcap.h... -------------------- no\n\n\"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\"\nconftest.c:5:18: fatal error: pcap.h: No such file or directory\ncompilation terminated.\nchecked program was:\n\/* begin *\/\n1: #include \"ruby.h\"\n2: \n3: #include \n4: #include \n5: #include \n\/* end *\/\n\n--------------------\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This must be a relatively newb question but I am still stuck. I know there is a simple solution to this. I&#8217;ve done some googling but could not find an exact answer. Here is the error I get&#8230; C:\\Ruby193\\include\\ruby-1.9.1\\i386-mingw32&gt;gem install pcap Temporarily enhancing PATH to include DevKit&#8230; Building native extensions. This could take a while&#8230; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7352","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7352","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=7352"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7352\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=7352"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=7352"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=7352"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}