nginx+rtmp+ffmpeg,windows下編譯gdb調試

回饋具有開源精神以及樂於分享知識的各位同道中人

 

nginx:1.15.7(http://nginx.org/en/download.html)

note:單獨下載的源碼包裏包含makefile,但是還需要下載最新的源碼,因爲官方download給的鏈接下載的文件裏面會缺少很多源碼。vs編譯的時候會提示無法生成相應.o文件。所以要下載最新源碼覆蓋進去。

###########################################################################################################

nginx-rtmp-moudle:1.1.4(https://github.com/arut/nginx-rtmp-module)

pcre:pcre-8.42(http://www.pcre.org/)

zlib:zlib-1.2.11(http://www.zlib.net/)

openssl:openssl-1.0.2p(http://www.openssl.org/)

步驟:

在nginx文件目錄中新建objs,然後在其內再新建lib文件夾,把上面4個源碼包放進去。

然後用mingw32,或msys2的mingw32,cd到nginx目錄進行配置生成文件會放置到objs目錄下。

###########################################################################################################

./configure \
--with-cc=cl \
--with-debug \
--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 \
--http-scgi-temp-path=temp/scgi_temp \
--http-uwsgi-temp-path=temp/uwsgi_temp \
--with-cc-opt=-DFD_SETSIZE=1024 \
--with-pcre=objs/lib/pcre-8.42 \
--with-zlib=objs/lib/zlib-1.2.11 \
--with-openssl=objs/lib/openssl-1.0.2p \
--with-openssl-opt=no-asm \
--with-select_module \
--with-http_ssl_module \
--add-module=objs/lib/nginx-rtmp-module
###########################################################################################################

打開vs2015的命令行窗口,用x64和x86兼容的,開始編譯

nmake -f objs/Makefile

編譯後在objs下生成的exe目錄下增加tmp,temp,conf,logs,html文件夾,並把nginx下的conf中的配置文件拷到objs下的conf中,配置好後就可以啓動nginx.exe了。

 

編譯ffmpeg

工具:下載mingw-64,或則msys2

msys2:

###########################################################################################################

pacman -S mingw-w64-i686-gcc
pacman -S mingw-w64-x86_64-gcc
pacman -S make 
pacman -S diffutils 
pacman -S yasm 
pacman -S autoconf automake libtool

pacman -S mingw32/mingw-w64-i686-gcc
pacman -S mingw64/mingw-w64-x86_64-gcc

pacman -S mingw32/mingw-w64-i686-gdb
pacman -S mingw64/mingw-w64-x86_64-gdb

pacman -S mingw32/mingw-w64-i686-make
pacman -S mingw64/mingw-w64-x86_64-make

###########################################################################################################
--help 打印此消息
--quiet 抑制顯示信息輸出
--list-decoders 顯示所有可用的解碼器
--list-encoders 顯示所有可用的編碼器
--list-hwaccels 顯示所有可用的硬件加速器
--list-demuxers 顯示所有可用的解複用器
--list-muxers 顯示所有可用的複用器
--list-parsers 顯示所有可用的解析器
--list-protocols 顯示所有可用的協議
--list-bsfs 顯示所有可用的比特流過濾器
--list-indevs 顯示所有可用的輸入設備
--list-outdevs 顯示所有可用的輸出設備
--list-filters 顯示所有可用的過濾器 

###########################################################################################################

x264(https://www.videolan.org/developers/x264.html
./configure --host=mingw32-i686 --enable-shared --disable-asm
msys2編譯h264
./configure --host=x86_64-w64-mingw32 --enable-shared --disable-asm
mingw_64編譯h264

make

make install

編譯好的x264庫會在msys2的usr/local/目錄下。
###########################################################################################################

###########################################################################################################

./configure \
--enable-shared \
--enable-debug \
--enable-gpl \
--enable-version3 \
--enable-nonfree \
--enable-libx264 \
--enable-postproc \
--disable-optimizations \
--disable-asm \
--disable-stripping \
--extra-cflags=-g \
--extra-cflags=-I/usr/local/include \
--extra-ldflags=-L/usr/local/lib
//ffmpeg 沒有裁剪過濾器

###########################################################################################################

make

make install後生成的頭文件、庫和lib會在msys2的usr/local/目錄下。

note:ffmpeg如果要使用dshow功能,需要用msys2的mingw64位編譯,32位編譯貌似這個功能無法使用。

如果使用的mingw-64來編譯,會出現最後也無法使用dshow,相對來說msys2更完備以及依賴的文件更全面,所以能正常編譯可使用的64位ffmpeg庫。

如果mingw工具安裝後編譯ffmpeg總會報錯。

###########################################################################################################

gdb:從msys2的mingw64進去cd到ffmpeg_g.exe的目錄

gdb ffmpeg_g

set args xxxx參數

note:如果參數含中文,在shell中需要把text的編碼改爲中文,gbk就能正確識別中文

b main

r

l

n

q

調試結束

note:不能通過windows10的powershell進入gdb調試會導致帶參數調試失敗

###########################################################################################################

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章