Compile Net-SNMP from source

Download the Net-SNMP source:
http://www.net-snmp.org/download.html

When try to compile the source, please use the fresh/original source for each platform!


Linux gcc3 64bit

Static Library

cd /opt/mydir/netsnmp/5.7.3

tar -xvf net-snmp-5.7.3.tar.gz

mkdir linux-gcc3

cd net-snmp-5.7.3

./configure '--prefix=/opt/mydir/netsnmp/5.7.3/linux-gcc3' '--without-openssl' '--with-default-snmp-version=3' '--with-sys-contact=vohungtuan@gmail.com' '--with-sys-location=Saigon, VN' '--with-logfile=/var/log/snmpd.log' '--with-persistent-directory=/var/net-snmp' '--without-perl-modules' '--without-python-modules' '--disable-embedded-perl' '--disable-shared' '--enable-static' '--enable-ipv6' '--with-pic' '--with-cc=gcc' 'CC=gcc' 'CFLAGS=-m64' 2>&1 | tee conf_linux.log

make 2>&1 | tee make.log

make install

Both Linux 64 and 32 bit configurations don't have the option "--without-rpm". If you don't want your NetSNMP libraries depend on the RPM libraries, let add this option.

Linux gcc3 32bit

Static Library

cd /opt/mydir/netsnmp/5.7.3

tar -xvf net-snmp-5.7.3.tar.gz

mkdir linux-gcc3_32bit

cd net-snmp-5.7.3

./configure '--prefix=/opt/mydir/netsnmp/5.7.3/linux-gcc3_32bit' '--without-openssl' '--with-default-snmp-version=3' '--with-sys-contact=vohungtuan@gmail.com' '--with-sys-location=Saigon, VN' '--with-logfile=/var/log/snmpd.log' '--with-persistent-directory=/var/net-snmp' '--without-perl-modules' '--without-python-modules' '--disable-embedded-perl' '--disable-shared' '--enable-static' '--enable-ipv6' 2>&1 | tee conf_linux.log

make 2>&1 | tee make.log

make install


When try to compile the source, please use the fresh/original source for each platform!

Solaris SPARC 64bit

Static Library

cd /opt/mydir/netsnmp/5.7.3

gunzip -c net-snmp-5.7.3.tar.gz | tar xvf -

mkdir solaris-2.x

cd net-snmp-5.7.3

./configure '--prefix=/opt/mydir/netsnmp/5.7.3/solaris-2.x' '--without-openssl' '--with-default-snmp-version=3' '--with-sys-contact=vohungtuan@gmail.com' '--with-sys-location=Saigon, VN' '--with-logfile=/var/log/snmpd.log' '--with-persistent-directory=/var/net-snmp' '--without-perl-modules' '--without-python-modules' '--disable-embedded-perl' '--disable-shared' '--enable-static' '--enable-ipv6' '--with-pic' '--with-cc=cc' 'CC=cc' 'CFLAGS=-m64 -Dsolaris2=solaris2' 2>&1 | tee conf_sol.log

make 2>&1 | tee make.log

make install

ERROR!!!

Makefile:###: *** commands commence before first target. Stop.

We HAVE TO EDIT these Makefile

net-snmp-5.7.3/agent/Makefile

net-snmp-5.7.3/agent/mibgroup/Makefile

File these texts and append the symbol \ at the end of line.

swrun_procfs_psinfo

agentx_config

Solaris SPARC 32bit

Static Library

cd /opt/mydir/netsnmp/5.7.3

gunzip -c net-snmp-5.7.3.tar.gz | tar xvf -

mkdir solaris_sparc_32bit

cd net-snmp-5.7.3

./configure '--prefix=/opt/mydir/netsnmp/5.7.3/solaris_sparc_32bit' '--without-openssl' '--with-default-snmp-version=3' '--with-sys-contact=vohungtuan@gmail.com' '--with-sys-location=Saigon, VN' '--with-logfile=/var/log/snmpd.log' '--with-persistent-directory=/var/net-snmp' '--without-perl-modules' '--without-python-modules' '--disable-embedded-perl' '--disable-shared' '--enable-static' '--enable-ipv6' '--with-pic' 'CFLAGS=-m32 -Dsolaris2=solaris2 2>&1 | tee conf_sol.log

