Build failure (agent++-4.5.1)

Am updating from snmp+±3.3.10/agent+±4.1.0/agentx+±2.1.0 to latest (snmp+±3.4.7/agent+±4.5.1/agentx+±2.5.0) and get the following error when building agent++

libtool: compile:  i586-buildroot-linux-gnu-g++ -DHAVE_CONFIG_H -I. -I.. -I../include -pthread -I/opt/ThirdParty/snmp++-3.4.7/include -D_GNU_SOURCE -D_XOPEN_SOURCE=XPG6 --std=gnu++11 -ggdb -g3 -O0 -pthread -MT mib.lo -MD -MP -MF .deps/mib.Tpo -c mib.cpp  -fPIC -DPIC -o .libs/mib.o
In file included from mib.cpp:31:0:
../include/agent_pp/notification_originator.h:232:39: error: snmpCommunityEntry has not been declared
         void set_snmp_community_entry(snmpCommunityEntry* communityEntryRef) {
                                       ^
../include/agent_pp/notification_originator.h:244:17: error: snmpCommunityEntry does not name a type
         virtual snmpCommunityEntry* get_snmp_community_entry();
                 ^
../include/agent_pp/notification_originator.h:296:32: error: nlmLogEntry has not been declared
         void set_nlm_log_entry(nlmLogEntry* nlmLogEntryRef) {
                                ^
../include/agent_pp/notification_originator.h:308:17: error: nlmLogEntry does not name a type
         virtual nlmLogEntry* get_nlm_log_entry();
                 ^
../include/agent_pp/notification_originator.h:318:9: error: snmpCommunityEntry does not name a type
         snmpCommunityEntry*     communityEntry;
         ^
../include/agent_pp/notification_originator.h:321:9: error: nlmLogEntry does not name a type
         nlmLogEntry*            _nlmLogEntry;
         ^
../include/agent_pp/notification_originator.h: In member function void Agentpp::NotificationOriginator::set_snmp_community_entry(int*):
../include/agent_pp/notification_originator.h:233:13: error: communityEntry was not declared in this scope
             communityEntry = communityEntryRef;
             ^
../include/agent_pp/notification_originator.h: In member function void Agentpp::NotificationOriginator::set_nlm_log_entry(int*):
../include/agent_pp/notification_originator.h:297:13: error: _nlmLogEntry was not declared in this scope
             _nlmLogEntry = nlmLogEntryRef;
             ^
make[1]: *** [mib.lo] Error 1

snmp++ is configured with:
/configure --host=$ARCHITECTURE-buildroot-linux-gnu --build=$ARCHITECTURE-buildroot-linux-gnu --disable-snmpv3 --disable-ipv6 --prefix=$BUILDROOT/$PACKAGE --with-log-profile=quiet --enable-static=no

agent++ is configured with:
./configure --host=$ARCHITECTURE-buildroot-linux-gnu --build=$ARCHITECTURE-buildroot-linux-gnu --with-libsnmp-prefix=$BUILDROOT/snmp++-3.4.7 --prefix=$BUILDROOT/$PACKAGE --enable-static=no

There are no errors with the snmp++ build

Hi,

change the four includes at the top of the file include/agent_pp/notification_originator.h from #include "xxx.h" to #include <agent_pp/xxx.h>.

Kind regards,
Jochen

Hi,
For a configure --disable-snmpv3 or cmake -D OPTION_SNMPv3=OFF this does not fix it since there are still SNMPv3 types used in code not guarded with #ifdef _SNMPv3.

The attached patch solves it for me. Of course the samples do not build anymore due to disabled SNMPv3.

diff --git a/include/agent_pp/notification_originator.h b/include/agent_pp/notification_originator.h
index df62865…5932e5f 100755
— a/include/agent_pp/notification_originator.h
+++ b/include/agent_pp/notification_originator.h
@@ -222,6 +222,8 @@ class AGENTPP_DECL NotificationOriginator: public NotificationSender {
/
virtual snmpTargetParamsEntry
get_snmp_target_params_entry();

+#ifdef _SNMPv3
/**
* Sets the cached reference for the snmpCommunityEntry. If set to
* null, the reference will be determined by looking up the OID
@@ -243,6 +245,7 @@ class AGENTPP_DECL NotificationOriginator: public NotificationSender {
/
virtual snmpCommunityEntry
get_snmp_community_entry();

+#endif
/**
* Sets the cached reference for the snmpNotifyEntry. If set to
* null, the reference will be determined by looking up the OID
@@ -285,7 +288,7 @@ class AGENTPP_DECL NotificationOriginator: public NotificationSender {
/
virtual snmpNotifyFilterEntry
get_snmp_notify_filter_entry();

+#ifdef _SNMPv3
/**
* Sets the cached reference for the nlmLogyEntry. If set to
* null, the reference will be determined by looking up the OID
@@ -306,8 +309,8 @@ class AGENTPP_DECL NotificationOriginator: public NotificationSender {
* @since 4.3.0
/
virtual nlmLogEntry
get_nlm_log_entry();

    virtual v3MP* get_v3mp();

+#endif

protected:

@@ -315,11 +318,15 @@ class AGENTPP_DECL NotificationOriginator: public NotificationSender {
Mib* mib;
snmpTargetAddrEntry* targetAddrEntry;
snmpTargetParamsEntry* targetParamsEntry;
+#ifdef _SNMPv3
snmpCommunityEntry* communityEntry;
+#endif
snmpNotifyEntry* notifyEntry;
snmpNotifyFilterEntry* notifyFilterEntry;
+#ifdef _SNMPv3
nlmLogEntry* _nlmLogEntry;
v3MP* v3mp;
+#endif

class NotificationOriginatorParams {
public:
diff --git a/src/notification_originator.cpp b/src/notification_originator.cpp
index 4d6a2a8…29586aa 100755
— a/src/notification_originator.cpp
+++ b/src/notification_originator.cpp
@@ -50,11 +50,16 @@ NotificationOriginator::NotificationOriginator()
#endif
targetAddrEntry = 0;
targetParamsEntry = 0;
+#ifdef _SNMPv3
communityEntry = 0;
notifyEntry = 0;
+#endif
notifyFilterEntry = 0;
+
+#ifdef _SNMPv3
_nlmLogEntry = 0;
v3mp = 0;
+#endif
mib = Mib::instance;
}

@@ -219,6 +224,7 @@ snmpNotifyFilterEntry* NotificationOriginator::get_snmp_notify_filter_entry() {
return snmpNotifyFilterEntry::instance;
}

+#ifdef _SNMPv3
snmpCommunityEntry* NotificationOriginator::get_snmp_community_entry() {
if (mib || communityEntry) {
if (!communityEntry) {
@@ -241,6 +247,7 @@ nlmLogEntry* NotificationOriginator::get_nlm_log_entry() {
return nlmLogEntry::instance;
}

v3MP* NotificationOriginator::get_v3mp() {
if (mib) {
return mib->get_request_list()->get_v3mp();
@@ -248,6 +255,7 @@ v3MP* NotificationOriginator::get_v3mp() {
return v3MP::I;
}
}
+#endif

bool NotificationOriginator::check_access(ListCursor& cur,

(file attachment not allowed)

AGENT++ 4.5.2 fixed this issue.