NOT LINKING OTHER FILES

Dharm S <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <CAFyUrtas0K010VXr4UOu0LwndexJ3ntJ=FS5tPu_GaxVtRcimQ@mail.gmail.com>
Hi All,

I have generated mfd files for ETHTOOL-MIB following the example of
http://vincent.bernat.im/en/blog/2012-extending-netsnmp.html.
I did the changes on my files as he had done.

And used the following command for compiling subagent

net-snmp-config --compile-subagent mysub ethtoolStatTable.c

I got the following error :

generating the temporary code file: netsnmptmp.3771.c
void init_ethtoolStatTable(void);
checking for init_ethtoolStatTable in ethtoolStatTable.c
init_ethtoolStatTable(void)

DEBUGMSGTL(("verbose:ethtoolStatTable:init_ethtoolStatTable","called\n"));
} /* init_ethtoolStatTable */
checking for shutdown_ethtoolStatTable in ethtoolStatTable.c
shutdown_ethtoolStatTable(void)
running: gcc  -fno-strict-aliasing -g -O2 -Ulinux -Dlinux=linux
-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
-I/usr/local/lib/perl5/5.18.2/x86_64-linux-thread-multi/CORE   -I.
-I/usr/local/include -o mysub netsnmptmp.3771.c  ethtoolStatTable.c
-L/usr/local/ssl/lib  -L/usr/local/lib -lnetsnmpmibs -lnetsnmpagent
-lnetsnmp -lnetsnmpmibs -ldl  -lnetsnmpagent  -Wl,-E
-Wl,-rpath,/usr/local/lib/perl5/5.18.2/x86_64-linux-thread-multi/CORE
-lnetsnmp
/tmp/ccNfcjfS.o: In function `shutdown_table_ethtoolStatTable':
/home/dell/ethtoolStatTable/ethtoolStatTable.c:114: undefined reference to
`_ethtoolStatTable_shutdown_interface'
/tmp/ccNfcjfS.o: In function `initialize_table_ethtoolStatTable':
/home/dell/ethtoolStatTable/ethtoolStatTable.c:102: undefined reference to
`_ethtoolStatTable_initialize_interface'
/tmp/ccNfcjfS.o: In function `shutdown_table_ethtoolStatTable':
/home/dell/ethtoolStatTable/ethtoolStatTable.c:114: undefined reference to
`_ethtoolStatTable_shutdown_interface'
collect2: error: ld returned 1 exit status
removing the temporary code file: netsnmptmp.3771.c

I believe it has to do with ethtoolStatTable.h config commands

/*
 * Note: this file originally auto-generated by mib2c using
 *       version : 14170 $ of $
 *
 * $Id:$
 */
#ifndef ETHTOOLSTATTABLE_H
#define ETHTOOLSTATTABLE_H

