This section demonstrates how to build Zabbix Windows agent binaries from sources with or without TLS.
The following steps will help you compile OpenSSL from sources on MS Windows 10 (64-bit).
Before proceeding, check that the Windows machine has:
Get OpenSSL sources from https://www.openssl.org/. This example uses OpenSSL 1.1.1.
Unpack OpenSSL sources, for example, into E:\openssl-1.1.1.
Open a command-line window, such as the x64 Native Tools Command Prompt for VS 2017 RC.
Go to the OpenSSL source directory (in this tutorial E:\\openssl-1.1.1.
) and verify that NASM can be found:
e:\openssl-1.1.1> nasm --version
NASM version 2.13.01 compiled on May 1 2017
e:\openssl-1.1.1> perl E:\openssl-1.1.1\Configure VC-WIN64A no-shared no-capieng no-srp no-gost no-dgram no-dtls1-method no-dtls1_2-method --api=1.1.0 --prefix=C:\OpenSSL-Win64-111-static --openssldir=C:\OpenSSL-Win64-111-static
e:\openssl-1.1.1> nmake
e:\openssl-1.1.1> nmake test
...
All tests successful.
Files=152, Tests=1152, 501 wallclock secs ( 0.67 usr + 0.61 sys = 1.28 CPU)
Result: PASS
e:\openssl-1.1.1> nmake install_sw
install\_sw
installs only software components (i.e. libraries, header files, but no documentation). To install everything, use nmake install
.
Download the PCRE or PCRE2 library (https://pcre.org/).
Extract to directory E:\pcre2-10.39.
Install CMake from https://cmake.org/download/, during install select: and ensure that cmake\bin is on your path (tested version 3.9.4).
Create a new, empty build directory, preferably a subdirectory of the source dir. For example, E:\pcre2-10.39\build.
Open a command-line window e.g. the x64 Native Tools Command Prompt for VS 2017 and from that shell environment run cmake-gui. Do not try to start Cmake from the Windows Start menu, as this can lead to errors.
Enter E:\pcre2-10.39 and E:\pcre2-10.39\build for the source and build directories, respectively.
Click the "Configure" button.
When specifying the generator for this project select "NMake Makefiles".
Create a new, empty install directory. For example, E:\pcre2-10.39-install.
The GUI will then list several configuration options. Make sure the following options are selected:
Click "Configure" again. The adjacent "Generate" button should now be active.
Click "Generate".
If any errors occur, it is recommended to delete the CMake cache before attempting to repeat the CMake build process. In the CMake GUI, the cache can be deleted by selecting "File > Delete Cache".
The build directory should now contain a usable build system - Makefile.
Open a command-line window such as the x64 Native Tools Command Prompt for VS 2017 and navigate to the Makefile mentioned above.
Run NMake command:
E:\pcre2-10.39\build> nmake install
The following steps will help you to compile Zabbix from sources on MS Windows 10 (64-bit). When compiling Zabbix with/without TLS support the only significant difference is in step 4.
git clone https://git.zabbix.com/scm/zbx/zabbix.git
cd zabbix
./bootstrap.sh
./configure --enable-agent --enable-ipv6 --prefix=`pwd`
make dbschema
make dist
Copy and unpack the archive, e.g. zabbix-7.0.0.tar.gz
, on a Windows machine.
Let's assume that sources are in E:\zabbix-7.0.0. Open a command-line window, such as the x64 Native Tools Command Prompt for VS 2017 RC. Go to:
E:\\zabbix-7.0.0\\build\\win32\\project
$ git clone https://git.zabbix.com/scm/zbx/zabbix.git
$ cd zabbix
$ ./bootstrap.sh
$ ./configure --enable-agent --enable-ipv6 --prefix=`pwd`
$ make dbschema
$ make dist
zabbix-7.2.0.tar.gz
, on a Windows machine.E:\\zabbix-7.2.0\\build\\win32\\project
.without TLS:
E:\zabbix-7.2.0\build\win32\project> nmake /K PCRE2INCDIR=E:\pcre2-10.39-install\include PCRE2LIBDIR=E:\pcre2-10.39-install\lib
with TLS:
E:\zabbix-7.2.0\build\win32\project> nmake /K -f Makefile_get TLS=openssl TLSINCDIR=C:\OpenSSL-Win64-111-static\include TLSLIBDIR=C:\OpenSSL-Win64-111-static\lib PCRE2INCDIR=E:\pcre2-10.39-install\include PCRE2LIBDIR=E:\pcre2-10.39-install\lib
E:\zabbix-7.2.0\build\win32\project> nmake /K -f Makefile_sender TLS=openssl TLSINCDIR="C:\OpenSSL-Win64-111-static\include TLSLIBDIR="C:\OpenSSL-Win64-111-static\lib" PCRE2INCDIR=E:\pcre2-10.39-install\include PCRE2LIBDIR=E:\pcre2-10.39-install\lib
E:\zabbix-7.2.0\build\win32\project> nmake /K -f Makefile_agent TLS=openssl TLSINCDIR=C:\OpenSSL-Win64-111-static\include TLSLIBDIR=C:\OpenSSL-Win64-111-static\lib PCRE2INCDIR=E:\pcre2-10.39-install\include PCRE2LIBDIR=E:\pcre2-10.39-install\lib
The process is similar to compiling with OpenSSL, but you need to make small changes in files located in the build\win32\project
directory:
/DHAVE_OPENSSL_WITH_PSK
To do so, find:
CFLAGS = $(CFLAGS) /DHAVE_OPENSSL /DHAVE_OPENSSL_WITH_PSK
and replace it with
CFLAGS = $(CFLAGS) /DHAVE_OPENSSL
/NODEFAULTLIB:LIBCMT
To do so, find:
/MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DYNAMICBASE:NO /PDB:$(TARGETDIR)\$(TARGETNAME).pdb
and replace it with
/MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DYNAMICBASE:NO /PDB:$(TARGETDIR)\$(TARGETNAME).pdb /NODEFAULTLIB:LIBCMT