[ZBX-8054] Building agent on Windows requires afxres.h, winres.h Created: 2014 Apr 09  Updated: 2024 Apr 10  Resolved: 2017 Nov 28

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent (G)
Affects Version/s: None
Fix Version/s: 3.0.14rc1, 3.4.5rc1, 4.0.0alpha1, 4.0 (plan)

Type: Problem report Priority: Trivial
Reporter: Andris Zeila Assignee: Valdis Kauķis (Inactive)
Resolution: Fixed Votes: 1
Labels: compilation, windows
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows


Attachments: PNG File SDK_req_components.PNG    
Issue Links:
Duplicate
Team: Team A
Sprint: Sprint 21, Sprint 22
Story Points: 0.5

 Description   

afxres.h and winres.h are part of MFC and are not included in Microsoft Platform SDK. To build Zabbix agent on Windows users must either use non express edition of Visual Studio or copy the required files to Platform SDK installation. As we are not using MFC we should be able to replace afxres.h includes in resource.rc with winresrc.h allowing to build Zabbix agent with Platform SDK without any additional requirements.



 Comments   
Comment by Oleksii Zagorskyi [ 2015 Nov 28 ]

Let's collect in this issue related discussions.

1. In http://zabbixzone.com/zabbix/compiling-zabbix-agent-on-windows/ Ricardo suggested to replace and replace "afxres.h" by "windows.h" in resource.rc file.

2. Existing forum discussion: https://www.zabbix.com/forum/showthread.php?t=5711&page=3

3. In https://support.zabbix.com/browse/ZBX-2203#comment-32385 asaveljevs suggested to:

Install Microsoft Windows SDK with examples.
The agent needs afxres.h and winres.h to build and the SDK does not have these headers by default. To solve this, go to the examples directory, grab these header files and put them into the SDK's main include directory.
From the SDK command prompt, go to the directory build\win32\project from svn checkout. Type "nmake /f Makefile_agent" and that should build the agent binary. Similarly, you can do with zabbix_get and zabbix_sender.

Comment by Oleksii Zagorskyi [ 2015 Nov 28 ]

As I can see, starting from zabbix 3.0 (after ZBXNEXT-1263) windows agent compilation is a bit different:
If setup compilation environment correctly (differently fox x86 and x64) then it's possible to just issue command nmake

Note - it's not required anymore to specify make file for nmake command, all components will be build.

FYI - ZBX-10120 requests to reorganize "build" folder to be more user friendly and if it will be applied, instruction below will have a bit different paths.

As for now the instruction is:
Install Widows SDK. It's not required to install recent one, so we suggest Windows SDK for Windows 7
Only a few components are required. In "Developer Tools" section need to select only:
"Windows Headers and Libraries", "Visual C++ Compilers", "Windows Development Tools":

Extract zabbix sources for example to folder C:\zabbix-3.0.0
Then run cmd and in opened window execute:

cmd.exe /E:ON /V:ON /K "C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin\SetEnv.Cmd" /x86 /xp

Window title should become "Microsoft Windows XP x86 DEBUG Build Environment"
Note that the path depends on installed version of Windows SDK, the path above is actual for "Windows SDK for Windows 7"

If you want to build executable for x64 platform, in the first command replace /x86 by /x64

Then go to a specific zabbix sources folder and compile:

cd C:\zabbix-3.0.0\build\win32\project
nmake

Compiled executable files should appear in bin folder of main sources folder.

Comment by Oleksii Zagorskyi [ 2015 Nov 28 ]

My dirty tests show that only first entry of afxres.h does matter.
Note that winres.h file is actually required because it's required by the afxres.h

I tried to replace afxres.h (only 1st entry) by winresrc.h (as suggested in issue description) and was able to compile agent successfully.

If we would perform such change I think then we then could officially document how to build agent on windows, without forcing users to copy SDK's .h files.

Comment by enderless [ 2016 Feb 18 ]

Changing the first entry of "afxres.h" to "winresc.h" and running nmake gives me the following:

resource.rc(72) : error RC2127 : version WORDs separated by commas expected

resource.rc(72) : error RC2167 : unrecognized VERSIONINFO field;  BEGIN or comma
 expected
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin\x6
4\rc.exe"' : return code '0x3'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\
VC\Bin\amd64\nmake.EXE"' : return code '0x2'
Stop.

