in reply to Net::Pcap installation help (and not with the library)
UPDATE: This works for Net::Pcap 0.16 on MSWin32. If using Net::Pcap 0.17, see Re^5: Net::Pcap installation help (and not with the library)
There are bugs in the Net::Pcap code that have not been patched that affect Windows installations. You can see this by looking at the bug report here https://rt.cpan.org/Public/Bug/Display.html?id=53292. Our own Corion fixed it and provided patches.
I've gotten Net::Pcap to build successfully on Windows XP / Strawberry 5.10, 5.12, 5.14 and also Windows 7 x64 / Strawberry 5.14, 5.16. I've used the following process:
References
https://rt.cpan.org/Public/Bug/Display.html?id=53292http://perlmonks.org/?node_id=894897
http://perlmonks.org/?node_id=896237
--Net::Pcap
- Get Net::Pcap from CPAN - download .tar.gz file, not with CPAN client.
- Get patches: https://rt.cpan.org/Ticket/Display.html?id=53292
- Edit patch files to remove the email headers.
- Copy *.patch files into the Net-Pcap directory.
- Apply patch files in order (0002, 0003, 0004, 0005) with:
patch -p1 < FILENAME.patch
NOTE: May have to 'unix2dos' the patch files if they don't work!
--WinPcap
- Make sure WinPcap is installed - if not, install it
- Unzip WinPcap Developers Pack http://www.winpcap.org/devel.htm in same parent directory Net::Pcap was unzipped in, e.g.,:
tmp\Net-Pcap-0.16\.. tmp\WpdPack\..
- IF on x64 platform, check on the existence of the x64 libraries:
dir WpdPack\lib\x64\*.a
- They may not exist. If not, built them:
pexports \Windows\system32\wpcap.dll > wpcap.def dlltool --as-flags=--64 -m i386:x86-64 -k --output-lib libwpcap.a --input-def wpcap.def pexports \Windows\system32\Packet.dll > Packet.def dlltool --as-flags=--64 -m i386:x86-64 -k --output-lib libpacket.a --input-def Packet.def move libwpcap.a WpdPack\lib\x64 move libpacket.a WpdPack\lib\x64
- Start the build process:
perl Makefile.PL INC=-IC:/Users/VinsWorldcom/tmp/WpdPack/Include "LI +BS=-LC:/Users/VinsWorldcom/tmp/WpdPack/Lib/x64 -lwpcap" dmake dmake test
Test by creating test.pl:
use Net::Pcap qw(:functions); @devs = pcap_findalldevs(\%devinfo, \$err); for my $dev (@devs) { print "$dev : $devinfo{$dev}\n" }
Run:
perl -Mblib test.pl
If successful output of adapters, install with:
dmake install