DoubleLi

qq: 517712484 wx: ldbgliet

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
  4737 随笔 :: 2 文章 :: 542 评论 :: 1615万 阅读
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

阅读官方编译windows版本的方法 http://nginx.org/en/docs/howto_build_on_win32.html

我的环境 Windows 7 Ultimate 64,Visual Studio 2013

nginx_rtmp_modue 在nginx 1.7是无法编译(linux就不行),所以获取1.6的版本进行编译:

hg clone http://hg.nginx.org/nginx nginx-1.6 -u release-1.6.1 (必须在命令行下运行)

 

其他几个下载资源

pre http://ncu.dl.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.zip

zlib  http://cznic.dl.sourceforge.net/project/libpng/zlib/1.2.8/zlib-1.2.8.tar.gz

openssl http://www.openssl.org/source/openssl-1.0.1e.tar.gz

nginx_rtmp_modue https://github.com/arut/nginx-rtmp-module

 

问题与解决

1,添加nginx_rtmp_module编译选项

 

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-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 \
--with-cc-opt=-DFD_SETSIZE=1024 --with-pcre=objs/lib/pcre-8.35 \
--with-zlib=objs/lib/zlib-1.2.8 --with-openssl=objs/lib/openssl-1.0.1e \
--with-select_module --with-http_ssl_module --with-ipv6 \
--add-module=../nginx-module/nginx-rtmp-module

 

2, auto/configure 命令需要在MSYS命令行下执行;

 

3, nmake -f objs/Makefile需要在vs 命令行执行,在c:\Program Files (x86)\Common7\Tools\Shortcuts 可以看到:

如果你需要编译64位的则选择x64的命令行工具;

 

3,当执行nmake -f objs/Makefile 时报错

 

从输出日志看,是编译openssl造成的,从错误信息看到: error C2220 “警告被视为错误”,这里只看到了warning C4996一个警告,所以问题必然出在这了,

那就给openssl加上编译选项忽略掉这个警告:--with-openssl-opt=-wd4996;

将configure命令改成:

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-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 \
--with-cc-opt=-DFD_SETSIZE=1024 --with-pcre=objs/lib/pcre-8.35 \
--with-zlib=objs/lib/zlib-1.2.8 --with-openssl=objs/lib/openssl-1.0.1e \
--with-select_module --with-http_ssl_module --with-ipv6 \
--with-openssl-opt=-wd4996 \
--add-module=../nginx-module/nginx-rtmp-module

修改后运行;

 

(以下方法更简单高效)

也可以直接修改nginx目录下的的objs/Makefile文件,找到这一行:

$(MAKE) -f auto/lib/openssl/makefile.msvcOPENSSL="../lib/openssl-0.9.8r"

然后修改为:

$(MAKE) -f auto/lib/openssl/makefile.msvcOPENSSL="../lib/openssl-0.9.8r" OPENSSL_OPT="-wd4996"

修改完后执行nmake -f objs/Makefile, done!

posted on   DoubleLi  阅读(419)  评论(0编辑  收藏  举报
编辑推荐:
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
历史上的今天:
2014-05-14 MFC的消息反射机制
2014-05-14 MFC常见问题解惑
2014-05-14 关于ListCtrol自绘的技巧
2014-05-14 QueryPerformanceFrequency 和 QueryPerformanceCounter用法
点击右上角即可分享
微信分享提示