Getting the same error with 2.4.4 and 3.0.0 using the suggested Win7 SDK and .NET 3.5 SP1 with Visual Studio 2015 Community edition. I'm using the SDK cli with the cmd.exe flags that you've highlighted above with both x86 & x64.

Any suggestions?

Comment by Andris Zeila [ 2016 Feb 19 ]

You should also replace {ZABBIX_REVISION} with some number in include/version.h

Comment by enderless [ 2016 Feb 19 ]

@Andris Zeila: That worked! Thank you

Comment by Zeljko [ 2016 Apr 19 ]

Hi, I am compiling my version of windows zabbix agent with TSL support and I am stuck with this error....

C:\zabbix-3.0.1\build\win32\project>nmake CPU=AMD64 TLS=openssl TLSINCDIR="C:\Op
enSSL-Win32" TLSLIB="C:\OpenSSL-Win32\lib\libeay32.lib" TLSLIB2="C:\OpenSSL-Win3
2\lib\ssleay32.lib"

C:\zabbix-3.0.1\build\win32\project>
C:\zabbix-3.0.1\build\win32\project>nmake

Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
Copyright (C) Microsoft Corporation.  All rights reserved.

        nmake /f Makefile_agent

Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
Copyright (C) Microsoft Corporation.  All rights reserved.

        cl.exe ..\..\..\src\libs\zbxconf\cfg.c /Fo"..\..\..\src\libs\zbxconf\cfg
.o" /I ..\..\..\src\zabbix_agent /I .\ /I ..\include /I ..\..\..\include  /D WIT
H_AGENT_METRICS /D WITH_COMMON_METRICS /D WITH_SPECIFIC_METRICS  /D WITH_HOSTNAM
E_METRIC /D WITH_SIMPLE_METRICS /Zi /Fdzabbix_agentd.exe.pdb /nologo /O2 /Ob1 /G
F /FD /EHsc /MT /Gy /W3 /c /D _WINDOWS /D _WIN32_WINNT=0x0500  /D _CONSOLE /D UN
ICODE /D _UNICODE /D HAVE_WINLDAP_H /D HAVE_ASSERT_H  /D ZABBIX_SERVICE /D "_VC8
0_UPGRADE=0x0600" /D HAVE_IPV6 /TC
cfg.c
..\..\..\src\libs\zbxconf\cfg.c(246) : error C2065: 'ZBX_CFG_FILE_REQUIRED' : un
declared identifier
..\..\..\src\libs\zbxconf\cfg.c(337) : error C2065: 'ZBX_CFG_FILE_REQUIRED' : un
declared identifier
..\..\..\src\libs\zbxconf\cfg.c(446) : error C2036: 'cfg_line *' : unknown size
..\..\..\src\libs\zbxconf\cfg.c(446) : error C2037: left of 'parameter' specifie
s undefined struct/union 'cfg_line'
..\..\..\src\libs\zbxconf\cfg.c(448) : error C2036: 'cfg_line *' : unknown size
..\..\..\src\libs\zbxconf\cfg.c(448) : error C2037: left of 'parameter' specifie
s undefined struct/union 'cfg_line'
..\..\..\src\libs\zbxconf\cfg.c(448) : error C2168: 'strcmp' : too few actual pa
rameters for intrinsic function
..\..\..\src\libs\zbxconf\cfg.c(456) : error C2036: 'cfg_line *' : unknown size
..\..\..\src\libs\zbxconf\cfg.c(456) : error C2037: left of 'type' specifies und
efined struct/union 'cfg_line'
..\..\..\src\libs\zbxconf\cfg.c(458) : error C2065: 'TYPE_INT' : undeclared iden
tifier
..\..\..\src\libs\zbxconf\cfg.c(458) : error C2051: case expression not constant

