尝试在Windows上编译nginx时失败

尝试在Windows上编译nginx时失败,windows,nginx,compilation,openssl,mingw,Windows,Nginx,Compilation,Openssl,Mingw,使用nmake编译时,我收到错误 首先,根据Vern的优秀教程,我首先尝试使用msys: 然后,我尝试使用msys2执行相同的步骤,得到相同的结果 以下是我的配置参数(zlib、pcre、openssl和nginx rtmp模块位于正确的目录中): 运行nmake-f Makefile的结果是: $ nmake -f Makefile Microsoft (R) Program Maintenance Utility Version 14.23.28105.4 Copyright (C) Mi

使用nmake编译时,我收到错误

首先,根据Vern的优秀教程,我首先尝试使用msys: 然后,我尝试使用msys2执行相同的步骤,得到相同的结果

以下是我的配置参数(zlib、pcre、openssl和nginx rtmp模块位于正确的目录中):

运行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.
$nmake-f Makefile
Microsoft(R)程序维护实用程序版本14.23.28105.4
版权所有(C)微软公司。版权所有。
“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)程序维护实用程序版本14.23.28105.4
版权所有(C)微软公司。版权所有。
“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\u OPT=“无asm”
Microsoft(R)程序维护实用程序版本14.23.28105.4
版权所有(C)微软公司。版权所有。
cd objs/lib/openssl-1.1.1c
perl配置VC-WIN32无共享--prefix=“%cd%/openssl”--openssldir=“%cd%/openssl/ssl”无asm
为VC-WIN32配置OpenSSL版本1.1.1c(0x1010103fL)
使用特定于操作系统的种子配置
创建configdata.pm
创建makefile
**********************************************************************
***                                                                ***
***已成功配置OpenSSL***
***                                                                ***
***如果在构建时遇到问题,请打开***
***关于GitHub的问题***
***并包含以下命令的输出:***
***                                                                ***
***perl configdata.pm—转储***
***                                                                ***
***(如果您是OpenSSL新手,可能需要咨询***
***安装文件中的“疑难解答”部分(首先)***
***                                                                ***
**********************************************************************
如果存在ms\do\u ms.bat(ms\do\u 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安装)其他(“C:\Program Files(x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\Hostx86\nmake.exe”和“C:\Program Files(x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\Hostx86\x86\nmake.exe“安装软件”
Microsoft(R)程序维护实用程序版本14.23.28105.4
版权所有(C)微软公司。版权所有。
“C:\perl32\草莓\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\草莓\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\草莓\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”/Dependent&“C:\Program Files(x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\Hostx86\x86\nmake.exe”/
Microsoft(R)程序维护实用程序版本14.23.28105.4
版权所有(C)微软公司。版权所有。
Microsoft(R)程序维护实用程序版本14.23.28105.4
版权所有(C)微软公司。版权所有。
“C:\perl32\草莓\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”>加密\buildinf.h
cl/Zi/Fdossl\u static.pdb/MT/Zl/Gs0/GF/Gy/W3/wd4090/nologo/O2/WX/I.“/I”crypto\include“/I”include“/I”crypto“-D”L\u ENDIAN“-D”OPENSSL\u PIC“-D”OPENSSLDIR=\'C:\\MinGW\\msys2\\nginx\\objs lib OPENSSL\\1.1.1c\\OPENSSL\\D”ENGINESDIR=\\C:\\MinGW\\msys2\\nbjs“OPENSSL\u SYS\u WIN32“-D”WIN32\u LEAN\u意思是“-D”UNICODE“-D”UNICODE“-D”CRT\u SECURE\u NO\u DEPRECATE“-D”WINSOCK\u DEPRECATED\u NO\u WARNINGS“-D”NDEBUG“-c/Focrypto\cversion.obj”crypto\cversion.c”
c版
C:\MinGW\msys2\nginx\objs\lib\openssl-1.1.1c\include\internal/cryptlib.h(13):致命错误C1083:无法打开包含文件:“stdlib.h”:没有此类文件或目录
NMAKE:致命错误U1077:““C:\Program Files(x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\Hostx86\x86\cl.EXE”:返回代码“0x2”
停止
NMAKE:致命错误U1077:““C:\Program Files(x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\Hostx86\x86\NMAKE.exe”:返回代码“0x2”
停止
NMAKE:致命错误U1077:“如果”:返回代码“0x2”
停止
NMAKE:致命错误U1077:““C:\Program Files(x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\Hostx86\x86\NMAKE.exe”:返回代码“0x”
$ 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.