Ethereal-users: Re: [ethereal-users] Problems compiling Ethereal with latest version of ucd-snmp
> I'll look into putting #includes of whatever header files are necessary
> into "packet-snmp.c"; hopefully I can do so without causing it to fail
> to compile under 3.6[.x] or 4.0[.x].
I've attached a patch; Ethereal code with the patch applied seems to
compile OK (other than getting a complaint from the linker on FreeBSD
3.4 about the use of "mktemp()" in the UCD SNMP library:
/usr/local/lib/libsnmp.a(snmp_api.o): In function `_sess_open':
/usr/local/src/ucd-snmp-4.1.1/snmplib/snmp_api.c:1074: warning: mktemp()
possibly used unsafely; consider using mkstemp()
/usr/local/lib/libsnmp.a(snmp_api.o): In function `_sess_open':
/usr/local/src/ucd-snmp-4.1.1/snmplib/snmp_api.c:1074: warning: mktemp()
possibly used unsafely; consider using mkstemp()
although the linker, alas, doesn't suggest how one should "consider
using mkstemp()" if one is writing a library that is supposed to work on
systems that don't necessarily *have* "mkstemp()"...) with UCD SNMP
3.6.2, 4.0.1, and 4.1.1.
Index: packet-snmp.c
===================================================================
RCS file: /usr/local/cvsroot/ethereal/packet-snmp.c,v
retrieving revision 1.23
diff -c -r1.23 packet-snmp.c
*** packet-snmp.c 2000/01/07 22:05:39 1.23
--- packet-snmp.c 2000/02/20 03:27:37
***************
*** 65,70 ****
--- 65,94 ----
# include <ucd-snmp/mib.h>
/*
+ * Sigh. UCD SNMP 4.1[.x] makes "snmp_set_full_objid()" a macro
+ * that calls "ds_set_boolean()" with the first two arguments
+ * being DS_LIBRARY_ID and DS_LIB_PRINT_FULL_OID; this means that,
+ * when building with 4.1[.x], we need to arrange that
+ * <ucd-snmp/default_store.h> is included, to define those two values
+ * and to declare "ds_set_boolean()".
+ *
+ * However:
+ *
+ * 1) we can't include it on earlier versions (at least not 3.6.2),
+ * as it doesn't exist in those versions;
+ *
+ * 2) we don't want to include <ucd-snmp/ucd-snmp-includes.h>,
+ * as that includes <ucd-snmp/snmp.h>, and that defines a whole
+ * bunch of values that we also define ourselves.
+ *
+ * So we only include it if "snmp_set_full_objid" is defined as
+ * a macro.
+ */
+ # ifdef snmp_set_full_objid
+ # include <ucd-snmp/default_store.h>
+ # endif
+
+ /*
* XXX - for now, we assume all versions of UCD SNMP have it.
*/
# define HAVE_SPRINT_VALUE