..\..\..\src\libs\zbxconf\cfg.c(462) : error C2036: 'cfg_line *' : unknown size
..\..\..\src\libs\zbxconf\cfg.c(462) : error C2037: left of 'min' specifies unde
fined struct/union 'cfg_line'
..\..\..\src\libs\zbxconf\cfg.c(462) : error C2036: 'cfg_line *' : unknown size
..\..\..\src\libs\zbxconf\cfg.c(462) : error C2037: left of 'max' specifies unde
fined struct/union 'cfg_line'
..\..\..\src\libs\zbxconf\cfg.c(462) : error C2036: 'cfg_line *' : unknown size
..\..\..\src\libs\zbxconf\cfg.c(462) : error C2037: left of 'max' specifies unde
fined struct/union 'cfg_line'
..\..\..\src\libs\zbxconf\cfg.c(465) : error C2036: 'cfg_line *' : unknown size
..\..\..\src\libs\zbxconf\cfg.c(465) : error C2037: left of 'variable' specifies
 undefined struct/union 'cfg_line'
..\..\..\src\libs\zbxconf\cfg.c(467) : error C2065: 'TYPE_STRING_LIST' : undecla
red identifier
..\..\..\src\libs\zbxconf\cfg.c(467) : error C2051: case expression not constant

..\..\..\src\libs\zbxconf\cfg.c(470) : error C2065: 'TYPE_STRING' : undeclared i
dentifier
..\..\..\src\libs\zbxconf\cfg.c(470) : error C2051: case expression not constant

..\..\..\src\libs\zbxconf\cfg.c(471) : error C2036: 'cfg_line *' : unknown size
..\..\..\src\libs\zbxconf\cfg.c(471) : error C2037: left of 'variable' specifies
 undefined struct/union 'cfg_line'
..\..\..\src\libs\zbxconf\cfg.c(472) : error C2036: 'cfg_line *' : unknown size
..\..\..\src\libs\zbxconf\cfg.c(472) : error C2037: left of 'variable' specifies
 undefined struct/union 'cfg_line'
..\..\..\src\libs\zbxconf\cfg.c(472) : error C2198: 'zbx_strdup2' : too few argu
ments for call
..\..\..\src\libs\zbxconf\cfg.c(474) : error C2065: 'TYPE_MULTISTRING' : undecla
red identifier
..\..\..\src\libs\zbxconf\cfg.c(474) : error C2051: case expression not constant

..\..\..\src\libs\zbxconf\cfg.c(475) : error C2036: 'cfg_line *' : unknown size
..\..\..\src\libs\zbxconf\cfg.c(475) : error C2037: left of 'variable' specifies
 undefined struct/union 'cfg_line'
..\..\..\src\libs\zbxconf\cfg.c(475) : warning C4047: 'function' : 'char ***' di
ffers in levels of indirection from 'char *'
..\..\..\src\libs\zbxconf\cfg.c(475) : warning C4024: 'zbx_strarr_add' : differe
nt types for formal and actual parameter 1
..\..\..\src\libs\zbxconf\cfg.c(475) : error C2198: 'zbx_strarr_add' : too few a
rguments for call
..\..\..\src\libs\zbxconf\cfg.c(477) : error C2065: 'TYPE_UINT64' : undeclared i
dentifier
..\..\..\src\libs\zbxconf\cfg.c(477) : error C2051: case expression not constant

..\..\..\src\libs\zbxconf\cfg.c(481) : error C2036: 'cfg_line *' : unknown size
..\..\..\src\libs\zbxconf\cfg.c(481) : error C2037: left of 'min' specifies unde
fined struct/union 'cfg_line'
..\..\..\src\libs\zbxconf\cfg.c(481) : error C2036: 'cfg_line *' : unknown size
..\..\..\src\libs\zbxconf\cfg.c(481) : error C2037: left of 'max' specifies unde
fined struct/union 'cfg_line'
..\..\..\src\libs\zbxconf\cfg.c(481) : error C2036: 'cfg_line *' : unknown size
..\..\..\src\libs\zbxconf\cfg.c(481) : error C2037: left of 'max' specifies unde
fined struct/union 'cfg_line'
..\..\..\src\libs\zbxconf\cfg.c(484) : error C2036: 'cfg_line *' : unknown size
..\..\..\src\libs\zbxconf\cfg.c(484) : error C2037: left of 'variable' specifies
 undefined struct/union 'cfg_line'
