http://www.perlmonks.org?node_id=864425


in reply to Re^5: Error while installing Net::Pcap on Windows Strawberry Perl
in thread Error while installing Net::Pcap on Windows Strawberry Perl

I tried using dmake test & through Cpan after setting set CPATH=C:\WpdPack\Include, in both cases i am getting these warning and installation fails again:
Set up gcc environment - 3.4.5 (mingw-vista special r3) socket.h patched... ok looking for -lwpcap... yes checking for pcap_lib_version() in -lwpcap... yes detecting available functions... ok Checking if your kit is complete... Looks good Writing Makefile for Net::Pcap cp Pcap.pm blib\lib\Net\Pcap.pm C:\Perl\bin\perl.exe C:\Perl\lib\ExtUtils\xsubpp -typemap C:\Perl\lib +\ExtUtils\ typemap -typemap typemap Pcap.xs > Pcap.xsc && C:\Perl\bin\perl.exe - +MExtUtils: :Command -e "mv" -- Pcap.xsc Pcap.c C:/Perl/site/bin/gcc.exe -c -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRIC +T -DHAVE_D ES_FCRYPT -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_ +SYS -DUSE_ PERLIO -D_USE_32BIT_TIME_T -DPERL_MSVCRT_READFIX -DHASATTRIBUTE -fno-s +trict-alia sing -mms-bitfields -O2 -DVERSION=\"0.16\" -DXS_VERSION=\ +"0.16\" " -IC:\Perl\lib\CORE" -DWINSOCK2_H_REQUESTED -DWPCAP -DHAVE_REMOTE -DHA +VE_BLANK - DHAVE_PCAP_LIB_VERSION Pcap.c In file included from Pcap.xs:43: stubs.inc:85:2: warning: #warning "the function pcap_findalldevs() is +not availa ble, but will be emulated" In file included from Pcap.xs:43: stubs.inc:90: error: redefinition of typedef 'pcap_if_t' C:/WpdPack/Include/pcap/pcap.h:89: error: previous declaration of 'pca +p_if_t' wa s here stubs.inc:91: error: redefinition of `struct pcap_if' stubs.inc:113:2: warning: #warning "the function pcap_breakloop() is n +ot availab le" stubs.inc:127:2: warning: #warning "the function pcap_setnonblock() is + not avail able" stubs.inc:142:2: warning: #warning "the function pcap_getnonblock() is + not avail able" stubs.inc:157:2: warning: #warning "the function pcap_dump_file() is n +ot availab le" stubs.inc:172:2: warning: #warning "the function pcap_dump_flush() is +not availa ble" stubs.inc:187:2: warning: #warning "the function pcap_list_datalinks() + is not av ailable" stubs.inc:202:2: warning: #warning "the function pcap_set_datalink() i +s not avai lable" stubs.inc:217:2: warning: #warning "the function pcap_datalink_name_to +_val() is not available" stubs.inc:232:2: warning: #warning "the function pcap_datalink_val_to_ +name() is not available" stubs.inc:247:2: warning: #warning "the function pcap_datalink_val_to_ +descriptio n() is not available" stubs.inc:262:2: warning: #warning "the function pcap_compile_nopcap() + is not av ailable" stubs.inc:267: error: conflicting types for 'pcap_compile_nopcap' C:/WpdPack/Include/pcap/pcap.h:319: error: previous declaration of 'pc +ap_compile _nopcap' was here stubs.inc:267: error: conflicting types for 'pcap_compile_nopcap' C:/WpdPack/Include/pcap/pcap.h:319: error: previous declaration of 'pc +ap_compile _nopcap' was here stubs.inc:277:2: warning: #warning "the function pcap_get_selectable_f +d() is not available" stubs.inc:292:2: warning: #warning "the function pcap_next_ex() is not + available " stubs.inc:307:2: warning: #warning "the function pcap_sendpacket() is +not availa ble" stubs.inc:322:2: warning: #warning "the function pcap_createsrcstr() i +s not avai lable" stubs.inc:337:2: warning: #warning "the function pcap_parsesrcstr() is + not avail able" stubs.inc:352:2: warning: #warning "the function pcap_open() is not av +ailable" stubs.inc:357: error: redefinition of `struct pcap_rmtauth' stubs.inc:373:2: warning: #warning "the function pcap_setbuff() is not + available " stubs.inc:388:2: warning: #warning "the function pcap_setuserbuffer() +is not ava ilable" stubs.inc:403:2: warning: #warning "the function pcap_setmode() is not + available " stubs.inc:418:2: warning: #warning "the function pcap_setmintocopy() i +s not avai lable" stubs.inc:433:2: warning: #warning "the function pcap_sendqueue_alloc( +) is not a vailable" stubs.inc:438: error: redefinition of `struct pcap_send_queue' stubs.inc:444: error: redefinition of typedef 'pcap_send_queue' C:/WpdPack/Include/Win32-Extensions.h:53: error: previous declaration +of 'pcap_s end_queue' was here stubs.inc:455:2: warning: #warning "the function pcap_sendqueue_destro +y() is not available" stubs.inc:469:2: warning: #warning "the function pcap_sendqueue_queue( +) is not a vailable" stubs.inc:484:2: warning: #warning "the function pcap_sendqueue_transm +it() is no t available" stubs.inc:499:2: warning: #warning "the function pcap_event() is not a +vailable" stubs.inc:514:2: warning: #warning "the function pcap_setsampling() is + not avail able" stubs.inc:519: error: redefinition of `struct pcap_samp' Pcap.c: In function `XS_Net__Pcap_strerror': Pcap.c:1584: warning: assignment discards qualifiers from pointer targ +et type dmake.exe: Error code 129, while making 'Pcap.o' SAPER/Net-Pcap-0.16.tar.gz C:\Perl\site\bin\dmake.exe -- NOT OK Running make test Can't test without successful make Running make install Make had returned bad status, install seems impossible Failed during this command: SAPER/Net-Pcap-0.16.tar.gz : make NO

Replies are listed 'Best First'.
Re^7: Error while installing Net::Pcap on Windows Strawberry Perl
by syphilis (Archbishop) on Oct 09, 2010 at 23:38 UTC
    after setting set CPATH=C:\WpdPack\Include

    Well that, at least, is working - the WpdPack headers are now being found. (Btw, if you ever need to, you can set CPATH to multiple directories by separating them with a ';' same as for the PATH variable.)

    If you can contact the Net::Pcap developers and tell them of these errors, they might be able to help.

    It looks to me that stubs.inc is in need of some alterations. I would think that the warnings are nothing to worry about, but the 'conflicting types' and 'redefinition' errors are definite showstoppers.
    I would go through stubs.inc and comment out (or remove) the code that's giving rise to these errors, but I couldn't guarantee that's the correct approach and I'm not in a position to try it out for myself.
    Then, when stubs.inc has been fixed, build the module manually (ie not using cpan) as already detailed.

    It looks like this bug (or something very similar) in the Net::Pcap source has already been reported about nine months ago .... getting assistance from the developer(s) is looking a bit unlikely. If you do try amending stubs.inc, and it works, you might like to update that bug report with the solution.

    Cheers,
    Rob

      Just as an update, there are now patches that fix this bug, at least for me. I'm not sure how soon a new release will be forthcoming though.

        I seem to get the same error but could not figure it out how to apply this patch ? Is there any alternative to make it working on window 7 ?