#ifdef __cplusplus
extern "C" {
#endif


/** @addtogroup misc misc: Miscellaneous routines
 *
 * @{
 */
#include <net-snmp/library/asn1.h>

/* other required module components */
    /* *INDENT-OFF*  */
config_add_mib(ETHTOOL-MIB)
config_require(ETHTOOL-MIB/ethtoolStatTable/ethtoolStatTable_interface)
config_require(ETHTOOL-MIB/ethtoolStatTable/ethtoolStatTable_data_access)
config_require(ETHTOOL-MIB/ethtoolStatTable/ethtoolStatTable_data_get)
config_require(ETHTOOL-MIB/ethtoolStatTable/ethtoolStatTable_data_set)
    /* *INDENT-ON*  */

/* OID and column number definitions for ethtoolStatTable */
#include "ethtoolStatTable_oids.h"

/* enum definions */
#include "ethtoolStatTable_enums.h"

/* *********************************************************************
 * function declarations
 */
void init_ethtoolStatTable(void);
void shutdown_ethtoolStatTable(void);

/* *********************************************************************
 * Table declarations
 */
/**********************************************************************
 **********************************************************************
 ***
 *** Table ethtoolStatTable
 ***
 **********************************************************************
 **********************************************************************/
/*
 * ETHTOOL-MIB::ethtoolStatTable is subid 1 of ethtool.
 * Its status is Current.
 * OID: .1.3.6.1.4.1.39178.100.1.1, length: 10
*/
/* *********************************************************************
 * When you register your mib, you get to provide a generic
 * pointer that will be passed back to you for most of the
 * functions calls.
 *
 * TODO:100:r: Review all context structures
 */
    /*
     * TODO:101:o: |-> Review ethtoolStatTable registration context.
     */
typedef netsnmp_data_list ethtoolStatTable_registration;

/**********************************************************************/
/*
 * TODO:110:r: |-> Review ethtoolStatTable data context structure.
 * This structure is used to represent the data for ethtoolStatTable.
 */
/*
 * This structure contains storage for all the columns defined in the
 * ethtoolStatTable.
 */
typedef struct ethtoolStatTable_data_s {

        /*
         * ethtoolStat(2)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
         */
   U64   ethtoolStat;

} ethtoolStatTable_data;


/*
 * TODO:120:r: |-> Review ethtoolStatTable mib index.
 * This structure is used to represent the index for ethtoolStatTable.
 */
typedef struct ethtoolStatTable_mib_index_s {

        /*
         * ifIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/A/w/e/R/d/H
         */
   long   ifIndex;

        /*
         *
ethtoolStatName(1)/ShortDisplayString/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/H
         */
   char   ethtoolStatName[100];
   size_t      ethtoolStatName_len;


} ethtoolStatTable_mib_index;

    /*
     * TODO:121:r: |   |-> Review ethtoolStatTable max index length.
     * If you KNOW that your indexes will never exceed a certain
     * length, update this macro to that length.
     *
     * BE VERY CAREFUL TO TAKE INTO ACCOUNT THE MAXIMUM
     * POSSIBLE LENGHT FOR EVERY VARIABLE LENGTH INDEX!
     * Guessing 128 - col/entry(2)  - oid len(10)
*/
#define MAX_ethtoolStatTable_IDX_LEN     102


/* *********************************************************************
 * TODO:130:o: |-> Review ethtoolStatTable Row request (rowreq) context.
 * When your functions are called, you will be passed a
 * ethtoolStatTable_rowreq_ctx pointer.
 */
typedef struct ethtoolStatTable_rowreq_ctx_s {

    /** this must be first for container compare to work */
    netsnmp_index        oid_idx;
    oid                  oid_tmp[MAX_ethtoolStatTable_IDX_LEN];

    ethtoolStatTable_mib_index        tbl_idx;

    ethtoolStatTable_data              data;

    /*
     * flags per row. Currently, the first (lower) 8 bits are reserved
     * for the user. See mfd.h for other flags.
     */
    u_int                       rowreq_flags;

    /*
     * TODO:131:o: |   |-> Add useful data to ethtoolStatTable rowreq
context.
     */

    /*
     * storage for future expansion
     */
    netsnmp_data_list             *ethtoolStatTable_data_list;

} ethtoolStatTable_rowreq_ctx;

typedef struct ethtoolStatTable_ref_rowreq_ctx_s {
    ethtoolStatTable_rowreq_ctx *rowreq_ctx;
} ethtoolStatTable_ref_rowreq_ctx;

/* *********************************************************************
 * function prototypes
 */
    int ethtoolStatTable_pre_request(ethtoolStatTable_registration *
user_context);
    int ethtoolStatTable_post_request(ethtoolStatTable_registration *
user_context,
        int rc);


    ethtoolStatTable_rowreq_ctx *

ethtoolStatTable_row_find_by_mib_index(ethtoolStatTable_mib_index *mib_idx);

extern oid ethtoolStatTable_oid[];
extern int ethtoolStatTable_oid_size;


#include "ethtoolStatTable_interface.h"
#include "ethtoolStatTable_data_access.h"
#include "ethtoolStatTable_data_get.h"
#include "ethtoolStatTable_data_set.h"

/*
 * DUMMY markers, ignore
 *
 * TODO:099:x: *************************************************************
 * TODO:199:x: *************************************************************
 * TODO:299:x: *************************************************************
 * TODO:399:x: *************************************************************
 * TODO:499:x: *************************************************************
 */

#ifdef __cplusplus
}
#endif

#endif /* ETHTOOLSTATTABLE_H */
/** @} */

Should i change the path in config_require?

I tried by using
config_require(ethtoolStatTable_interface)
config_require(ethtoolStatTable_data_access)
config_require(ethtoolStatTable_data_get)
config_require(ethtoolStatTable_data_set)

and also by including the folder where all files including defaults
reside(ethtool1) :
config_require(ethtool1/ethtoolStatTable_interface)
config_require(ethtool1/ethtoolStatTable_data_access)
config_require(ethtool1/ethtoolStatTable_data_get)
config_require(ethtool1/ethtoolStatTable_data_set)

Its all giving the same error finally.

Have I missed out changing anything else??

Thanks

------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk

_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.