..\..\..\src\libs\zbxconf\cfg.c(491) : error C2065: 'ZBX_CFG_STRICT' : undeclare
d identifier
..\..\..\src\libs\zbxconf\cfg.c(500) : error C2036: 'cfg_line *' : unknown size
..\..\..\src\libs\zbxconf\cfg.c(500) : error C2037: left of 'parameter' specifie
s undefined struct/union 'cfg_line'
..\..\..\src\libs\zbxconf\cfg.c(502) : error C2065: 'PARM_MAND' : undeclared ide
ntifier
..\..\..\src\libs\zbxconf\cfg.c(502) : error C2036: 'cfg_line *' : unknown size
..\..\..\src\libs\zbxconf\cfg.c(502) : error C2037: left of 'mandatory' specifie
s undefined struct/union 'cfg_line'
..\..\..\src\libs\zbxconf\cfg.c(505) : error C2036: 'cfg_line *' : unknown size
..\..\..\src\libs\zbxconf\cfg.c(505) : error C2037: left of 'type' specifies und
efined struct/union 'cfg_line'
..\..\..\src\libs\zbxconf\cfg.c(507) : error C2065: 'TYPE_INT' : undeclared iden
tifier
..\..\..\src\libs\zbxconf\cfg.c(507) : error C2051: case expression not constant

..\..\..\src\libs\zbxconf\cfg.c(508) : error C2036: 'cfg_line *' : unknown size
..\..\..\src\libs\zbxconf\cfg.c(508) : error C2037: left of 'variable' specifies
 undefined struct/union 'cfg_line'
..\..\..\src\libs\zbxconf\cfg.c(511) : error C2065: 'TYPE_STRING' : undeclared i
dentifier
..\..\..\src\libs\zbxconf\cfg.c(511) : error C2051: case expression not constant

..\..\..\src\libs\zbxconf\cfg.c(512) : error C2065: 'TYPE_STRING_LIST' : undecla
red identifier
..\..\..\src\libs\zbxconf\cfg.c(512) : error C2051: case expression not constant

..\..\..\src\libs\zbxconf\cfg.c(513) : error C2036: 'cfg_line *' : unknown size
..\..\..\src\libs\zbxconf\cfg.c(513) : error C2037: left of 'variable' specifies
 undefined struct/union 'cfg_line'
..\..\..\src\libs\zbxconf\cfg.c(542) : error C2036: 'cfg_line *' : unknown size
..\..\..\src\libs\zbxconf\cfg.c(542) : error C2037: left of 'parameter' specifie
s undefined struct/union 'cfg_line'
..\..\..\src\libs\zbxconf\cfg.c(549) : error C2036: 'cfg_line *' : unknown size
..\..\..\src\libs\zbxconf\cfg.c(549) : error C2037: left of 'parameter' specifie
s undefined struct/union 'cfg_line'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\
VC\Bin\amd64\cl.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\
VC\Bin\amd64\nmake.EXE"' : return code '0x2'
Stop.

Can anyone please help me to resolve this error?

BR

Comment by Oleksii Zagorskyi [ 2016 Apr 19 ]

Zeljko, this is a bug report tracker, for technical discussion please use http://zabbix.org/wiki/Getting_help
Also, see ZBXNEXT-3047

