说明:
根据net-snmp-5.6中的“README.win32”摘录和翻译。转载请注明出处。
email:wulinshuxue@hotmail
net-snmp 在windows下用MSVC编译(一)
net-snmp是一个开源项目,提供关于snmp的一些库和工具。下载网址:
sourceforge/projects/net-snmp/
目前的最新版本是5.6。如果想简单地安装一下的话,可以下载x86exe版本,一般最新版的程序还没有发布exe版本。目前最新的exe版本为net-snmp-5.5.
在网上搜了一下,大多是在linux下的编译过程,windows下的情况比较少,另外,一些注意事项也很少。
 
在下载了net-snmp-5.6后,看到里面那么多的文件,觉得很晕。我猜里面需要先读的文件大概是adme”,这个文件是在win32环境下编译使用net-snmp的说明文件。
用记事本打开后,估计超长的篇幅要让不少人崩溃。不过没事,这是分小节写的,每小节有内容说明,条理很清晰。
摘录了一些说明,并作了大致的翻译,如下:
1This guide describes building with Microsoft Visual C++ 6.0 and higher, with
the gcc compiler from MinGW / MSYS, and with the gcc compiler from Cygwin.
As developers build with other Win32 environments, their notes will be
included here.
这个指南介绍了如何使用VC++6.0及更高版本以及gccbuild
2perl怎么下载、If you are using Microsoft Visual Studio 6.0, you will have to install the
Platform SDK (PSDK) first.
如果使用的是VC6.0,那么必须先安装PSDK
3If you are using any of the following environments, the PSDK download is not
necessary as the required parts of the PSDK are included:
    - Microsoft Visual Studio 2002 or later.
    - Cygwin.
    - MinGW.
使用的是这些环境的话,无需安装PSDK
4There are two ways to build Net-SNMP using Microsoft Visual C++.  The first
and easiest method is using Configure and nmake on the command line, and the
second is using the Workspace files inside the interactive development
environment.
两种方式来用VC build Net-SNMP.
第一种,也是最简单的方法,就是在命令行下使用Configurenmake
第二种,就是IDE下使用workspace文件。
4.1To use nmake on the command line, the Configure script is run first to create
the various makefiles.  Once these have been created, nmake is used to build
the applications.  Perl is required to use this method, as the Configure
script is written in Perl.  ActiveState ActivePerl is available at:
        www.activestate/Products/ActivePerl/
为了在命令行下使用nmake,必须先运行Configure脚本来生成makefile。由于Configure脚本是
Perl写的,所以要先安装ActivePerl
4.2The make file system is based on and uses the directory structure of the
projects contained in the Workspace files which are described below.  It is
recommended that you read and understand how the workspaces are configured
even if you will only be using the command line Configure / nmake system.
make文件系统是基工程的目录结构的,建议先阅读和理解workspace是如何配置的。
4.3For building via the interactive development environment, there are the Win32
workspaces win32.dsw and libdll.dsw. The last workspace allows to build a DLL
version of snmplib (netsnmp.dll).
对于使用IDE的情况,有win32.dswlibdll.dsw这两个文件。后者可以用来编译snmplbDLL版本
4.4There is one core development library ('libsnmp'), together with a number
of utility projects for the individual executable commands ('snmpget',
'snmpwalk', ).  All of these projects require the .lib created by
the libsnmp project.
有一个核心的开发库——libsnmp,和一些用于各种可执行命令(如snmpget)的工程。
所有的这些工程都需要libsnmp工程产生的.lib文件
4.5The agent requires the core library plus the other three library projects
('libagent', libhelpers' and 'netsnmpmibs') together with the main agent
project ('snmpd').
这个代理需要核心库加上其他三个库工程——libagent,libhelpersnetsnmpmibs,和
主代理工程——snmpd
4.6The final application project is the trap handler 'snmptrapd'.  This also
requires the agent libraries ('libagent' and 'netsnmpmibs') as well as the
core development library.
最终的应用工程师处理trapsnmptrapped。这同样需要代理库——libagentnetsnmpmibs
及核心开发库。
4.7There is a Debug version and Release version for each subproject.  This is so
the Debug and Release versions of an application can be built and tested
separately.
对于每个子工程,都有一个debug版本和一个发行(Release)版本。
所以,一个应用的debug版本和Release版本可以独立编译测试
 
4.8VC++ 6.0, 7.1, 8.0 (2005) and 9.0 (2008) have been tested.  Building with
earlier Microsoft compiler versions is no longer supported.
6.0及以后版本已经测试过,更早的版本不再支持
4.9OpenSSL is required to support the encryption capabilities in SNMPv3,
or SHA authentication.
要支持SNMPv3的加密或SHA鉴定(SHA authentication)的话,需要OpenSSL
4.10Since the MSVC build environment does not natively use "configure" nor "make"
to generate the various pathnames that the programs require, the header files
need to be manually modified when using the IDE, and an install script is
provided.  When using the Perl Configure / nmake system, the header files are
automatically modified and require no manual editing.
由于VC不在本地使用configuremake命令来生成程序需要的各种路径名,所以在
使用IDE的时候需要手动修改头文件,有一个安装脚本可以使用(bat文件, "win32\install-net-snmp.bat")。
如果诸位看官使用的是Perlconfigure/nmake的话,头文件会自动修改,无需劳您大驾。
4.11The projects are arranged so that ALL of the usable products, the .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.

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。