welshkc has asked for the wisdom of the Perl Monks concerning the following question:

I have no clues as to the issue with this. I've read through the docs on CPAN and googled as well. Any clues would be appreciated. This is a fresh download of Net::RawIP. pcap is correctly in place. Stuff like Net::DNS compile fine. Thanks
[root@piranha_tp1 Net-RawIP-0.1]# make cp RawIP.pm blib/lib/Net/RawIP.pm AutoSplitting blib/lib/Net/RawIP.pm (blib/lib/auto/Net/RawIP) cp RawIP/libpcap.pod blib/lib/Net/RawIP/libpcap.pod /usr/bin/perl /usr/lib/perl5/5.8.5/ExtUtils/xsubpp -typemap /usr/lib/ +perl5/5.8.5/ExtUtils/typemap -typemap typemap RawIP.xs > RawIP.xsc & +& mv RawIP.xsc RawIP.c gcc -c -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING -f +no-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_ +FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -m32 -march=i386 + -mtune=pentium4 -DVERSION=\"0.1\" -DXS_VERSION=\"0.1\" -fPIC "-I/u +sr/lib/perl5/5.8.5/i386-linux-thread-multi/CORE" -D_LINUX_ -D_ETH_ - +D_IFLIST_ -D_GLIBC_ RawIP.c RawIP.xs: In function `ip_opts_creat': RawIP.xs:444: error: label at end of compound statement RawIP.xs: In function `tcp_opts_creat': RawIP.xs:543: error: label at end of compound statement RawIP.xs: In function `XS_Net__RawIP_tcp_pkt_parse': RawIP.xs:764: warning: use of cast expressions as lvalues is deprecate +d RawIP.xs:790: warning: use of cast expressions as lvalues is deprecate +d RawIP.xs: In function `XS_Net__RawIP_icmp_pkt_parse': RawIP.xs:823: warning: use of cast expressions as lvalues is deprecate +d RawIP.xs: In function `XS_Net__RawIP_generic_pkt_parse': RawIP.xs:863: warning: use of cast expressions as lvalues is deprecate +d RawIP.xs: In function `XS_Net__RawIP_udp_pkt_parse': RawIP.xs:897: warning: use of cast expressions as lvalues is deprecate +d RawIP.xs: In function `XS_Net__RawIP_dispatch': RawIP.xs:1289: warning: use of cast expressions as lvalues is deprecat +ed RawIP.xs: In function `XS_Net__RawIP_loop': RawIP.xs:1311: warning: use of cast expressions as lvalues is deprecat +ed make: *** [RawIP.o] Error 1

Replies are listed 'Best First'.
Re: RawIP compile problems
by tachyon (Chancellor) on Dec 31, 2004 at 06:49 UTC

    It works for me on linux but I think your compiler may be choking on an extended line in RawIP.xs:

    sv_catpvn(ip_opts,SvPV(*av_fetch(opts,i+2,0),l), SvCUR(*av_fetch(opts,i+2,0))); break; default: } /* reported error line 444 */ sv_catpvn(ip_opts,SvPV(*av_fetch(opts,i+2,0),l), SvCUR(*av_fetch(opts,i+2,0))); break; default: } /* reported error line 543 */

    Basically the code before the first two errors (which will be fatal unlike the warnings) is just a loop with a switch statement in it. I have a feeling that your compiler does not like the sv_catpvn(...) being on two lines without a \ line continuation. Try changing it to:

    sv_catpvn(ip_opts,SvPV(*av_fetch(opts,i+2,0),l),SvCUR(*av_fetch(opts,i ++2,0))); # or sv_catpvn(ip_opts,SvPV(*av_fetch(opts,i+2,0),l), \ SvCUR(*av_fetch(opts,i+2,0)));

    cheers

    tachyon

      I have the feeling the compiler doesn't like the default:, with nothing following it. The compiler choking over a newline seems too far fetched - nor does the error message suggest anything like that. On the other hand, error: label at end of compound statement strongly suggests the problem lies with a label at the end of a compound statement. Like default:.

      I'd try default: ;, or default: break;, or if that doesn't work, removing the default lines.

        I had the same problem. '%s/default:/default: ;/g' in vi fixed it. Thanks!