Re: Net::Pcap installation help (and not with the library)
by VinsWorldcom (Prior) on Jan 09, 2013 at 16:14 UTC
|
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=53292
http://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
| [reply] [Watch: Dir/Any] [d/l] [select] |
|
Thank you for the walk-thru :)
Patches 0002, and 0003 worked fine - but 0004 and 0005 get stuck.
(Error Msgs for both)
"Assertion failed: hunk, file .\src\patch\2.5.9\patch-2.5.9-src\patch.c, line 354
This application has requested runtime to terminate it in an unusual way. Please contact the application's support team for more information."
How does one, unix2dos?
| [reply] [Watch: Dir/Any] |
|
perl -pi.bak -e "s/\r/\r\n/" 0004_PATCH_FILE_NAME_HERE
| [reply] [Watch: Dir/Any] [d/l] |
|
"How does one, unix2dos?" See Unix2dos for info, and a link to download an executable (note others may exist).
| [reply] [Watch: Dir/Any] |
|
So I figured out unix2dos, patches went through - still no luck... :(
| [reply] [Watch: Dir/Any] |
|
|
|
|
|
|
|
|
|
Hi,
I'm getting an error at step 5 doing 'dmake test'.
The x64 libraries did not exist so I did have to do step 4.
First, my setup:
Win 7 64bit
Strawberry Perl v5.16.3 built for MSWin32-x64-multi-thread installed at D:\strawberry
Net-Pcap-0.17
WinPcap v4.1.3
WpdPack v4.1.2
Patches 2-5 were applied.
'perl -V:cc' gives: cc='gcc';
'perl -V:make' gives: make='dmake';
Windows PATH:
PATH=C:\Program Files\ImageMagick-6.8.0-Q16;C:\Program Files (x86)\AMD
+ APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\sys
+tem32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\Windows
+PowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core
+-Static;c:\program files\oracle\virtualbox;c:\utils;D:\strawberry\c\b
+in;D:\strawberry\perl\site\bin;D:\strawberry\perl\bin
and the results for 'dmake test':
D:\strawberry\perl\bin\perl.exe "-MExtUtils::Command::MM" "-e" "test_h
+arness(0, 'blib\lib', 'blib\arch')" t/*.t
# Testing Net::Pcap 0.17 (WinPcap version 4.1.3 (packet.dll version 4.
+1.0.2980), based on libpcap version 1.0 branch 1_0_rel0b (20091008))
+under Perl 5.016003
t/00-load.t ................ ok
t/01-api.t ................. ok
t/02-lookup.t .............. ok
t/03-openlive.t ............ skipped: must be run as root
t/04-loop.t ................ skipped: must be run as root
t/05-dump.t ................ skipped: must be run as root
t/06-offline.t ............. skipped: must be run as root
t/07-stats.t ............... skipped: must be run as root
t/08-filter.t .............. ok
t/09-error.t ............... ok
t/10-fileno.t .............. ok
t/11-snapshot.t ............ skipped: must be run as root
t/12-next.t ................ skipped: pcap_next() behaves too strangel
+y for being tested on random machines
t/13-dispatch.t ............ skipped: must be run as root
t/14-datalink.t ............ ok
# This platform has been detected as a little endian architecture
t/15-is_swapped.t .......... ok
t/16-setnonblock.t ......... ok
# WinPcap version 4.1.3 (packet.dll version 4.1.0.2980), based on libp
+cap version 1.0 branch 1_0_rel0b (20091008)
t/17-lib_version.t ......... ok
t/18-open_dead.t ........... ok
t/19-breakloop.t ........... skipped: must be run as root
t/20-constants.t ........... ok
t/21-next_ex.t ............. skipped: slowness and random failures...
+testing pcap_next_ex() is a PITA
# Failed test 'calling setbuff() with no argument'
# at t/22-open.t line 46.
# expecting: /^arg1 not a reference/
# found: p is not of type pcap_tPtr at t/22-open.t line 45.
# Failed test 'calling userbuffer() with no argument'
# at t/22-open.t line 52.
# expecting: /^Usage: Net::Pcap::setbuff\(p, size\)/
# found: userbuffer is not a valid pcap macro at t/22-open.t line 51.
# Failed test 'calling userbuffer() with no argument'
# at t/22-open.t line 57.
# expecting: /^arg1 not a reference/
# found: userbuffer is not a valid pcap macro at t/22-open.t line 56.
# Failed test 'calling setmode() with no argument'
# at t/22-open.t line 68.
# expecting: /^arg1 not a reference/
# found: p is not of type pcap_tPtr at t/22-open.t line 67.
# Failed test 'calling setmintocopy() with no argument'
# at t/22-open.t line 79.
# expecting: /^arg1 not a reference/
# found: p is not of type pcap_tPtr at t/22-open.t line 78.
# Looks like you failed 5 tests of 24.
t/22-open.t ................
Dubious, test returned 5 (wstat 1280, 0x500)
Failed 5/24 subtests
(less 13 skipped subtests: 6 okay)
# Failed test 'calling createsrcstr() with incorrect argument type f
+or arg6'
# at t/23-srcstr.t line 33.
# expecting: /^arg6 not a hash ref/
# found: arg6 not a reference at t/23-srcstr.t line 32.
# Failed test 'createsrcstr() '
# at t/23-srcstr.t line 70.
# got: 'Undefined subroutine &main::createsrcstr called at t/
+23-srcstr.t line 69.
# '
# expected: ''
# Failed test ' - should return zero: '
# at t/23-srcstr.t line 71.
# got: undef
# expected: '0'
# Failed test ' - checking created source string'
# at t/23-srcstr.t line 72.
# got: ''
# expected: 'rpcap://fangorn:12345/eth0'
# Failed test 'parsesrcstr() '
# at t/23-srcstr.t line 76.
# got: 'Undefined subroutine &main::parsesrcstr called at t/2
+3-srcstr.t line 75.
# '
# expected: ''
# Failed test ' - should return zero: '
# at t/23-srcstr.t line 77.
# got: undef
# expected: '0'
# Failed test ' - checking parsed type'
# at t/23-srcstr.t line 78.
# got: ''
# expected: 'rpcap'
# Failed test ' - checking parsed host'
# at t/23-srcstr.t line 79.
# got: ''
# expected: 'fangorn'
# Failed test ' - checking parsed port'
# at t/23-srcstr.t line 80.
# got: ''
# expected: '12345'
# Failed test ' - checking parsed name'
# at t/23-srcstr.t line 81.
# got: ''
# expected: 'eth0'
# Looks like you failed 10 tests of 18.
t/23-srcstr.t ..............
Dubious, test returned 10 (wstat 2560, 0xa00)
Failed 10/18 subtests
t/50-poe-component-pcap.t .. skipped: POE is not available
t/distchk.t ................ skipped: Test::Distribution required for
+checking distribution
t/pod.t .................... skipped: Test::Pod 1.14 required for test
+ing POD
t/podcover.t ............... skipped: Currently not working for Net::P
+cap
t/podspell.t ............... skipped: Pod spelling: for maintainer onl
+y
t/portfs.t ................. skipped: Only for the module maintainer
Test Summary Report
-------------------
t/10-fileno.t (Wstat: 0 Tests: 21 Failed: 0)
TODO passed: 19
t/22-open.t (Wstat: 1280 Tests: 24 Failed: 5)
Failed tests: 5-7, 9, 11
Non-zero exit status: 5
t/23-srcstr.t (Wstat: 2560 Tests: 18 Failed: 10)
Failed tests: 3, 10-18
Non-zero exit status: 10
Files=30, Tests=521, 5 wallclock secs ( 0.14 usr + 0.03 sys = 0.17
+CPU)
Result: FAIL
Failed 2/30 test programs. 15/521 subtests failed.
dmake: Error code 255, while making 'test_dynamic'
| [reply] [Watch: Dir/Any] [d/l] [select] |
|
| [reply] [Watch: Dir/Any] |
|
|
|
Re: Net::Pcap installation help (and not with the library)
by Anonymous Monk on Jan 09, 2013 at 15:35 UTC
|
read the readme/install, tell the Makefile.PL where to find the winpcap libraries | [reply] [Watch: Dir/Any] |
|
I fixed that - and it can find them - still doesn't install ??
| [reply] [Watch: Dir/Any] |
|
perl Makefile.PL INC=-IC:/WpdPack/Include "LIBS=-LC:/WpdPack/Lib -lwpc
+ap"
socket.h patched... ok
looking for -lwpcap... yes
checking for pcap_lib_version() in -lwpcap... yes
detecting available functions... ok
Writing Makefile for Net::Pcap
Writing MYMETA.yml and MYMETA.json
| [reply] [Watch: Dir/Any] [d/l] [select] |
|
|
|
| [reply] [Watch: Dir/Any] |
|
|