FAQ:Compiling 04

From Net-SNMP Wiki
Jump to: navigation, search

How can I reduce the memory footprint?

In order to reduce the memory footprint (for instance, to embed the snmpd into a device), the following configure options could be used.


This turns off the compilation of all debugging statements.

 '--enable-mini-agent' '--with-out-mib-modules=examples/ucdDemoPublic'

This creates an agent with just the essential MIB modules included. With the release of Net-SNMP 5.7 (currently in development), you will be able to use


to reduce the size a little further. NOTE: If you need additional MIB modules, then simply add them using the option '--with-mib-modules=...' but this will of course increase the memory footprint.


This option specifies the transport domains to include. For a simple standalone agent, just UDP should be sufficient. (Although the 'disman' and 'agentx' modules may require the Callback, TCP and/or Unix transport domains as well).


This can be used in order to omit the code that operates on the /dev/kmem interface. Clearly, this option cannot be used when one of the configured MIB modules depends on it.

 '--with-mibdirs=' and '--with-mibs='

These options tell the agent not to load any MIB modules. This doesn't affect the size of libraries or application binaries, but will reduce the memory footprint during runtime.


This can be used in order to omit the code that loads and parses the MIB files altogether. This will reduce both the runtime memory footprint, and the binary sizes.


This disables an extension (double, float and signed 64-bit types) to the snmp protocol that isn't strictly necessary. This option disables the extension and all the code that operate on it.

Once the agent (snmpd) has been linked, you might also try running 'strip snmpd' to remove un-necessary debug/symbol information.

Code Reduction Features in Version 5.7

Net-SNMP version 5.7 adds some additional features for removing unneeded code. You can enable these features by using:


This removes any unneeded code from the compiled instance. See the Feature Marking and Selection page for details on this feature.


This turns of SNMP SET support for the entire package if you don't need to support an agent that allows configuration directives to be sent to it.

  1. How do I control the environment used to compile the software?
  2. How do I control the environment used to compile the software under Windows?
  3. Why does the compilation complain about missing libraries?
  4. How can I reduce the memory footprint?
  5. How can I reduce the installation footprint or speed up compilation?
  6. How can I compile the project for use on an embedded system?
  7. How can I compile the project to use static linking?
  8. Why does 'make test' skip various tests?
  9. Why does 'make test' complain about a pid file?