windows下編譯nginx+nginx_rtmp_modue(vs2013)

來源:互聯網
上載者:User

標籤:http   efi   nginx   pid   解決   south   報錯   rtc   with   

閱讀官方編譯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!

windows下編譯nginx+nginx_rtmp_modue(vs2013)

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.