Сбой при попытке скомпилировать nginx в Windows - PullRequest
1 голос
/ 23 октября 2019

При компиляции с использованием nmake я получаю ошибки.

Сначала я попробовал использовать msys в соответствии с превосходным руководством Верна: https://stackoverflow.com/a/22649559/5092846 Затем я попытался использовать msys2 для выполнения тех же шагов. с теми же результатами

Это мои параметры конфигурации (zlib, pcre, openssl и nginx-rtmp-module присутствуют в правильных каталогах):

auto/configure \
    --with-cc=cl \
    --with-debug \
    --prefix= \
    --conf-path=conf/nginx.conf \
    --pid-path=logs/nginx.pid \
    --http-log-path=logs/access.log \
    --error-log-path=logs/error.log \
    --sbin-path=nginx.exe \
    --http-client-body-temp-path=temp/client_body_temp \
    --http-proxy-temp-path=temp/proxy_temp \
    --http-fastcgi-temp-path=temp/fastcgi_temp \
    --http-scgi-temp-path=temp/scgi_temp \
    --http-uwsgi-temp-path=temp/uwsgi_temp \
    --with-cc-opt=-DFD_SETSIZE=1024 \
    --with-pcre=objs/lib/pcre-8.43 \
    --with-zlib=objs/lib/zlib-1.2.11 \
    --with-openssl=objs/lib/openssl-1.1.1c \
    --with-openssl-opt=no-asm \
    --with-http_ssl_module \
    --add-module=nginx-rtmp-module

Результат запуска nmake-f Makefile:

$ nmake -f Makefile

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

        "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\Hostx86\x86\nmake.exe" -f objs/Makefile

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

        "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\Hostx86\x86\nmake.exe" -f auto/lib/openssl/makefile.msvc                                 OPENSSL="objs/lib/openssl-1.1.1c" OPENSSL_OPT="no-asm"

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

        cd objs/lib/openssl-1.1.1c
        perl Configure VC-WIN32 no-shared                                --prefix="%cd%/openssl"                              --openssldir="%cd%/openssl/ssl"                          no-asm
Configuring OpenSSL version 1.1.1c (0x1010103fL) for VC-WIN32
Using os-specific seed configuration
Creating configdata.pm
Creating makefile

**********************************************************************
***                                                                ***
***   OpenSSL has been successfully configured                     ***
***                                                                ***
***   If you encounter a problem while building, please open an    ***
***   issue on GitHub <https://github.com/openssl/openssl/issues>  ***
***   and include the output from the following command:           ***
***                                                                ***
***       perl configdata.pm --dump                                ***
***                                                                ***
***   (If you are new to OpenSSL, you might want to consult the    ***
***   'Troubleshooting' section in the INSTALL file first)         ***
***                                                                ***
**********************************************************************
        if exist ms\do_ms.bat (                                          ms\do_ms                                             && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\Hostx86\x86\nmake.exe" -f ms\nt.mak                                    && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\Hostx86\x86\nmake.exe" -f ms\nt.mak install                           ) else (                                     "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\Hostx86\x86\nmake.exe"           && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\Hostx86\x86\nmake.exe" install_sw                                      )

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

        "C:\perl32\Strawberry\perl\bin\perl.exe" "-I." -Mconfigdata "util\dofile.pl"  "-omakefile" "crypto\include\internal\bn_conf.h.in" > crypto\include\internal\bn_conf.h
        "C:\perl32\Strawberry\perl\bin\perl.exe" "-I." -Mconfigdata "util\dofile.pl"  "-omakefile" "crypto\include\internal\dso_conf.h.in" > crypto\include\internal\dso_conf.h
        "C:\perl32\Strawberry\perl\bin\perl.exe" "-I." -Mconfigdata "util\dofile.pl"  "-omakefile" "include\openssl\opensslconf.h.in" > include\openssl\opensslconf.h
        "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\Hostx86\x86\nmake.exe" /                   depend && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\Hostx86\x86\nmake.exe" /                   _all

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


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

        "C:\perl32\Strawberry\perl\bin\perl.exe" "util\mkbuildinf.pl" "cl /Zi /Fdossl_static.pdb /MT /Zl /Gs0 /GF /Gy /W3 /wd4090 /nologo /O2 /WX -D"L_ENDIAN" -D"OPENSSL_PIC"" "VC-WIN32" > crypto\buildinf.h
        cl  /Zi /Fdossl_static.pdb /MT /Zl /Gs0 /GF /Gy /W3 /wd4090 /nologo /O2 /WX /I "." /I "crypto\include" /I "include" /I "crypto" -D"L_ENDIAN" -D"OPENSSL_PIC" -D"OPENSSLDIR=\"C:\\MinGW\\msys2\\nginx\\objs\\lib\\openssl-1.1.1c\\openssl\\ssl\"" -D"ENGINESDIR=\"C:\\MinGW\\msys2\\nginx\\objs\\lib\\openssl-1.1.1c\\openssl\\lib\\engines-1_1\"" -D"OPENSSL_SYS_WIN32" -D"WIN32_LEAN_AND_MEAN" -D"UNICODE" -D"_UNICODE" -D"_CRT_SECURE_NO_DEPRECATE" -D"_WINSOCK_DEPRECATED_NO_WARNINGS" -D"NDEBUG"  -c /Focrypto\cversion.obj "crypto\cversion.c"
cversion.c
C:\MinGW\msys2\nginx\objs\lib\openssl-1.1.1c\include\internal/cryptlib.h(13): fatal error C1083: Cannot open include file: 'stdlib.h': No such file or directory
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\Hostx86\x86\cl.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\Hostx86\x86\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'if' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\Hostx86\x86\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\Hostx86\x86\nmake.exe"' : return code '0x2'
Stop.

Если я правильно понимаю, ошибка происходит во время компиляции openssl - в файле stdlib.h (или его отсутствии).

1 Ответ

0 голосов
/ 23 октября 2019

Проблема была решена, сначала запустив приглашение «Командная строка разработчика для VS 2019», а затем запустив msys из него.

...