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


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

I have installed the developer pack now and i think i am very near to solve this problem:
C:\strawberry\cpan\build\Net-Pcap-0.16-A9_0Y2>perl Makefile.PL INC=-IC +:/WpdPack/ Include "LIBS=-LC:/WpdPack/Lib -lwpcap" Set up gcc environment - 3.4.5 (mingw-vista special r3) Unable to patch socket.h looking for -lwpcap... yes checking for pcap_lib_version() in -lwpcap... yes detecting available functions... ok Writing Makefile for Net::Pcap
can somebody please tell how to proceed further, if i try to install Net:Pcap through cpan i still get the same error.
CPAN.pm: Going to build S/SA/SAPER/Net-Pcap-0.16.tar.gz Set up gcc environment - 3.4.5 (mingw-vista special r3) Unable to patch socket.h looking for -lwpcap... yes checking for pcap_lib_version() in -lwpcap... no - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - You appear to lack the WinPcap developer pack. If it is installed in a non-standard location, please try setting the +LIBS and INC values on the command line. For instance, if you have unziped + the developer's pack in C:\WpdPack, you should execute: perl Makefile.PL INC=-IC:/WpdPack/Include "LIBS=-LC:/WpdPack/Lib - +lwpcap" Or get and install the WinPcap developer's pack from http://www.winpcap.org/install/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - detecting available functions... ok Checking if your kit is complete... Looks good Note (probably harmless): No library found for -lwpcap Writing Makefile for Net::Pcap

Replies are listed 'Best First'.
Re^5: Error while installing Net::Pcap on Windows Strawberry Perl
by syphilis (Archbishop) on Oct 08, 2010 at 02:30 UTC
    can somebody please tell how to proceed further

    Having run
    perl Makefile.PL INC=-IC:/WpdPack/Include "LIBS=-LC:/WpdPack/Lib -lwpc +ap"
    follow that with dmake test and then dmake install

    I notice that you're now getting "Unable to patch socket.h", presumably because it has already been patched, so I think you can ignore that. If there's any problem with socket.h, it should show up during dmake test anyway.

    If you want to be able to build it with CPAN, add C:/WpdPack/Include to the incpath setting (in perl/lib/Config_heavy.pl) and add C:/WpdPack/Lib to the libpth setting (in both perl/lib/Config_heavy.pl and perl/lib/Config.pm). I think that should work.
    An alternative to messing with incpath is to simply set the CPATH envronment variable:
    set CPATH=C:\WpdPack\Include
    Cheers,
    Rob
      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
        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