Comment by Etahudu Fon [ 2016 Nov 08 ]
        link.exe ..\..\..\src\libs\zbxalgo\algodefs.o  ..\..\..\src\libs\zbxalgo\vector.o  ..\..\..\src\libs\zbxcommon\alias.o  ..\..\..\src\libs\zbxcommon\comms.o  ..\..\..\src\libs\zbxcommon\iprange.o  ..\..\..\src\libs\zbxcommon\misc.o  ..\..\..\src\libs\zbxcommon\str.o  ..\..\..\src\libs\zbxcommon\xml.o  ..\..\..\src\libs\zbxcommon\zbxgetopt.o  ..\..\..\src\libs\zbxcommon\file.o  ..\..\..\src\libs\zbxcomms\comms.o  ..\..\..\src\libs\zbxcomms\telnet.o  ..\..\..\src\libs\zbxconf\cfg.o  ..\..\..\src\libs\zbxcrypto\base64.o  ..\..\..\src\libs\zbxcrypto\md5.o  ..\..\..\src\libs\zbxjson\json.o  ..\..\..\src\libs\zbxjson\json_parser.o  ..\..\..\src\libs\zbxlog\log.o  ..\..\..\src\libs\zbxsys\mutexs.o  ..\..\..\src\libs\zbxsys\symbols.o  ..\..\..\src\libs\zbxsys\threads.o  ..\..\..\src\libs\zbxexec\execute.o  ..\..\..\src\libs\zbxsysinfo\agent\agent.o  ..\..\..\src\libs\zbxsysinfo\common\common.o  ..\..\..\src\libs\zbxsysinfo\common\cpu.o  ..\..\..\src\libs\zbxsysinfo\common\file.o  ..\..\..\src\libs\zbxsysinfo\common\http.o  ..\..\..\src\libs\zbxsysinfo\common\net.o  ..\..\..\src\libs\zbxsysinfo\common\system.o  ..\..\..\src\libs\zbxsysinfo\simple\ntp.o  ..\..\..\src\libs\zbxsysinfo\simple\simple.o  ..\..\..\src\libs\zbxsysinfo\win32\cpu.o  ..\..\..\src\libs\zbxsysinfo\win32\diskio.o  ..\..\..\src\libs\zbxsysinfo\win32\diskspace.o  ..\..\..\src\libs\zbxsysinfo\win32\memory.o  ..\..\..\src\libs\zbxsysinfo\win32\net.o  ..\..\..\src\libs\zbxsysinfo\win32\pdhmon.o  ..\..\..\src\libs\zbxsysinfo\win32\proc.o  ..\..\..\src\libs\zbxsysinfo\win32\services.o  ..\..\..\src\libs\zbxsysinfo\win32\swap.o  ..\..\..\src\libs\zbxsysinfo\win32\uptime.o  ..\..\..\src\libs\zbxsysinfo\win32\win32.o  ..\..\..\src\libs\zbxsysinfo\win32\wmi.o  ..\..\..\src\libs\zbxsysinfo\sysinfo.o  ..\..\..\src\libs\zbxsysinfo\win32\software.o  ..\..\..\src\libs\zbxsysinfo\win32\system.o  ..\..\..\src\libs\zbxsysinfo\win32\hostname.o  ..\..\..\src\libs\zbxwin32\perfmon.o  ..\..\..\src\libs\zbxwin32\service.o  ..\..\..\src\libs\zbxself\selfmon.o  ..\..\..\src\zabbix_agent\active.o  ..\..\..\src\zabbix_agent\cpustat.o  ..\..\..\src\zabbix_agent\eventlog.o  ..\..\..\src\zabbix_agent\listener.o  ..\..\..\src\zabbix_agent\logfiles.o  ..\..\..\src\zabbix_agent\perfstat.o  ..\..\..\src\zabbix_agent\stats.o  ..\..\..\src\zabbix_agent\zabbix_agentd.o  ..\..\..\src\zabbix_agent\zbxconf.o  ..\..\..\src\libs\zbxregexp\gnuregex.o  ..\..\..\src\libs\zbxregexp\zbxregexp.o  ..\..\..\src\libs\zbxwin32\fatal.o zabbix_agent.res /NOLOGO /MACHINE:X86 /DEBUG /OPT:REF /DELAYLOAD:wevtapi.dll /INCREMENTAL:NO /MANIFEST /MANIFESTFILE:"zabbix_agentd.exe.manifest"  /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /SUBSYSTEM:CONSOLE /DYNAMICBASE:NO  /PDB:..\..\..\bin\win32\zabbix_agentd.pdb /OUT:..\..\..\bin\win32\zabbix_agentd.exe ws2_32.lib psapi.lib pdh.lib Wldap32.lib advapi32.lib uuid.lib Iphlpapi.lib delayimp.lib wevtapi.lib
