[英]Failing while trying to compile nginx on Windows
When compiling using nmake, I am receiving errors.使用 nmake 编译时,我收到错误消息。
At first, I have first tried using msys according to Vern's excellent tutorial: https://stackoverflow.com/a/22649559/5092846 I then tried using msys2 to perform the same steps with the same results首先,我根据 Vern 的优秀教程尝试使用 msys: https://stackoverflow.com/a/22649559/5092846然后我尝试使用 msys2 执行相同的步骤,结果相同
These are my configuration parameters(zlib,pcre,openssl, and nginx-rtmp-module are present in the correct directories):这些是我的配置参数(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
The result of running nmake -f Makefile is:运行 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.
If I understand this correctly, the failure is during the compilation of openssl - in the stdlib.h file(or lack thereof).如果我理解正确,则失败是在 openssl 的编译过程中 - 在 stdlib.h 文件中(或缺少该文件)。
The issue was resolved by first launching the "Developer Command Prompt for VS 2019" prompt and then running msys from inside of it.通过首先启动“VS 2019 的开发人员命令提示符”提示符,然后从其中运行 msys 解决了该问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.