I have an issue building net-snmp v5.6. It appears that there are some 
incompatible files in the source tree where one file defines a macro as a 
constant and another file uses the same name as a struct field name. Here are 
my configure arguments:

    CONFIGURE_ARGS="--enable-ipv6 --enable-shared --enable-manuals 
--disable-embedded-perl --without-perl-modules 
--with-mibs=\"SNMP-VIEW-BASED-ACM-MIB:SNMP-USER-BASED-SM-MIB:NOTIFICATION-LOG-MIB:ALARM-MIB:DISMAN-EXPRESSION-MIB:DISMAN-EVENT-MIB:IP-MIB:IF-MIB:TCP-MIB:UDP-MIB:SNMPv2-MIB:RFC1213-MIB:HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES:EtherLike-MIB:MAU-MIB:RMON-MIB:ENTITY-SENSOR-MIB:ENTITY-MIB:SNMP-TARGET-MIB:SNMP-NOTIFICATION-MIB:ITU-ALARM-TC-MIB:UCD-SNMP-MIB:NET-SNMP-AGENT-MIB:NET-SNMP-MIB:NET-SNMP-TC:SNMP-MPD-MIB:SANDVINE-MIB\"
 --with-mib-modules=\"mibII/ifmib mibII/ipv6 ucd-snmp/diskio \" 
--with-out-mib-modules=\"if-mib/ifmib notification-log-mib 
notification/snmpNotifyTable notification target\" --with-cflags=\"$USE_DEBUG 
-O2 -I$BUILD_DIR_INCLUDE\" --with-gnu-ld  --with-transports=\"UDP TCP UDPIPv6 
TCPIPv6 Unix\" --with-install-prefix=\"$BUILD_DIR_INSTALL\" --with-libs=\"-lkvm 
-ldevstat -lm\" --disable-local-smux --with-libwrap 
--with-openssl=\"/usr/local/openssl\" --with-logfile=\"\" --with-defaults"


The issue occurs when I add in mibII/ifmib or mibII/ipv6 using 
-with-mib-modules. If I don't include those modules everything builds fine. You 
will find below the output of a grep I did for the macro/struct-fields in 
question. I also included some output from gcc -E to illustrate the issue.

mibgroup/mibII/ifmib.h:#define ifLinkUpDownTrapEnable      14
mibgroup/mibII/ifmib.c:    {ifLinkUpDownTrapEnable,  ASN_INTEGER,     RWRITE, 
var_ifXEntry, 3, {1,1,14}},
mibgroup/mibII/ifmib.c:    case ifLinkUpDownTrapEnable:
mibgroup/if-mib/ifTable/ifTable_data_access.c:        if 
(rowreq_ctx->data.ifLinkUpDownTrapEnable == 1) {
mibgroup/if-mib/ifTable/ifTable.h:         * 
ifLinkUpDownTrapEnable(14)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
mibgroup/if-mib/ifTable/ifTable.h:        unsigned long ifLinkUpDownTrapEnable;


mibgroup/mibII/ifmib.h:#define ifAlias                     18
mibgroup/mibII/ifmib.h:extern WriteMethod   write_ifAlias;
mibgroup/mibII/ifmib.c:    {ifAlias,                 ASN_OCTET_STR,   RWRITE, 
var_ifXEntry, 3, {1,1,18}},
mibgroup/mibII/ifmib.c:/* ifAlias char array */
mibgroup/mibII/ifmib.c:    case ifAlias:
mibgroup/mibII/ifmib.c:        *write_method = write_ifAlias;
mibgroup/mibII/ifmib.c:write_ifAlias(int action,


When building with -E flag you can see that some of the struct members have 
been preprocessed to the macro definitions above:

# 41 "./mibgroup/if-mib/ifTable/ifTable.h" 2


    void init_ifTable(void);
    void shutdown_ifTable(void);
# 76 "./mibgroup/if-mib/ifTable/ifTable.h"
    typedef netsnmp_data_list ifTable_registration;
# 87 "./mibgroup/if-mib/ifTable/ifTable.h"
    typedef struct ifTable_data_s {
# 236 "./mibgroup/if-mib/ifTable/ifTable.h"
        unsigned long 14;
# 253 "./mibgroup/if-mib/ifTable/ifTable.h"
        char 18[64];
        unsigned long ifAlias_len;

        unsigned long 19;

        netsnmp_interface_entry *ifentry;
    } ifTable_data;

The compiler error:

/bin/bash ../libtool --mode=compile gcc -I../include -I. -I../agent 
-I../agent/mibgroup  -I../snmplib -DNETSNMP_ENABLE_IPV6 -g -O2 
-I/tmp/snmp.dave/include -Ufreebsd6 -Dfreebsd6=freebsd6 -c -o agent_index.lo 
agent_index.c
libtool: compile:  gcc -I../include -I. -I../agent -I../agent/mibgroup 
-I../snmplib -DNETSNMP_ENABLE_IPV6 -g -O2 -I/tmp/snmp.dave/include -Ufreebsd6 
-Dfreebsd6=freebsd6 -c agent_index.c  -fPIC -DPIC -o .libs/agent_index.o
In file included from ../agent/mibgroup/mib_module_includes.h:92,
                 from agent_index.c:44:
./mibgroup/if-mib/ifTable/ifTable.h:236: error: syntax error before numeric 
constant
./mibgroup/if-mib/ifTable/ifTable.h:259: error: syntax error before numeric 
constant
*** Error code 1

Stop in /tmp/snmp.dave/code/agent.
*** Error code 1

Does anyone have any idea on how to get around this issue? Is it a bug or am I 
perhaps trying to use an invalid mib module configuration?

------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to