How to handle nginx compilation problems on windows platforms

Source: Internet
Author: User
Tags openssl library install perl
: This article mainly introduces how to solve nginx compilation problems on the windows platform. For more information about PHP tutorials, see. This article describes how to compile nginx in windows. refer to this article Building nginx on the Win32 platform with Visual C. It has already been described in detail, but there are always many details in the actual operation process, record it here.

Contents [hide]

  • 1. FAQs
    • 1.1 obtain the specified version
    • 1.2 "stdint. h": No such file or directory
    • 1.3 "openssl/ssl. h": No such file or directory
    • 1.4 unable to open file "objs/lib/openssl-1.0.1e/lib/ssleay32.lib"
    • 1.5 error C2220: Warning is considered as an error-no "object" file is generated
    • 1.6 fatal error C1010: unexpected end of the file when searching for the pre-compiled header. Have you forgotten to add "# include" ngx_config.h "to the source ""?
    • 1.7 complete compilation during each compilation
  • 2. operation process Summary

FAQs

My VS version is VS2008 and the following problems occur.

Obtain the specified version

Sometimes we don't need the latest version. for example, if I want to download the 1.20 version of nginx, first of all, I want to find the 1.20 version number. soon I found it f582d662cc408eb7a132c21f4b298b71d0701abb, you can get the specified version in the following execution order:

Hg clone http://hg.nginx.org/nginxcd nginxhg co f582d662cc408eb7a132c21f4b298b71d0701abb

"Stdint. h": No such file or directory

This problem is easy to solve. just download the missing header file. Https://code.google.com/p/msinttypes/
Decompress the package file directory C: \ Program Files \ Microsoft Visual Studio 9.0 \ VC \ include (or a similar directory ).

"Openssl/ssl. h": No such file or directory

This problem may occur when running nmake-f objs/Makefile. We see this path (objs/lib/openssl-1.0.1e/openssl/include), actually there is no. The way is to change openssl-1.0.1e/openssl to a openssl-1.0.1e.

Vi nginx/objs/Makefile

Or directly modify the configuration for generating Makefile.

Vi auto/lib/openssl/confvi auto/lib/openssl/make

Unable to open file "objs/lib/openssl-1.0.1e/lib/ssleay32.lib"

I don't know why the nginx project does not generate an openssl library. I will compile openssl to solve this problem. The procedure is as follows:

  • Install perl (I use ActivePerl)
  • Decompress openssl to drive C, cd C: \ openssl-1.0.1e
  • Execute the perl Configure VC-WIN32
  • Run cmd and pull * "C: \ Program Files \ Microsoft Visual Studio 9.0 \ VC \ vcvarsall. BAT" * to cmd to run it.
  • Execute ms \ do_ms in cmd.
  • Run nmake-f ms \ ntdll. mak in cmd.

Okay, put the manually generated libeay32.lib and ssleay32.lib to the nginx/objs/lib/openssl-1.0.1e directory. Solve the problem.

Error C2220: Warning is regarded as an error-no "object" file is generated

Remove the-WX field of CFLAGS, generate Makefile again, and re-compile

Vi auto/cc/msvc # CFLAGS = "$ CFLAGS-WX"

Fatal error C1010: unexpected end of the file when searching for the pre-compiled header. Have you forgotten to add "# include" ngx_config.h "to the source ""?

In windows module development, the first line of code for each source file must be added with # include "ngx_config.h" *. if you do not want to do so, compile the parameter *-Yungx_config.h to remove it.

Fully compiled at each compilation.

When executing this line of code, nmake-f objs/Makefile should be fully compiled every time, which is a waste of time. The reason is that the file objs/Makefile contains the following line:

Objs/lib/openssl-1.0.1e/include/openssl/ssl. h: objs/Makefile

The ssh. h file depends on objs/Makefile *, but if the modification time of the former is always earlier than that of the latter, the subsequent commands will always be executed. Remove the * objs/Makefile string.

Operation process Summary

  • "C: \ Program Files \ Microsoft Visual Studio 9.0 \ VC \ vcvarsall. bat"
  • "C: \ MinGW \ msys \ 1.0 \ msys. bat"
  • Cd/c/nginx
  • Generate makefile
Auto/configure -- with-cc = cl -- builddir = objs -- prefix = \ -- conf-path = conf/nginx. conf -- pid-path = logs/nginx. pid \ -- http-log-path = logs/access. log -- error-log-path = logs/error. log \ --sbin-pathpolicnginx.exe -- http-client-body-temp-path = temp/client_body_temp \ -- http-proxy-temp-path = temp/proxy_temp \ -- http-fastcgi-temp-path = temp/fastcgi_temp \ -- with-cc-opt =-DFD_SETSIZE = 1024 -- with-pcre = objs/lib/pcre-8.32 \ -- with-zlib = objs/lib/zlib-1.2.7 -- with-openssl = objs/lib/openssl-1.0.1e \ -- with-select_module -- with-http_ssl_module -- with-ipv6 \ -- add-module = objs/lib/naxsi-core-0.48/naxsi_src
  • Nmake-f objs/Makefile
  • Start nginx
Start nginx.exe-p "C: \ nginx" nginx.exe-p "C: \ nginx"-s reloadnginx.exe-p "C: \ nginx"-s quit

References:
OpenSSL installation and configuration in Windows

This article is edited by Wu Yao. For more information, see the source.
Article: http://www.wuyao721.com/nginx-building-windows.html

The above describes how to solve nginx compilation problems on the windows platform, including some content. I hope my friends who are interested in PHP tutorials can help me.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.