wmi.o : warning LNK4229: invalid directive '/FAILIFMISMATCH:_CRT_STDIO_ISO_WIDE_SPECIFIERS=0' encountered; ignored
LIBCMT.lib(vswprnc.obj) : error LNK2005: __vsnwprintf_s_l already defined in mutexs.o
LIBCMT.lib(printf.obj) : error LNK2005: _printf already defined in str.o
misc.o : error LNK2019: unresolved external symbol ___stdio_common_vsscanf referenced in function __vsscanf_l
simple.o : error LNK2001: unresolved external symbol ___stdio_common_vsscanf
sysinfo.o : error LNK2001: unresolved external symbol ___stdio_common_vsscanf
logfiles.o : error LNK2001: unresolved external symbol __ultod3
misc.o : error LNK2019: unresolved external symbol __ultod3 referenced in function _str2double
memory.o : error LNK2001: unresolved external symbol __ultod3
swap.o : error LNK2001: unresolved external symbol __ultod3
sysinfo.o : error LNK2001: unresolved external symbol __ultod3
str.o : error LNK2019: unresolved external symbol ___acrt_iob_func referenced in function ___zbx_zbx_error
log.o : error LNK2001: unresolved external symbol ___acrt_iob_func
sysinfo.o : error LNK2001: unresolved external symbol ___acrt_iob_func
zabbix_agentd.o : error LNK2001: unresolved external symbol ___acrt_iob_func
str.o : error LNK2019: unresolved external symbol ___stdio_common_vfprintf referenced in function ___zbx_zbx_error
log.o : error LNK2001: unresolved external symbol ___stdio_common_vfprintf
sysinfo.o : error LNK2001: unresolved external symbol ___stdio_common_vfprintf
zabbix_agentd.o : error LNK2001: unresolved external symbol ___stdio_common_vfprintf
str.o : error LNK2019: unresolved external symbol ___stdio_common_vsprintf referenced in function ___zbx_zbx_snprintf_alloc
gnuregex.o : error LNK2019: unresolved external symbol ___report_rangecheckfailure referenced in function _re_compile_fastmap
comms.o : error LNK2001: unresolved external symbol ___report_rangecheckfailure
telnet.o : error LNK2001: unresolved external symbol ___report_rangecheckfailure
execute.o : error LNK2001: unresolved external symbol ___report_rangecheckfailure
net.o : error LNK2001: unresolved external symbol ___report_rangecheckfailure
comms.o : error LNK2019: unresolved external symbol ___stdio_common_vsprintf_s referenced in function __vsprintf_s_l
eventlog.o : error LNK2001: unresolved external symbol ___stdio_common_vswprintf
log.o : error LNK2019: unresolved external symbol ___stdio_common_vswprintf referenced in function _StringCchPrintfW
mutexs.o : error LNK2001: unresolved external symbol ___stdio_common_vswprintf
service.o : error LNK2001: unresolved external symbol ___stdio_common_vswprintf
cpustat.o : error LNK2001: unresolved external symbol ___stdio_common_vswprintf
mutexs.o : error LNK2019: unresolved external symbol ___stdio_common_vsnwprintf_s referenced in function __snwprintf_s
diskspace.o : error LNK2019: unresolved external symbol __ltod3 referenced in function _VFS_FS_SIZE
proc.o : error LNK2001: unresolved external symbol __ltod3
wmi.o : error LNK2019: unresolved external symbol "void __cdecl operator delete(void *,unsigned int)" (??3@YAXPAXI@Z) referenced in function __unwindfunclet$??0_bstr_t@@QAE@PBD@Z$0
sysinfo.o : error LNK2019: unresolved external symbol __dtoul3 referenced in function _get_result_ui64_value
logfiles.o : error LNK2001: unresolved external symbol __dtoul3
..\..\..\bin\win32\zabbix_agentd.exe : fatal error LNK1120: 12 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\Bin\link.exe"' : return code '0x460'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\Bin\nmake.EXE"' : return code '0x2'
Stop.

Use the suggested Win7 SDK and .NET 3.5 SP1 with Visual Studio 2015 Community edition, and zabbix 3.2.1, getting this error.
Can anyone resolve this fatal error?
Thanks
========
It works!
the .o files are produced by previous compiling with another target, nmake clean & nmake again solved this.

Comment by Oleksii Zagorskyi [ 2017 May 08 ]

Related issues (as for "how to compile"):
ZBXNEXT-3168 - asks for compilation instructions with encryption (ZBXNEXT-3047 has related drafts)
ZBX-3924 - has a fresh description how to compile with pcre library

Comment by sh0thub [ 2017 Sep 29 ]

