blob: 003a06a9fd11d82938650effa131150be85caaad [file] [log] [blame]
This guide describes building with Microsoft C++ and with
the gcc compiler from Cygwin. As developers build with
other Win32 environments, their notes will be included here.
----
Status as of 4-Mar-2001 for Win32 platforms
- the client applications work
- the core framework of the agent works
- the 'system' and 'snmp' mibgroups work
- the target, smux, notification groups compile
- the agentX module compiles
- no other elements of the standard agent distribution work
- extending the agent to support enterprise-specific MIBs works
- running the agent on a non-standard port works
- running the UCD agent instead of the MS supplied one "works"
(at the loss of most of the functionality)
- running the UCD agent as a "subagent" of the MS one does not work
(i.e. using the SNMP.dll interface)
- running the UCD agent as a subagent of an AgentX master "works"
(bearing in mind this support is alpha-code)
All applications build with Cygwin.
All applications build with MSVC++, except that snmpdf does not build.
The applications build and run fine. The agent builds and runs,
but there is no support for MIB-II, which means no
interface or route information can be had from this agent.
When an interface to the NT registry is built (volunteers needed!),
then the agent will need to be developed to obtain more useful
system information.
Note: The agent cannot be built as an extensible SNMP agent that
will work with Microsoft's agent.
Neither snmpd nor snmptrapd register as NT services.
Snmptrapd does not "share" nor multiplex traps with SNMPTRAP.EXE,
a program that is available from Microsoft or ACE#COMM.
----
The remainder of this guide has the following sections :
Removing agentx from MS VC++ build
Building with MS VC++
Building with OpenSSL with MS VC++
Installing from MS VC++ build
Building with Cygwin
Installing with Cygwin
Build script for use with Cygwin
Acknowledgements
----
Removing agentx from MS VC++ build
Since this was added near the release date, we are compelled
to offer this note.
If you add the agentX modules (default), you will need to
add "-r" to your command invocation for master agent,
otherwise it will not start.
To Remove agentx
1. Edit win32/*.h. Remove references to "agentx", "master",
and "subagent" from these files. Undefine the USING lines
that refer to AGENTX.
2. Start Visual Studio. Focus the libucdmibs project.
Remove all "agentx" related files from the project.
----
Building with MS VC++
The win32 directory contains a Microsoft VC++ (5.0,6.0) workspace and
project files to build both static and DLL versions of the UCD SNMP
library and the applications. Building with earlier compiler versions
has not been attempted. Success stories are welcomed.
A manually generated config.h file has been provided for use with the
win32 build since the basic win32 environment does not support autoconf.
Note: the compiled in MIB path is \usr\mibs which may be changed by
editing win32/config.h. Note that the install instructions below
should be adjusted when changes are made to paths.
To build the libraries and applications, open the workspace file
"win32\win32.dsw" from VC++. If you use Version 6.0, answer "yes"
to convert the workspace and project files from 5.0 to 6.0 format.
Note there is a Debug version and Release
version for each subproject. Due to the way the libraries are
organized, there are exactly two library versions that work :
1) libsnmp Debug ; and 2) libsnmp_dll Release
The projects are arranged so that ALL of the usable products,
the .lib, .dll, and .exe files, are written to the win32\bin
directory. The win32\lib directory is used only to build the
the files in the win32\bin directory. Once building is completed,
there is no further use for the files in the win32\lib directory.
The Debug product .exe files have "_d" appended to the basename
of the applications. This is so the Debug and Release versions
of an application can be built and tested separately.
Runtime libraries
-----------------
Note that the library must be built using the same options as the
application which it will be linked with. In particular, the run-time
libraries must match (Project settings, C/C++ tab, 'Code Generation'
category).
For example, linking in an snmplib built to use the Multithreaded DLL
runtime library to an application configured for the Debug
Multithreaded DLL runtime library results in a link error along the
lines of 'defaultlib "MSVCRT" conflicts with use of other libs'. If
you receive a similar message, check that the projects settings
between library and application match up.
Debug Information
-----------------
Note that VC++ 6.0 has new options for for debugging information -
the 'Program Database'. This option is set in the Project settings,
C/C++ tab, 'General' category, and is turned on by default during the
conversion of the project files. This option is not for use with a
library, as it embeds debug information into the library that
references an external file that will not be available to the linking
application. If you get an error message along the lines of
'debugging information not available in file vc60.pdb, make sure the
library debug option is set to 'C7 compatible'.
To build the Release versions:
Click Build->Batch Build. Uncheck all Debug and libsnmp versions.
Make sure libsnmp_dll Release and all other Release versions
are checked. Rebuild All. If the library DLL link fails, add
missing function names to libsnmp_dll/libsnmp.def.
To build the Debug versions:
Click Build->Batch Build. Uncheck all Release and libsnmp_dll versions.
Make sure libsnmp Debug and all other Debug versions
are checked. Rebuild All.
To build both Debug and Release versions:
Click Build->Batch Build. Check all versions. Uncheck
"libsnmp Release" and "libsnmp_dll Debug" versions only.
Then click Release All.
----
Building with OpenSSL with MS VC++
OpenSSL is required to support the encryption capabilities in SNMPv3
(and will also support MD5 authentication). The win32 version of OpenSSL
can be built from the source at:
ftp://ftp.openssl.org/source/
Follow the instructions for building on win32 in that package. if you do
not have the M$ assembler installed (MASM) you can get a free one(NASM)
from:
http://www.kernel.org/pub/software/devel/nasm
You will also need to change the win32/config.h file from
---
/* define if you are using the internal MD5 code */
#define USE_INTERNAL_MD5 1
---
to
---
/* define if you are using the internal MD5 code */
#undef USE_INTERNAL_MD5
/* define if you are using OpenSSL */
#define USE_OPENSSL 1
---
now you will need to edit the VC++ Project settings for the libraries
and applications. Change the Settings->Link->'Object/Library Modules' to
include
libeay32.lib
when installing be sure to place libeay32.dll on your search path (e.g.,
usr\bin)
----
Installing from MS VC++ build
Create these subdirectories on the root directory of the
volume you wish to hold the UC-Davis SNMP applications :
usr, usr\bin, usr\mibs, usr\lib, usr\include\ucd-snmp
Copy mibs\*.txt to usr\mibs
Copy win32\bin\*.* to usr\bin
Copy win32\lib\*.* to usr\lib
Copy snmplib\*.h to usr\include\ucd-snmp
Copy win32\config.h to usr\include\ucd-snmp\ucd-snmp-config.h
if using OpenSSL
Copy libeay32.dll to usr\bin
Copy libeay32.lib to usr\lib
Installing is complete. You may want to create a compressed
archive of the \usr hierarchy.
----
Building with Cygwin
An alternate way to build UCD SNMP for win32 is to use
Cygnus's cygwin32 environment. Make sure to get the 'full' version.
The 'user' version does not contain the programs necessary to run
the GNU configure mechanism, which is used by UCD SNMP. Information
on the Cygnus cygwin32 environment is available on the web at :
http://sourceware.cygnus.com/cygwin/.
Get full.exe from Cygnus. Some developers have used Cygwin BETA 20
with success. Install the cygwin environment.
Unzip the UC-Davis SNMP tar file. cd to the SNMP base directory.
Create a subdirectory 'cyg' and cd to it. Then run the script
attached to this guide.
The attached script will build the UC-Davis SNMP package,
copy everything needed for installation into a "usr" subdirectory,
and display any error lines in the build log, which is saved
in "nohup.out". Errors and warnings only are copied to "nerrs"
for further review.
----
Installing with Cygwin
From the "cyg" directory, type "make install". This will
populate a hierarchy that mimics the other platforms.
A usr/local subdirectory has all of the installable files,
except for usr/local/share/snmp/*.conf {snmpd.conf, snmp.conf}.
snmpd.conf can be made using EXAMPLE.conf after reading the
manual pages and FAQ.
usr/local/bin - most applications
usr/local/sbin - snmpd, snmptrapd
usr/local/share/snmp - place to store snmpd.conf, snmp.conf if desired
usr/local/share/snmp/mibs - the MIB files
Installing is complete. You may want to create a compressed
archive of the \usr hierarchy.
---
Build script for use with Cygwin
The script distills information filtered from discussions on the
ucd-snmp and ucd-snmp-coders e-mail lists. The important parts
are the tokens that have "mibII" in them. The with.. and with-out..
lines avoid the non-Win32 portions of the agent.
The script runs without modification in a nearly stock Cygwin B20
environment using 3.6.1 or later source bases.
------------ cut here ----------------
:
PATH=/usr/local/bin:/usr/ccs/bin:/usr/bin:/bin
export PATH
#
# Always configure.
# some changes need to refresh the configuration.
CSTRICT=
CSTRICT="-Wwrite-strings -Wno-unused -Wno-char-subscripts"
PEDAN="-pedantic"
PEDAN=
CFLAGS="-g -O2 -Wall -Wshadow -Wstrict-prototypes \
-Wpointer-arith -Wcast-qual -Wcast-align $CSTRICT $PEDAN"
export CFLAGS
if [ ! -f ./config.h ] ; then
rm -f ucd-snmp-config.h # insurance
CC=gcc ../configure --with-sys-contact="System Administrator" \
--with-sys-location="Location" \
--with-out-mib-modules="mibII" \
--with-mib-modules="smux target examples/example examples/ucdDemoPublic mibII/snmp_mib mibII/system_mib mibII/sysORTable mibII/vacm_vars" \
--with-defaults
fi
#vi config.h
#vi agent/Makefile
#
if [ "X"$1 != "Xno" ] ; then
## Enable the next line if autoconf or autoheader aren't working.
make -k touchit
## Clean up previous attempts; Remove old installs
nohup make clean
rm -fr usr
fi
rm -f nohup.out
#
## full build with install. usr subdir will be available to package
nohup make install prefix=`pwd`/usr/local exec_prefix=`pwd`/usr/local
#
# check for errors, but not in system headers
egrep "Error|warning|No rule|exists" nohup.out > allerrs
egrep -v "^/usr" allerrs > nerrs
#
# show any errors. if user sees prompt, the build/install didn't find errors.
egrep -v "warn" nerrs
#
# do optional verification of installation.
# check recent install adds
#
------------ cut here ----------------
----
Acknowledgements
These people are known to have contributed to one or more of
the Win32 platform ports. If you have, and your name is not here,
please accept our apologies, and tell us so we can add your name.
David Perkins, Joe Marzot, Wes Hardaker, Niels Baggesen, Dave Shield,
Robert Story, Suvrit Sra, Mike Slifcak
,