Opened 7 years ago
Closed 7 years ago
#1396 closed defect (fixed)
Compiling for win32 fails with VS2017
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | documentation | Version: | 1.13.x |
Keywords: | Cc: | ||
uname -a: | |||
nginx -V: |
nginx version: nginx/1.13.7
built by cl 19.11.25547 for x86 built with OpenSSL 1.0.2k 26 Jan 2017 TLS SNI support enabled configure arguments: --with-cc=cl --builddir=objs --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.41 --with-zlib=objs/lib/zlib-1.2.11 --with-select_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_stub_status_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-http_slice_module --with-mail --with-stream --with-openssl=objs/lib/openssl-1.0.2k --with-openssl-opt=no-asm --with-http_ssl_module --with-mail_ssl_module --with-stream_ssl_module --with-stream_ssl_preread_module |
Description
Build fails with
Assembling: tmp32\sha1-586.asm tmp32\sha1-586.asm(1432) : error A2070:invalid instruction operands tmp32\sha1-586.asm(1576) : error A2070:invalid instruction operands NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\bin\HostX86\x86\ml.EXE"' : return code '0x1' Stop.
Workaround is to add no-asm
option to openSSL configure.
i.e. edit line 9 of makefile.msvc
to read perl Configure VC-WIN32 no-shared no-asm \
This workaround does not work with OpenSSL 1.0.2l.
Solution is change your build instructions to require nasm. OpenSSL only supports NASM, see INSTALL.W32
. THen update makefile.msvc
to the following:
# Copyright (C) Igor Sysoev # Copyright (C) Nginx, Inc. all: cd $(OPENSSL) perl Configure VC-WIN32 no-shared \ --prefix="%cd%/openssl" \ --openssldir="%cd%/openssl/ssl" \ $(OPENSSL_OPT) if exist ms\do_nasm.bat ( \ ms\do_nasm \ && $(MAKE) -f ms\nt.mak \ && $(MAKE) -f ms\nt.mak install \ ) else ( \ $(MAKE) \ && $(MAKE) install_sw \ )
And update your build instructions to require installation of NASM
. OpenSSL then builds fine and this allows you to build nginx with 1.0.2k and 1.0.2l. Can also build without --with-openssl-opt=no-asm
Change History (4)
comment:2 by , 7 years ago
Component: | other → documentation |
---|
This workaround does not work with OpenSSL 1.0.2l.
We use no-asm
since OpenSSL started to use assembler by default in ms\do_ms.bat
and then broke MASM support in 1.0.2, see 5def760fe95e. It works fine for official builds, including builds with OpenSSL 1.0.2l since 9b26edd391ab. If it doesn't work for you, consider re-trying the build with clean sources (notably clean OpenSSL sources).
Adding no-asm
to the Building nginx on the Win32 platform with Visual C page probably make sense, so changing this ticket to documentation
component.
comment:4 by , 7 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Improvements to the Building nginx on the Win32 platform with Visual C page committed, thanks.
Apparently your build script is wrong for openSSL.
https://github.com/openssl/openssl/blob/f6f9a735cc691a57c01c0c99aacce86fd9138a05/INSTALL.W32#L44-L60
Correct usage is
perl Configure VC-WIN32 no-shared no-asm
if usingdo_ms.bat