Bug#619684: Bug #619684: ns2: FTBFS on kfreebsd-*: emulate/net-pcap.cc:537:19: error: 'BIOCIMMEDIATE' was not declared in this scope
Hi, I don't think this is a bug in libpcap; if your program uses BIOCIMMEDIATE then it needs to include net/bpf.h itself and not expect pcap's includes to do it. FWIW, with the following patch ns2 builds successfully for me on kfreebsd-amd64: Index: ns2-2.35~RC6/emulate/net-pcap.cc === --- ns2-2.35~RC6.orig/emulate/net-pcap.cc 2011-04-16 11:21:52.0 +0200 +++ ns2-2.35~RC6/emulate/net-pcap.cc2011-04-16 11:26:17.0 +0200 @@ -55,6 +55,10 @@ #include sys/systeminfo.h #endif +#if !defined(__linux__)!defined(__APPLE__) +#include net/bpf.h +#endif + #ifdef __cplusplus extern C { #include pcap.h -- Romain Francoise rfranco...@debian.org http://people.debian.org/~rfrancoise/ -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#619684: Bug #619684: ns2: FTBFS on kfreebsd-*: emulate/net-pcap.cc:537:19: error: 'BIOCIMMEDIATE' was not declared in this scope
于 2011年04月16日 17:39, Romain Francoise 写道: Hi, I don't think this is a bug in libpcap; if your program uses BIOCIMMEDIATE then it needs to include net/bpf.h itself and not expect pcap's includes to do it. FWIW, with the following patch ns2 builds successfully for me on kfreebsd-amd64: Index: ns2-2.35~RC6/emulate/net-pcap.cc === --- ns2-2.35~RC6.orig/emulate/net-pcap.cc 2011-04-16 11:21:52.0 +0200 +++ ns2-2.35~RC6/emulate/net-pcap.cc 2011-04-16 11:26:17.0 +0200 @@ -55,6 +55,10 @@ #include sys/systeminfo.h #endif +#if !defined(__linux__)!defined(__APPLE__) +#include net/bpf.h +#endif + #ifdef __cplusplus extern C { #include pcap.h I tested a similar patch --- ns2-2.35~RC6.orig/emulate/net-pcap.cc +++ ns2-2.35~RC6/emulate/net-pcap.cc @@ -63,6 +63,8 @@ extern C { #include pcap.h #endif +#include net/bpf.h + #include config.h #include scheduler.h #include net.h But occured an error: g++ -c -g -O2 -Wall -Wno-write-strings -DTCP_DELAY_BIND_ALL -DNO_TK -DTCLCL_CLASSINSTVAR -DNDEBUG -DLINUX_TCP_HEADER -DUSE_SHM -DHAVE_LIBTCLCL -DHAVE_TCLCL_H -DHAVE_LIBOTCL1_14 -DHAVE_OTCL_H -DHAVE_LIBTK8_5 -DHAVE_TK_H -DHAVE_LIBTCL8_5 -DHAVE_TCLINT_H -DHAVE_TCL_H -DHAVE_CONFIG_H -DNS_DIFFUSION -DSMAC_NO_SYNC -DCPP_NAMESPACE=std -DUSE_SINGLE_ADDRESS_SPACE -Drng_test -I. -I. -I/usr/include/tclcl -I/usr/include -I/usr/include/tcl -I/usr/include/tcl8.5/tcl-private/generic -I/usr/include/tcl8.5/tcl-private/generic -I/usr/include/pcap -I./tcp -I./sctp -I./common -I./link -I./queue -I./adc -I./apps -I./mac -I./mobile -I./trace -I./routing -I./tools -I./classifier -I./mcast -I./diffusion3/lib/main -I./diffusion3/lib -I./diffusion3/lib/nr -I./diffusion3/ns -I./diffusion3/filter_core -I./asim/ -I./qs -I./diffserv -I./satellite -I./wpan -o emulate/arp.o emulate/arp.cc g++ -c -g -O2 -Wall -Wno-write-strings -DTCP_DELAY_BIND_ALL -DNO_TK -DTCLCL_CLASSINSTVAR -DNDEBUG -DLINUX_TCP_HEADER -DUSE_SHM -DHAVE_LIBTCLCL -DHAVE_TCLCL_H -DHAVE_LIBOTCL1_14 -DHAVE_OTCL_H -DHAVE_LIBTK8_5 -DHAVE_TK_H -DHAVE_LIBTCL8_5 -DHAVE_TCLINT_H -DHAVE_TCL_H -DHAVE_CONFIG_H -DNS_DIFFUSION -DSMAC_NO_SYNC -DCPP_NAMESPACE=std -DUSE_SINGLE_ADDRESS_SPACE -Drng_test -I. -I. -I/usr/include/tclcl -I/usr/include -I/usr/include/tcl -I/usr/include/tcl8.5/tcl-private/generic -I/usr/include/tcl8.5/tcl-private/generic -I/usr/include/pcap -I./tcp -I./sctp -I./common -I./link -I./queue -I./adc -I./apps -I./mac -I./mobile -I./trace -I./routing -I./tools -I./classifier -I./mcast -I./diffusion3/lib/main -I./diffusion3/lib -I./diffusion3/lib/nr -I./diffusion3/ns -I./diffusion3/filter_core -I./asim/ -I./qs -I./diffserv -I./satellite -I./wpan -o emulate/icmp.o emulate/icmp.cc g++ -c -g -O2 -Wall -Wno-write-strings -DTCP_DELAY_BIND_ALL -DNO_TK -DTCLCL_CLASSINSTVAR -DNDEBUG -DLINUX_TCP_HEADER -DUSE_SHM -DHAVE_LIBTCLCL -DHAVE_TCLCL_H -DHAVE_LIBOTCL1_14 -DHAVE_OTCL_H -DHAVE_LIBTK8_5 -DHAVE_TK_H -DHAVE_LIBTCL8_5 -DHAVE_TCLINT_H -DHAVE_TCL_H -DHAVE_CONFIG_H -DNS_DIFFUSION -DSMAC_NO_SYNC -DCPP_NAMESPACE=std -DUSE_SINGLE_ADDRESS_SPACE -Drng_test -I. -I. -I/usr/include/tclcl -I/usr/include -I/usr/include/tcl -I/usr/include/tcl8.5/tcl-private/generic -I/usr/include/tcl8.5/tcl-private/generic -I/usr/include/pcap -I./tcp -I./sctp -I./common -I./link -I./queue -I./adc -I./apps -I./mac -I./mobile -I./trace -I./routing -I./tools -I./classifier -I./mcast -I./diffusion3/lib/main -I./diffusion3/lib -I./diffusion3/lib/nr -I./diffusion3/ns -I./diffusion3/filter_core -I./asim/ -I./qs -I./diffserv -I./satellite -I./wpan -o emulate/net-pcap.o emulate/net-pcap.cc In file included from emulate/net-pcap.cc:66:0: /usr/include/net/bpf.h:63:8: error: redefinition of ‘struct bpf_program’ /usr/include/pcap/bpf.h:88:20: error: previous definition of ‘struct bpf_program’ /usr/include/net/bpf.h:87:8: error: redefinition of ‘struct bpf_version’ /usr/include/pcap/bpf.h:104:20: error: previous definition of ‘struct bpf_version’ /usr/include/net/bpf.h:875:8: error: redefinition of ‘struct bpf_insn’ /usr/include/pcap/bpf.h:1042:17: error: previous definition of ‘struct bpf_insn’ make[1]: *** [emulate/net-pcap.o] Error 1 make[1]: Leaving directory `/home/syq/ns2-2.35~RC6' dh_auto_build: make -j1 returned exit code 2 make: *** [build] Error 2 dpkg-buildpackage: error: debian/rules build gave error exit status 2 -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#619684: Bug #619684: ns2: FTBFS on kfreebsd-*: emulate/net-pcap.cc:537:19: error: 'BIOCIMMEDIATE' was not declared in this scope
YunQiang Su wzss...@gmail.com writes: /usr/include/net/bpf.h:63:8: error: redefinition of ‘struct bpf_program’ /usr/include/pcap/bpf.h:88:20: error: previous definition of ‘struct bpf_program’ Yes, the system's bpf.h must come first, as in my patch. -- Romain Francoise rfranco...@debian.org http://people.debian.org/~rfrancoise/ -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#619684: Bug #619684: ns2: FTBFS on kfreebsd-*: emulate/net-pcap.cc:537:19: error: 'BIOCIMMEDIATE' was not declared in this scope
tags 619684 + help thanks CCing debian-bsd@l.d.o. http://bugs.debian.org/619684 Here we find the libpcap on GNU/Linux and GNU/kfreebsd are (almost, not very sure) the same, but the package fails to build on kfreebsd-* and hurd. Could you please help on this issue? Now we guess PCAP_DONT_INCLUDE_PCAP_BPF_H is set on kfreebsd-*, but we have no kfreebsd-* box in hand to debug. Any help is highly appreciated! -- Regards, Aron Xu -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#619684: Bug #619684: ns2: FTBFS on kfreebsd-*: emulate/net-pcap.cc:537:19: error: 'BIOCIMMEDIATE' was not declared in this scope
After lindi- and wzssyqa's test, the macro PCAP_DONT_INCLUDE_PCAP_BPF_H is not defined in Sid Debian GNU/kfreebsd, so the problem becomes a bit more complicated... Help, please! -- Regards, Aron Xu -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#619684: Bug #619684: ns2: FTBFS on kfreebsd-*: emulate/net-pcap.cc:537:19: error: 'BIOCIMMEDIATE' was not declared in this scope
I got it. It used it like this #if !defined(__linux__)!defined(__APPLE__) { int immed = 1; if (ioctl(pfd_, BIOCIMMEDIATE, immed) 0) { fprintf(stderr, warning: pcap/live (%s) couldn't set immed\n, name()); perror(ioctl(BIOCIMMEDIATE)); } } #endif On linux , BIOCIMMEDIATE is not used, but on BSD, it did being used, but did *not* include net/bpf.h Then there are 2 ways to fix this bug: 1. also disable the above code block on BSD. 2. include net/bpf.h on BSD platform. Which one is better ? -- YunQiang Su -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#619684: Bug #619684: ns2: FTBFS on kfreebsd-*: emulate/net-pcap.cc:537:19: error: 'BIOCIMMEDIATE' was not declared in this scope
Or should pcap/bpf.h include net/bpf.h on BSD ? -- YunQiang Su -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#619684: Bug #619684: ns2: FTBFS on kfreebsd-*: emulate/net-pcap.cc:537:19: error: 'BIOCIMMEDIATE' was not declared in this scope
On Sat, Apr 16, 2011 at 03:49, YunQiang Su wzss...@gmail.com wrote: I got it. It used it like this #if !defined(__linux__)!defined(__APPLE__) { int immed = 1; if (ioctl(pfd_, BIOCIMMEDIATE, immed) 0) { fprintf(stderr, warning: pcap/live (%s) couldn't set immed\n, name()); perror(ioctl(BIOCIMMEDIATE)); } } #endif On linux , BIOCIMMEDIATE is not used, but on BSD, it did being used, but did *not* include net/bpf.h Then there are 2 ways to fix this bug: 1. also disable the above code block on BSD. 2. include net/bpf.h on BSD platform. Which one is better ? -- YunQiang Su I prefer to attempting to use this piece of code first. Because using BIOCIMMEDIATE could very probably get some advantages over not using them on kbsd platforms. Here is a thread about it in freebsd-arch mailing list: http://lists.freebsd.org/pipermail/freebsd-arch/2003-November/001446.html No. BIOCIMMEDIATE and non-blocking mode are different. BIOCIMMEDIATE mode means make incoming packets readable immediately; don't buffer them up until either the store buffer is full or the timeout expires. This is for use in, for example, applications that are using BPF to implement network protocols, and want to be able to respond immediately to incoming packets, as opposed to, for example, packet capture applications (tcpdump, Ethereal, etc.) which don't necessarily need to immediately show or save incoming packets and which might want to try to get as many packets as possible per read on the BPF device. -- Regards, Aron Xu -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org