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调试会导致带参数调试失败

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

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