6
回答
win7 vc2010 编译nginx
科大讯飞通用文字识别100000次/天免费使用。立即申请   

Windows编译nginx

 

所需工具,Mingw(用来生成makefile配置)+vc2010

 

SVN检出源码而非从网站下载的nginx-xx.tar(编译报缺少文件)

 

svn://svn.nginx.org/nginx/trunk

 

svn中多了src\os\win32目录,tar中只有unix

 

 

auto\configure  文件复制到上一层(顶层)

 

设置INCLUDE变量

 

c:\Program Files\Microsoft SDKs\Windows\v7.0A\include

c:\Program Files\Microsoft Visual Studio 10.0\VC\include

 

msys.bat(mingw)执行

 

./configure --prefix=. --sbin-path=nginx --with-cc-opt="-D FD_SETSIZE=4096" --without-http_rewrite_module --without-http_gzip_module --with-cc=cl

 

 

checking for OS

 + MINGW32_NT-6.1 1.0.17(0.48/3/2) i686

 + using Microsoft Visual C++ compiler

checking for MINGW32_NT-6.1 specific features

creating objs/Makefile

 

Configuration summary

 + PCRE library is not used

 + OpenSSL library is not used

 + md5 library is not used

 + sha1 library is not used

 + zlib library is not used

 

 nginx path prefix: "."

 nginx binary file: "./nginx"

 nginx configuration prefix: "./conf"

 nginx configuration file: "./conf/nginx.conf"

 nginx pid file: "./logs/nginx.pid"

 nginx error log file: "./logs/error.log"

 nginx http access log file: "./logs/access.log"

 nginx http client request body temporary files: "client_body_temp"

 nginx http proxy temporary files: "proxy_temp"

 nginx http fastcgi temporary files: "fastcgi_temp"

 nginx http uwsgi temporary files: "uwsgi_temp"

 nginx http scgi temporary files: "scgi_temp"


 

CMD运行

C:\Program Files\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat

cd nginx

 

docs\man 文件夹也复制到顶层,否则后面的namke 报错找不到文件

 

sed -e "s|%PREFIX%|.|"

-e "s|%PID_PATH%|./logs/nginx.pid|"

-e "s|%CONF_PATH%|./conf/nginx.conf|"

-e "s|%ERROR_LOG_PATH%|./logs/error.log|"

< man/nginx.8 > objs/nginx.8

 

系统找不到指定的路径。

NMAKE : fatal error U1077: sed: 返回代码“0x1

Stop.

NMAKE : fatal error U1077: "C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\nmake.exe": 返回代码“0x2

Stop.

 

 

 

如果机器上有VC6VC2010 等,可能会报版本不匹配

 

fatal error C1902: 程序数据库管理器不匹配;请检查安装

 

VC对应版本的

mspdbsrv.exe, mspdbcore.dll, and mspdb80(或vc2010mspdb100.dll 直接复制到windows 目录

 

 

 

nginx.c 删除255,否则编译语法错误

/*

    ngx_log_stderr(0, "configure arguments:" NGX_CONFIGURE);

*/

 

 

 

nmake

 

Microsoft (R) 程序维护实用工具 10.00.30319.01

版权所有(C) Microsoft Corporation。保留所有权利。

 

       "C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\nmake.exe" -f objs/Makefile

 

       cl  xxxxxxxxxxxxx

 

       rc -foobjs/nginx.res -I src/core -I src/event  -I src/event/modules  -I src/os/win32  -I objs src/os/win32/nginx.rc

 

 

cl     -Feobjs/nginx

       objs/xxxx.obj ....

       kernel32.lib user32.lib advapi32.lib ws2_32.lib

       objs/nginx.res -link -verbose:lib -debug

 

 

Microsoft (R) Incremental Linker Version 10.00.40219.01

Copyright (C) Microsoft Corporation.  All rights reserved.

 

/out:objs/nginx.exe

-verbose:lib

-debug

objs/xxx.obj  ...

kernel32.lib

user32.lib

advapi32.lib

ws2_32.lib

objs/nginx.res

 

正在搜索库

   正在搜索 C:\Program Files\Microsoft SDKs\Windows\v7.0A\lib\kernel32.lib:

   正在搜索 C:\Program Files\Microsoft SDKs\Windows\v7.0A\lib\user32.lib:

   正在搜索 C:\Program Files\Microsoft SDKs\Windows\v7.0A\lib\advapi32.lib:

   正在搜索 C:\Program Files\Microsoft SDKs\Windows\v7.0A\lib\ws2_32.lib:

   正在搜索 C:\Program Files\Microsoft Visual Studio 10.0\VC\LIB\LIBCMT.lib:

   正在搜索 C:\Program Files\Microsoft Visual Studio 10.0\VC\LIB\OLDNAMES.lib:

   正在搜索 C:\Program Files\Microsoft SDKs\Windows\v7.0A\lib\kernel32.lib:

   正在搜索 C:\Program Files\Microsoft SDKs\Windows\v7.0A\lib\user32.lib:

   正在搜索 C:\Program Files\Microsoft SDKs\Windows\v7.0A\lib\advapi32.lib:

   正在搜索 C:\Program Files\Microsoft SDKs\Windows\v7.0A\lib\ws2_32.lib:

 

已完成库搜索

 

       "C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\nmake.exe" -f objs/Makefile manpage

 

       sed -e "s|%PREFIX%|.|" -e "s|%PID_PATH%|./logs/nginx.pid|"  -e "s|%CONF_PATH%|./conf/nginx.conf|" -e "s|%ERROR_LOG_PATH%|./logs/error.log|"  < man/nginx.8 > objs/nginx.8

举报
ddatsh
发帖于7年前 6回/5K+阅
顶部