Discussion:
NetBSD-6: bpf_validate()/bpf_filter() duplicate declaration pcap.h pcap/bpf.h breaks C++
(too old to reply)
David Brownlee
2012-03-14 18:53:59 UTC
Permalink
I'm trying to build the latest mongodb (C++ app) on NetBSD-6, and it
fails with the following error:

In file included from tools/sniffer.cpp:30:0:
/usr/include/pcap/bpf.h:382:8: error: previous declaration of 'u_int
bpf_filter(const bpf_insn*, const u_char*, u_int, u_int)' with 'C++'
linkage
/usr/include/pcap.h:354:71: error: conflicts with new declaration with
'C' linkage
/usr/include/pcap/bpf.h:381:6: error: previous declaration of 'int
bpf_validate(const bpf_insn*, int)' with 'C++' linkage
/usr/include/pcap.h:355:51: error: conflicts with new declaration with
'C' linkage

This seems to be because both /usr/include/pcap.h and
/usr/include/pcap/bpf.h declare:

int bpf_validate(const struct bpf_insn *, int);
u_int bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int);

Since /usr/include/pcap.h includes /usr/include/pcap/bpf.h (#ifndef
PCAP_DONT_INCLUDE_PCAP_BPF_H)
is this really necessary, or even desirable?

Needless to say commenting out the duplicate declarations allows a
build to complete...

Is this a fault with NetBSD's includes?

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Martin Husemann
2012-03-14 21:49:59 UTC
Permalink
Post by David Brownlee
This seems to be because both /usr/include/pcap.h and
<net/bpf.h> (which is what /usr/include/pcap/bpf.h points to) is missing
__BEGIN_DECLS/__END_DECLS - this is a bug in NetBSD include files, please
file a PR (it is not yet fixed in -current).

Martin

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Loading...