Hello, today I successfully compiled zabbix agent 3.0.11 with TLS support (openssl 1.1.0f) on Windows 10 Pro using VS2015 with the steps:

  1. Download Visual C++ 2015 Build Tools from http://landinghub.visualstudio.com/visual-cpp-build-tools (direct link: http://go.microsoft.com/fwlink/?LinkId=691126)
  2. Install Visual C++ 2015 Build Tools with checked SDK for Windows 10
  3. Download zabbix source files, extract using 7-zip or another software, for example to c:\zabbix_src
  4. Fix some files in zabbix sources in C:\zabbix_src\build\win32\project to sucessfully compile:
    • Change line in resources.rc file from #include "afxres.h" to #include "windows.h"
    • Change line in Makefile_sender_dll file from ..\..\..\src\zabbix_sender\win32\zabbix_sender.o to ..\..\..\src\zabbix_sender\zabbix_sender.o
  5. Download and install OpenSSL 1.1.0f (Full, not Light) from https://slproweb.com/products/Win32OpenSSL.html
  6. Run VC2015 shell using Start\Programs\Visual C++ Build Tools\Windows Desktop Command Prompts
    • For compile 32-bit zabbix agent run Visual C++ 2015 x86 Native Build Tools Command Prompt
    • For compile 64-bit zabbix agent run Visual C++ 2015 x64 Native Build Tools Command Prompt
  7. cd to extracted zabbix sources, subfolder build\win32\project:
    • CD C:\zabbix_src\build\win32\project
  8. Run nmake with these parameters:
    • For compile 32-bit zabbix agent run: nmake CPU=i386 TLS=openssl TLSINCDIR="C:\OpenSSL-Win32\include" TLSLIBDIR="C:\OpenSSL-Win32\lib"
    • For compile 64-bit zabbix agent run: nmake CPU=AMD64 TLS=openssl TLSINCDIR="C:\OpenSSL-Win64\include" TLSLIBDIR="C:\OpenSSL-Win64\lib"
    • Note: Before running another compilation, please create empty copy of zabbix sources, simple "nmake clear" is not enough.
  9. Compiled binaries will be in:
    • For 32-bit: C:\zabbix_src\bin\win32
    • For 64-bit: C:\zabbix_src\bin\win64
  10. Copy these openssl dll to directory, where you built binaries (you need to copy these files to directory, where you have zabbix_agentd.exe)
    • For 32-bit: C:\OpenSSL-Win32\bin\msvcr120.dll, C:\OpenSSL-Win32\libcrypto-1_1.dll, C:\OpenSSL-Win32\libssl-1_1.dll
    • For 64-bit: C:\OpenSSL-Win64\bin\msvcr120.dll, C:\OpenSSL-Win64\libcrypto-1_1.dll, C:\OpenSSL-Win64\libssl-1_1.dll
  11. Enjoy zabbix agent with TLS
  12. Check compiled TLS support in zabbix_agentd log file: TLS support: YES

I only tested VS2015, but 2017 will probably work too.
I hope this helps.

Comment by Andris Mednis [ 2017 Sep 29 ]

Thanks, sh0thub, for sharing !
VS 2017 RC Community Edition works, too.

Comment by Valdis Kauķis (Inactive) [ 2017 Nov 22 ]

Fixed in svn://svn.zabbix.com/branches/dev/ZBX-8054

Verified with Windows SDK v7.0 and Windows Software Development Kit – Windows 10.0.16299.15, both 32-bit and 64-bit versions.

Comment by Valdis Kauķis (Inactive) [ 2017 Nov 27 ]

Available in:

  • 3.0.14rc1 r75038
  • 3.4.5rc1 r75041
  • 4.0.0alpha1 r75045
Comment by Valdis Kauķis (Inactive) [ 2017 Nov 27 ]

No references to afxres.h found in Zabbix documentation, nothing to update.

Comment by sh0thub [ 2017 Nov 27 ]

Hello, I think, that it should be documented steps in zabbix manual, how to compile windows agent, optimally with TLS support...

Comment by Vladislavs Sokurenko [ 2017 Nov 27 ]

Hello, unfortunately it's out of scope of this task please follow ZBXNEXT-3047

Generated at Thu Apr 25 01:00:48 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.