> Hi everyone. I have been having issues installing a few gems. PCAP is
> one of them. I'll admit that my troubleshooting abilities are probably
> not as up to par as some of the other folks here. Programing and ruby
> are a side hobby. I have much to learn.
>
> Here is the error I get when installing pcap
>
> 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.

Looks like you need the Windows version of libpcap headers/lib for this
to have any chance to work.

Searching for 'libpcap' led to http://www.tcpdump.org/ which as a link
to http://www.tcpdump.org/wpcap.html and another search for 'winpcap'
leads to http://www.winpcap.org/install/default.htm which says the
installer includes driver + DLLs.

Downloading and extracting the gem via

  gem fetch pcap
  gem unpack pcap-0.7.0.gem

gives you a `pcap-0.7.0\ext\extconf.rb` file containing

  pcap_dir        = with_config("pcap-dir", "/usr/local")
  pcap_includedir = with_config("pcap-includedir", pcap_dir +
"/include")
  pcap_libdir     = with_config("pcap-libdir", pcap_dir + "/lib"

so once you've installed WinPcap you should be able to try to build the
pcap gem again using something similar to the following but using the
dirs from your WinPcap install:

  gem install pcap -- --with-pcap-includedir="c:/devlibs/pcap/include"
--with-pcap-libdir="c:/devlibs/pcap/lib"

I've not tried installing pcap on Win7 with 1.9.3 but I suspect none of
this will work for you because the pcap 0.7.0 version is from 12/2009
(project may be dead) and it's README says it requires ruby 1.4.x.

Have you searched rubygems.org for 'pcap' and tried things like
https://github.com/shadowbq/pcaprub

If you try all these ideas and still can't get things to work (and no
one responds with a solution here) join us over at the RubyInstaller
list http://groups.google.com/group/rubyinstaller as Luis and others may
be able to help.

Jon

-- 
Posted via http://www.ruby-forum.com/.