Net-SNMP:无法在 VC 2017 版本 15 中构建
Net-SNMP : Unable to build in VC 2017 Version 15
我最近从他们的网站下载了 Net-SNMP 代码并尝试在 VC 2017 年构建 - 但它失败了。
提取的文件夹有 win32.dsp 和 win32dll.dsp - 当我尝试在 VC IDE 中打开时,出现类似 -
的错误
留言
snmptrapd\snmptrapd.dsp: Unable to convert project. Please make sure this is a valid Visual C++ 6.0 project.
snmptrapd\snmptrapd.dsp: Project upgrade failed.
snmptrapd\snmptrapd.dsp: Converting project file 'C:\tools\netsnmp\net-snmp-5.8\win32\snmptrapd\snmptrapd.dsp'.
Hide 1 additional messages
几乎所有项目 - 通过命令行构建 'nmake' 实用程序也失败并出现以下错误 -
cd libagent
nmake /nologo all
cl.exe /I.. /I..\..\include /I..\..\agent\mibgroup /D WIN32 /D _BIND_TO_CURRENT_VCLIBS_VERSION /D _CONSOLE /D _CRT_NONSTDC_NO_WARNINGS /D _CRT_SECURE_NO_WARNINGS /D _MBCS /D _WINSOCK_DEPRECATED_NO_WARNINGS /EHsc /FD /FR.\release\ /Fd.\release\libagent.pdb /Fo.\release\ /I C:\OpenSSL-Win32\include /c /W3 /Zi /nologo /wd4244 /wd4267 /MD /D NDEBUG /O2 ..\..\agent\agent_handler.c ..\..\agent\agent_index.c ..\..\agent\agent_read_config.c ..\..\agent\agent_registry.c ..\..\agent\agent_sysORTable.c ..\..\agent\agent_trap.c ..\..\agent\snmp_agent.c ..\..\agent\snmp_vars.c
agent_handler.c
..\..\agent\agent_handler.c(19): fatal error C1083: Cannot open include file: 'sys/types.h': No such file or directory
agent_index.c
..\..\agent\agent_index.c(12): fatal error C1083: Cannot open include file: 'signal.h': No such file or directory
agent_read_config.c
..\..\agent\agent_read_config.c(16): fatal error C1083: Cannot open include file: 'sys/types.h': No such file or directory
agent_registry.c
..\..\agent\agent_registry.c(32): fatal error C1083: Cannot open include file: 'signal.h': No such file or directory
agent_sysORTable.c
..\..\agent\agent_sysORTable.c(3): fatal error C1083: Cannot open include file: 'stdlib.h': No such file or directory
agent_trap.c
..\..\agent\agent_trap.c(35): fatal error C1083: Cannot open include file: 'stdlib.h': No such file or directory
snmp_agent.c
..\..\agent\snmp_agent.c(50): fatal error C1083: Cannot open include file: 'sys/types.h': No such file or directory
snmp_vars.c
..\..\agent\snmp_vars.c(68): fatal error C1083: Cannot open include file: 'string.h': No such file or directory
Generating Code...
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio17\Enterprise\VC\Tools\MSVC.15.26726\bin\Hostx64\x64\cl.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio17\Enterprise\VC\Tools\MSVC.15.26726\bin\Hostx64\x64\nmake.EXE"' : return code '0x2'
Stop.
我们如何解决这个问题?
我也不能直接从 VS2017 构建。
根据文件README.win32,先安装ActivePerl,再安装运行 win32\build.bat.
更新:我刚刚推送了一个修复编译问题的分支。看看这个:https://github.com/sanbrother/net-snmp/tree/VS2017/v5.8
(解决方案文件 net-snmp\win32\win32dll.sln)
PS: 老版本(可能是5.7.3之前???)好像没有这个问题。新代码将一些文件拆分为多个文件,并导致 Windows.
下的编译问题
如果您使用 OpenSSL 构建,您可能已经设置了 INCLUDE 和 LIB 路径并替换了 vcvars 设置的路径。如果您在 运行 vcvars 之前设置 INCLUDE 和 LIB,它可能会起作用。我联系他们解决了这个问题。
我最近从他们的网站下载了 Net-SNMP 代码并尝试在 VC 2017 年构建 - 但它失败了。
提取的文件夹有 win32.dsp 和 win32dll.dsp - 当我尝试在 VC IDE 中打开时,出现类似 -
的错误留言
snmptrapd\snmptrapd.dsp: Unable to convert project. Please make sure this is a valid Visual C++ 6.0 project.
snmptrapd\snmptrapd.dsp: Project upgrade failed.
snmptrapd\snmptrapd.dsp: Converting project file 'C:\tools\netsnmp\net-snmp-5.8\win32\snmptrapd\snmptrapd.dsp'.
Hide 1 additional messages
几乎所有项目 - 通过命令行构建 'nmake' 实用程序也失败并出现以下错误 -
cd libagent
nmake /nologo all
cl.exe /I.. /I..\..\include /I..\..\agent\mibgroup /D WIN32 /D _BIND_TO_CURRENT_VCLIBS_VERSION /D _CONSOLE /D _CRT_NONSTDC_NO_WARNINGS /D _CRT_SECURE_NO_WARNINGS /D _MBCS /D _WINSOCK_DEPRECATED_NO_WARNINGS /EHsc /FD /FR.\release\ /Fd.\release\libagent.pdb /Fo.\release\ /I C:\OpenSSL-Win32\include /c /W3 /Zi /nologo /wd4244 /wd4267 /MD /D NDEBUG /O2 ..\..\agent\agent_handler.c ..\..\agent\agent_index.c ..\..\agent\agent_read_config.c ..\..\agent\agent_registry.c ..\..\agent\agent_sysORTable.c ..\..\agent\agent_trap.c ..\..\agent\snmp_agent.c ..\..\agent\snmp_vars.c
agent_handler.c
..\..\agent\agent_handler.c(19): fatal error C1083: Cannot open include file: 'sys/types.h': No such file or directory
agent_index.c
..\..\agent\agent_index.c(12): fatal error C1083: Cannot open include file: 'signal.h': No such file or directory
agent_read_config.c
..\..\agent\agent_read_config.c(16): fatal error C1083: Cannot open include file: 'sys/types.h': No such file or directory
agent_registry.c
..\..\agent\agent_registry.c(32): fatal error C1083: Cannot open include file: 'signal.h': No such file or directory
agent_sysORTable.c
..\..\agent\agent_sysORTable.c(3): fatal error C1083: Cannot open include file: 'stdlib.h': No such file or directory
agent_trap.c
..\..\agent\agent_trap.c(35): fatal error C1083: Cannot open include file: 'stdlib.h': No such file or directory
snmp_agent.c
..\..\agent\snmp_agent.c(50): fatal error C1083: Cannot open include file: 'sys/types.h': No such file or directory
snmp_vars.c
..\..\agent\snmp_vars.c(68): fatal error C1083: Cannot open include file: 'string.h': No such file or directory
Generating Code...
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio17\Enterprise\VC\Tools\MSVC.15.26726\bin\Hostx64\x64\cl.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio17\Enterprise\VC\Tools\MSVC.15.26726\bin\Hostx64\x64\nmake.EXE"' : return code '0x2'
Stop.
我们如何解决这个问题?
我也不能直接从 VS2017 构建。
根据文件README.win32,先安装ActivePerl,再安装运行 win32\build.bat.
更新:我刚刚推送了一个修复编译问题的分支。看看这个:https://github.com/sanbrother/net-snmp/tree/VS2017/v5.8
(解决方案文件 net-snmp\win32\win32dll.sln)
PS: 老版本(可能是5.7.3之前???)好像没有这个问题。新代码将一些文件拆分为多个文件,并导致 Windows.
下的编译问题如果您使用 OpenSSL 构建,您可能已经设置了 INCLUDE 和 LIB 路径并替换了 vcvars 设置的路径。如果您在 运行 vcvars 之前设置 INCLUDE 和 LIB,它可能会起作用。我联系他们解决了这个问题。