于 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.000000000 > +0200 > +++ ns2-2.35~RC6/emulate/net-pcap.cc 2011-04-16 11:26:17.000000000 +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