make 2>&1 | tee make.log

make install

ERROR!!!

Makefile:###: *** commands commence before first target. Stop.

We HAVE TO EDIT these Makefile

net-snmp-5.7.3/agent/Makefile

net-snmp-5.7.3/agent/mibgroup/Makefile

File these texts and append the symbol \ at the end of line.

swrun_procfs_psinfo

agentx_config


When try to compile the source, please use the fresh/original source for each platform!

Windows

- We should install Active Perl.
- Go to C:/opt/mydir/netsnmp/5.7.3/win32 and edit the perl file build.pl

Edit this:

- $default_openssldir // Where is OpenSSL
- $default_install_base // Where to install NetSNMP
- $install_devel // Compile the develooment files
-$link_dynamic // Static or dynamic library

my $openssl = false;
my $default_openssldir = $target_arch eq "x64" ?
"C:\\OpenSSL-Win64" : "C:\\OpenSSL-Win32";
my $default_opensslincdir = $default_openssldir . "\\include";
my $opensslincdir = $default_opensslincdir;
my $default_openssllibdir = $default_openssldir . "\\lib\\VC";
my $openssllibdir = $default_openssllibdir;
my $b_ipv6 = false;
my $b_winextdll = false;
my $sdk = false;
my $default_install_base = "c:/mydir/netsnmp_win";
my $install_base = $default_install_base;
my $install = true;
my $install_devel = false;
my $perl = false;
my $perl_install = false;
my $logging = true;
my $debug = false;
my $configOpts = "";
my $link_dynamic = false;
my $option;

Windows 64 bit with Visual Studio 2013

Static Library

cd C:/opt/mydir/netsnmp/5.7.3/win32
call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x64
set Platform=x64
set TARGET_CPU=x64
perl build.pl

Windows 32 bit with Visual Studio 2013

When try to compile the source, please use the fresh/original source for each platform!

Static Library

cd C:/opt/mydir/netsnmp/5.7.3/win32
call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86
set Platform=x86
set TARGET_CPU=x86
perl build.pl


To build NetSNMP by Visual Studio 6.0, we can try these steps:

Build 32-bit version:

cd C:/opt/mydir/netsnmp/5.7.3/win32
call "C:\Program Files (x86)\Microsoft Visual Studio\VC98\bin\vcvarsall.bat" x86
set Platform=x86
set TARGET_CPU=x85

You also need the latest Windows SDK for Visual Studio 6.0 (February 2003):

set INCLUDE=C:\Microsoft SDK\include;%INCLUDE%
set LIB=C:\Microsoft SDK\lib;%LIB%

set INCLUDE=C:\openssl\openssl-1.0.0o\win32\include;%INCLUDE%
set LIB=C:\openssl\openssl-1.0.0o\win32\lib;%LIB%

We also need to edit this file:
C:\net-snmp-5.7.3\win32\net-snmp\net-snmp-config.h.in
Change the word "libeay32MD.lib" to "libeay32.lib".

perl Configure --with-sdk --with-ssl --config=release --prefix="c:/mydir/netsnmp_win"
nmake clean
nmake
nmake install
nmake /nologo install_devel

You will get some error like:

snmpdf.c
link.exe @C:DOCUME~1DMLANG~1LOCALS~1Tempnma05416.
LINK : fatal error LNK1104: cannot open file "libeay32MD.lib"
NMAKE : fatal error U1077: 'link.exe' : return code '0x450'
Stop.
NMAKE : fatal error U1077: 'C:PROGRA~1MICROS~3VC98BINNMAKE.EXE' : return c
Stop.

Open .dsp file in C:\\netsnmp5.7.3\net-snmp-5.7.3\win32\snmpdf
Rebuild all with Win32 - Release mode
Don't care error.
Re-run above steps and the workaround until the errors are resolved.

Build the library:

perl Configure --with-sdk --with-ssl --config=release --prefix="c:/mydir/netsnmp_win"
nmake libs_clean
nmake libs
nmake install

Loading