[comment]: # translation:outdated

[comment]: # ({55fd3f33-22c598e9})
# 2 Compilando Zabbix agent 2 en Windows

[comment]: # ({/55fd3f33-22c598e9})

[comment]: # ({84651997-84651997})
#### Descripción general

Esta sección muestra como compilar Zabbix agent 2 (Windows) desde el código fuente.

[comment]: # ({/84651997-84651997})

[comment]: # ({2a4da91c-2a4da91c})
#### Instalar el Compilador MinGW

1\. Descargar MinGW-w64 con SJLJ (set jump/long jump) Exception Handling
y Windows threads (por ejemplo
*x86\_64-8.1.0-release-win32-sjlj-rt\_v6-rev0.7z*)\
2. Extraer el paquete y moverlo a *c:\\mingw*\
3. Configurar la  variable de ambiente

    @echo off
    set PATH=%PATH%;c:\mingw\bin
    cmd

Cuando compile utilice la línea de comandos Windows en lugar de la termina MSYS provista por MinGW

[comment]: # ({/2a4da91c-2a4da91c})

[comment]: # ({71ef8bdd-dec81522})
#### Compilación de librerías de desarrollo PCRE

Las siguientes instrucciones compilarán e instalarán las librerías  PCRE de 64 bits
en *c:\\dev\\pcre* y librerías de 32 bits en *c:\\dev\\pcre32*:

1\. Descargue la librería PCRE o PCRE2 (compatible desde Zabbix 6.0) (<https://pcre.org/>) y extraigala\
2\. Abra *cmd* y navegue hasta las fuentes extraídas.

[comment]: # ({/71ef8bdd-dec81522})

[comment]: # ({5def516d-5def516d})
##### Compilar PCRE 64bit

1\. Borre las configuraciones/cache anteriores, si es que existen:

    del CMakeCache.txt
    rmdir /q /s CMakeFiles

2\. Ejecute cmake (CMake puede ser instalado desde
<https://cmake.org/download/>):

    cmake -G "MinGW Makefiles" -DCMAKE_C_COMPILER=gcc -DCMAKE_C_FLAGS="-O2 -g" -DCMAKE_CXX_FLAGS="-O2 -g" -DCMAKE_INSTALL_PREFIX=c:\dev\pcre

3\. Después, ejecute:

    mingw32-make clean
    mingw32-make install

[comment]: # ({/5def516d-5def516d})

[comment]: # ({04b79926-04b79926})
##### Compilar PCRE 32bit

1\. Ejecute:

    mingw32-make clean

2\. Borrar *CMakeCache.txt*:

    del CMakeCache.txt
    rmdir /q /s CMakeFiles

3\. Ejecutar cmake:

    cmake -G "MinGW Makefiles" -DCMAKE_C_COMPILER=gcc -DCMAKE_C_FLAGS="-m32 -O2 -g" -DCMAKE_CXX_FLAGS="-m32 -O2 -g" -DCMAKE_EXE_LINKER_FLAGS="-Wl,-mi386pe" -DCMAKE_INSTALL_PREFIX=c:\dev\pcre32

4\. Después, ejecutar:

    mingw32-make install

[comment]: # ({/04b79926-04b79926})

[comment]: # ({4cf1725c-7183ba81})
#### Construyendo librerías OpenSSL usando MinGW

1. Si aún no lo tiene instalado, instale *[Cygwin](https://www.cygwin.com)* y *Perl para Cygwin* y configúrelos según las instrucciones de la [documentación de Perl](https ://perldoc.perl.org/perlcygwin) oficial.

2. Ejecute:

````bash
perl Configure mingw64 no-shared no-ui-console no-tests no-capieng --libdir=lib --api=1.1.0 --prefix=c:\dev\openssl32 --openssldir=c:\dev\openssl32

make build_sw

make install_dev
````

[comment]: # ({/4cf1725c-7183ba81})

[comment]: # ({f4af7b47-f4af7b47})
#### Compilando Zabbix agent 2

[comment]: # ({/f4af7b47-f4af7b47})

[comment]: # ({5f096f18-5f096f18})
##### 32 bit

Abra el ambiente MinGW environment (desde la línea de comandos de Windows) y navegue 
al directorio *build/mingw* dentro del árbol del código fuente de Zabbix.

Ejecute:

    mingw32-make clean
    mingw32-make ARCH=x86 PCRE=c:\dev\pcre32 OPENSSL=c:\dev\openssl32

[comment]: # ({/5f096f18-5f096f18})

[comment]: # ({f7876f1d-f7876f1d})
##### 64 bit
Abra el ambiente MinGW environment (desde la línea de comandos de Windows) y 
navegue al directorio *build/mingw* dentro del árbol del código fuente de Zabbix.


Ejecute:

    mingw32-make clean
    mingw32-make PCRE=c:\dev\pcre OPENSSL=c:\dev\openssl

::: noteclassic
Tanto las versiones de 32- como la de 64- bit pueden ser compiladas en 
una plataforma de 64-bit, pero la versión de 32-bit sólo puede ser 
compilada en una plataforma de 32-bit.
Si trabaja en una plataforma de 32-bit, siga los mismos pasos que la versión 
de 64-bit en una plataforma de 64-bit.
:::

[comment]: # ({/f7876f1d-f7876f1d})
