Error compiling SNMPGET agent

Help
Antonio
2011-08-18
2013-05-01
  • Antonio

    Antonio - 2011-08-18

    Hi.
    I'm trying to compile this agent with the source code (VC8/Win32, Osmius Community 11.01), and it gives me the following errors:
    Compiling…
    osm_ag_snmpget.cpp
    C:\osmius\osmius\ext\net-snmp\include\net-snmp/types.h(70) : error C2371: 'ssize_t' : redefinition; different basic types
            C:\osmius\osmius\ext\ACE_wrappers\ace/os_include/sys/os_types.h(126) : see declaration of 'ssize_t'
    C:\osmius\osmius\ext\net-snmp\include\net-snmp/library/container.h(427) : error C3861: 'netsnmp_free': identifier not found
    osm_ag_interface_snmpget1.cpp
    C:\osmius\osmius\ext\net-snmp\include\net-snmp/types.h(70) : error C2371: 'ssize_t' : redefinition; different basic types
            C:\osmius\osmius\ext\ACE_wrappers\ace/os_include/sys/os_types.h(126) : see declaration of 'ssize_t'
    C:\osmius\osmius\ext\net-snmp\include\net-snmp/library/container.h(427) : error C3861: 'netsnmp_free': identifier not found

    Before compiling, I followed the common steps to compile any agent. In fact, I had been able to compile the notifications module without problems.
    Also:
    * I downloaded the net-snmp-5.4.2.1 setup, and installed it in C:\Osmius\Osmius\ext\net-snmp\usr.
      This setup adds C:\Osmius\Osmius\ext\net-snmp\bin to the PATH by default.
      I copied "lib" and "include" folders from .net-snmp\usr to c:\osmius\osmius\ext\net-snmp.
    * I modified "osm_ag_snmp.mpc" as follows:

    // -*- MPC -*-
    // $Id$
    project(*Osmius) : aceexe, ace_openssl {
      exename = osm_ag_SNMPGET1
      install = $(OSM_ROOT)/bin
    //Net-SNMP Interface:
      includes += /usr/include/net-snmp
      libs   += netsnmp
      libpaths += /usr/local/lib
      after  += ACE_SSL_lib
      libs   += ACE_SSL
     
    // Net-SNMP Solaris10 : look in http://www.sunfreeware.com
    //  includes += /usr/local/include/net-snmp
    //  libpaths += /usr/local/lib
    //  libs   += netsnmp

    //Net-SNMP HP-UX 11.11 PARISC : http://www.net-snmp.org/
    //  includes += /home/osmius/software/net-snmp-5.4.2.1/include/net-snmp
    //  includes += /home/osmius/software/net-snmp-5.4.2.1/include
    //  libpaths += /home/osmius/software/net-snmp-5.4.2.1/snmplib/.libs
    //  libs += netsnmp

    //Net-SNMP Windows 32 : http://www.net-snmp.org/
      includes += C:\osmius\osmius\ext\net-snmp\include\net-snmp
      includes += C:\osmius\osmius\ext\net-snmp\include
      libpaths += C:\osmius\osmius\ext\net-snmp\lib
      libs += netsnmp

      Source_Files {
       ./../../cm/osm_cfgmanager.cpp
       ./../../cm/osm_message.cpp
       ./../../cm/osm_reactor.cpp
       ./../../ag/osm_ag_insmanager.cpp
       ./../../ag/osm_ag_msgmanager.cpp
       ./../../ag/osm_agent_basic.cpp
       ./../../ag/osm_ag_interface_snmpget1.cpp
       osm_ag_snmpget.cpp
      }
      Header_Files {
       ./../../cm/osm_cfgmanager.h
       ./../../cm/osm_message.h
       ./../../cm/osm_reactor.h
       ./../../ag/osm_ag_insmanager.h
       ./../../ag/osm_ag_msgmanager.h
       ./../../ag/osm_agent_basic.h
       ./../../ag/osm_ag_interface_snmpget1.h
       osm_ag_snmpget.h
      }
    }

    What am I doing wrong?

    Regards,

     
  • Manuel Fraga

    Manuel Fraga - 2011-08-20

    Hi Antonio:

    What an advanced user !! I'm impressed.

    For Windows I have to change the netsnmp source code in order to compile. What I change is:

    1.- include/net-snmp-config.h

    a.-
    Original: /* #undef HAVE_WIN32_PLATFORM_SDK */
    Modif: #define HAVE_WIN32_PLATFORM_SDK 1

    b.-
    Original: /* got ssize_t? */
    /* #undef HAVE_SSIZE_T */
    Modified: /* got ssize_t?  AKI */
    #undef HAVE_SSIZE_T

    c.-
    Original: /* #undef NETSNMP_USE_DLL */
    Modified: // AKI #define NETSNMP_USE_DLL 1

    d.-
    Original: #define _WIN32_WINNT 0x500 /*_WIN32_WINNT_WIN2K*/
    Modified:
    #if !defined (_WIN32_WINNT)
    #define _WIN32_WINNT 0x500 /*_WIN32_WINNT_WIN2K*/
    #endif

    2.- include/types.h

    a.-
    Original:
      #ifndef HAVE_SSIZE_T
      #if defined(__INT_MAX__) && __INT_MAX__ == 2147483647
      typedef int ssize_t;
      #else
      typedef long ssize_t;
      #endif
      #endif
    Modified:
      // AKI
      #undef HAVE_SSIZE_T
      /*
      #ifndef HAVE_SSIZE_T
      #if defined(__INT_MAX__) && __INT_MAX__ == 2147483647
      typedef int ssize_t;
      #else
      typedef long ssize_t;
      #endif
      #endif
      */

    I hope this help you. Please let me know about your progress.

     
  • Antonio

    Antonio - 2011-08-20

    Hi Manuel.

    First of all: I am using the files installed by the setup of Net-SNMP (Version: 5.4.2.1). I've checked that this is the version used by Osmius Community 11.01.

    1.- include/net-snmp-config.h

    a.- ** OK **

    b.- ** OK **
    c.- ** OK **
    d.-
    Original: #define _WIN32_WINNT 0x500 /*_WIN32_WINNT_WIN2K*/
    Modified:
    #if !defined (_WIN32_WINNT)
    #define _WIN32_WINNT 0x500 /*_WIN32_WINNT_WIN2K*/
    #endif

    ** I don´t found these lines of code… **

    2.- include/types.h

    a.- ** OK **

    I still have problems…

    Compiling…
    osm_ag_snmpget.cpp
    C:\osmius\osmius\ext\net-snmp\include\net-snmp/library/container.h(427) : error C3861: 'netsnmp_free': identifier not found
    osm_ag_interface_snmpget1.cpp
    C:\osmius\osmius\ext\net-snmp\include\net-snmp/library/container.h(427) : error C3861: 'netsnmp_free': identifier not found

    Sounds like netsnmp.dll is not found…
    I've reinstalled Net-SNMP in C:\USR (the default path offered by the installer), and the PATH now contains C:\usr\bin.

    I've checked the list of exported functions of NETSNMP.DLL (with DEPENDS.EXE), and "netsnmp_free" exists.

    Regards,

     
  • Manuel Fraga

    Manuel Fraga - 2011-08-24

    Hi Antonio:

    I don't know what is the problem you are suffering. We are using net-snmp 5.4.2.1 for Windows on a Windows 2003 server with Visual Studio 2005 and modifiying the net-snmp source code as i told you before.

    I'm sorry. Let us know any progress or change with this issue.

    Regards

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks