Programmer
Programmer

Reputation: 8717

Net-SNMP : Unable to build in VC 2017 Version 15

I have recently download Net-SNMP code from their website and trying to build in VC 2017 - and it fails.

The extracted folder has win32.dsp and win32dll.dsp - when I try to open in VC IDE I get error like -

Message

 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  

Almost for all projects - the build via command line 'nmake' utility also fails with below error -

    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 Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\bin\Hostx64\x64\cl.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\bin\Hostx64\x64\nmake.EXE"' : return code '0x2'
Stop.

How can we resolve the issue?

Upvotes: 0

Views: 1429

Answers (2)

Jonathan Jansson
Jonathan Jansson

Reputation: 301

If you built with OpenSSL you may have set INCLUDE and LIB paths and replaced the ones set by vcvars. If you set INCLUDE and LIB before running vcvars it will probably work. I concatenated to them to fix the issue.

Upvotes: 1

Sanbrother
Sanbrother

Reputation: 621

I can't build directly from VS2017 neither.
According to the file README.win32, install ActivePerl first, then run win32\build.bat.

Updated: I have just push a branch that fixed compilation issue. Have a look at this: https://github.com/sanbrother/net-snmp/tree/VS2017/v5.8
(solution file net-snmp\win32\win32dll.sln)

PS: It seems that, old version (may be before 5.7.3???) has no such problems. New code split some files into multiple ones, and caused compilation issue under Windows.

Upvotes: 0

Related Questions