Compiling Nginx on Windows 7

Im experiencing issues with compiling Nginx on Windows 7, every thing
goes
good until nmake -f objs/Makefile.
I get the following error:

Generating Code…
link -lib -out:pcre.lib -verbose:lib pcre_*.obj
/usr/bin/link: invalid option – l
Try `/usr/bin/link --help’ for more information.
NMAKE : fatal error U1077: ‘C:\MinGW\msys\1.0\bin\link.EXE’ : return
code
‘0x1’
Stop.
NMAKE : fatal error U1077: ‘“c:\Program Files (x86)\Microsoft Visual
Studio
10.0
\VC\BIN\nmake.exe”’ : return code ‘0x2’
Stop.

Posted at Nginx Forum:

To fix the error open a MSYS Bash and run the following command:
mv /usr/bin/link.exe /usr/bin/link_.exe

Posted at Nginx Forum:

Im experiencing issues with compiling Nginx on Windows 7, every thing
goes
good until nmake -f objs/Makefile.
I get the following error

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\Microsoft Visual Studio
10.0\VC\BI
N\ml.EXE”’ : return code ‘0x1’
Stop.
NMAKE : fatal error U1077: ‘“C:\Program Files\Microsoft Visual Studio
10.0\VC\BI
N\nmake.exe”’ : return code ‘0x2’
Stop.
NMAKE : fatal error U1077: ‘“C:\Program Files\Microsoft Visual Studio
10.0\VC\BI
N\nmake.exe”’ : return code ‘0x2’
Stop.

Posted at Nginx Forum:

That’s an OpenSSL asm compile error, you need nasm http://nasm.us
installed and in your PATH, masm which is included in visual studio is
not supported by OpenSSL.

Kurt C.
https://www.x64architecture.com

Hello!

On Mon, Jun 01, 2015 at 10:45:04AM +0300, Andrei B. wrote:

NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio
Stop.

Are you trying to do the build on 64-bit Windows 7?

The attached patch may help (it was tested on Windows Server
2008 R2 Datacenter SP1 64-bit in the past).

This patch won’t help, the error in question is a result of
OpenSSL incorrect assembler handling in OpenSSL 1.0.2*. In
OpenSSL 1.* times OpenSSL folks did the following things:

  • about 1.0.0 they changed default compilation procedure (the one
    used by nginx on Windows), previously documented to be a way to
    compile without asm at all, to use MASM; at the same time, they
    declared that they will only support NASM.

  • in 1.0.2 they broke both building with MASM (see errors
    above) and building without asm at all (as per new compilation
    procedure, introduced in 1.0.0).

Some comments about this can be found here (RT link seems to be
dead for now):

https://rt.openssl.org/Ticket/Display.html?id=3650&user=guest&pass=guest

Trivial workaround is to use latest OpenSSL from the 1.0.1 branch
(1.0.1m as of now), it compiles fine either way.


Maxim D.
http://nginx.org/

On 30 May 2015, at 23:00, z_kamikimo [email protected] wrote:

Stop.
NMAKE : fatal error U1077: ‘“C:\Program Files\Microsoft Visual Studio
10.0\VC\BI
N\nmake.exe”’ : return code ‘0x2’
Stop.
NMAKE : fatal error U1077: ‘“C:\Program Files\Microsoft Visual Studio
10.0\VC\BI
N\nmake.exe”’ : return code ‘0x2’
Stop.

Are you trying to do the build on 64-bit Windows 7?

The attached patch may help (it was tested on Windows Server
2008 R2 Datacenter SP1 64-bit in the past).