使用Xcode断点调试ffmpeg
2018-02-04 12:04
295 查看
最近想在xcode断点调试ffmpeg,以深入学习ffmpeg源码。一开始参考了https://www.jianshu.com/p/226c19aa6e42。但发现只能断点调试,点击源码方法无法实现自动跳转,跟踪起来十分不便。于是决定暴力的创建xcode工程,添加ffmpeg所有源码来实现真正的即可加断点调试又可以跟踪跳转代码的xcode工程。主要思路是先configure生成config.h,依靠config.h实现在xcode里的配置。configure如下:
./configure --enable-debug --disable-doc --enable-ffplay --enable-sdl --disable-audiotoolbox \
--disable-cuda --disable-cuvid --disable-d3d11va --disable-dxva2 \
--disable-libmfx --disable-libnpp --disable-mmal --disable-nvenc \
--disable-omx --disable-omx-rpi --disable-vaapi --disable-vda \
--disable-vdpau --disable-videotoolbox --disable-asm \
这里为方便调试,configure选项没有加入汇编优化和硬件加速,只configure获取config.h就好,make交给xcode实现。
然后把ffmpe所有源码添加进去。然后根据配置删除不需要加入编译的代码,如汇编和硬件加速的代码。技巧是make一下看那些文件生成了.o中间文件,没生成.o的都不需要加入xcode里编译。整个过程遇到很多编译错误,只能根据错误提示一点点修改:此处略去10000字(添加移除c文件,添加头文件,添加链接库,还要修改部分文件....)。花了一天多的时间总算完成,ffmpeg 和ffplay都可执行。已上传github,需要的自提:https://github.com/badousuan/ffmpeg-xcode.git,ffmpeg
版本是最新的3.4.1.
唉,真是作死,非要整这玩意。附上一些编译过程中能记得起来的error,做个备忘,万一还有下次呢
./configure --enable-debug --disable-doc --enable-ffplay --enable-sdl --disable-audiotoolbox \
--disable-cuda --disable-cuvid --disable-d3d11va --disable-dxva2 \
--disable-libmfx --disable-libnpp --disable-mmal --disable-nvenc \
--disable-omx --disable-omx-rpi --disable-vaapi --disable-vda \
--disable-vdpau --disable-videotoolbox --disable-asm \
cp config.h libavfilter/
cp config.h fftools/
cp config.h libswresample/
cp config.h libswscale/
cp config.h libavformat/
cp config.h libavutil/
cp config.h libavcodec/
cp config.h libavdevice/
config文件,不进行汇编优化和硬件加速,将config.h拷贝到个子库
make ffmpeg 看那些文件又生成.o文件,生成.o的才是要加入编译
Type 'struct Point' has incompatible definitions in different translation units:typedef struct Point{...} Point--->typedef struct{...} Point
"ff_ctz", referenced from:位于libavutil/intmath.c,在其他库里pch #include "../libavutil/intmath.h"
NULL_IF_CONFIG_SMALL 在其他库里pch #include "../libavutil/internal.h"
undeclared identifier 'ff_log2_tab' 找不到--->在相应文件添加extern const uint8_t ff_log2_tab[256];
bz2... icv...找不到"_BZ2_bzDecompressInit", referenced from:
_matroska_decode_buffer in libavformat.a(matroskadec.o)
"_iconv", referenced from:libbz2和libiconv的链接库:添加libbz2.dylib,libiconv.dylib两个文件
"_avpriv_aac_parse_header", referenced from: libavcodec.o等,查看avpriv_aac_parse_header函数在哪个文件定义,再看这个文件是否被编译
A referenced from:B问题都看B在那个文件F引用了A,F未被加入编译则加入编译,已加入编译则A为系统库,未被-l
'SDL.h' file not found、 "_SDL_CreateTexture", referenced from: _sdl2_write_header in libavdevice.a(sdl2.o):加入SDL2链接库,并设置头文件和lib的路径
ARC forbids Objective-C objects in struct:build setting Object-c auto reference counting设为no
Initializer element is not a compile-time constant???忘了
../libavutil/libm.h:62: error: static declaration of 'lrint' follows non-static declaration
../libavutil/libm.h:69: error: static declaration of 'lrintf' follows non-static declaration
../libavutil/libm.h:76: error: static declaration of 'round' follows non-static declaration
../libavutil/libm.h:83: error: static declaration of 'roundf' follows non-static declaration----->没拷贝config.h
int attribute_align_arg avcodec_open Expected ; after top level declarator, error in xcode:需要pch #include "../libavutil/internal.h"
./configure --enable-debug --disable-doc --enable-ffplay --enable-sdl --disable-audiotoolbox \
--disable-cuda --disable-cuvid --disable-d3d11va --disable-dxva2 \
--disable-libmfx --disable-libnpp --disable-mmal --disable-nvenc \
--disable-omx --disable-omx-rpi --disable-vaapi --disable-vda \
--disable-vdpau --disable-videotoolbox --disable-asm \
这里为方便调试,configure选项没有加入汇编优化和硬件加速,只configure获取config.h就好,make交给xcode实现。
然后把ffmpe所有源码添加进去。然后根据配置删除不需要加入编译的代码,如汇编和硬件加速的代码。技巧是make一下看那些文件生成了.o中间文件,没生成.o的都不需要加入xcode里编译。整个过程遇到很多编译错误,只能根据错误提示一点点修改:此处略去10000字(添加移除c文件,添加头文件,添加链接库,还要修改部分文件....)。花了一天多的时间总算完成,ffmpeg 和ffplay都可执行。已上传github,需要的自提:https://github.com/badousuan/ffmpeg-xcode.git,ffmpeg
版本是最新的3.4.1.
唉,真是作死,非要整这玩意。附上一些编译过程中能记得起来的error,做个备忘,万一还有下次呢
./configure --enable-debug --disable-doc --enable-ffplay --enable-sdl --disable-audiotoolbox \
--disable-cuda --disable-cuvid --disable-d3d11va --disable-dxva2 \
--disable-libmfx --disable-libnpp --disable-mmal --disable-nvenc \
--disable-omx --disable-omx-rpi --disable-vaapi --disable-vda \
--disable-vdpau --disable-videotoolbox --disable-asm \
cp config.h libavfilter/
cp config.h fftools/
cp config.h libswresample/
cp config.h libswscale/
cp config.h libavformat/
cp config.h libavutil/
cp config.h libavcodec/
cp config.h libavdevice/
config文件,不进行汇编优化和硬件加速,将config.h拷贝到个子库
make ffmpeg 看那些文件又生成.o文件,生成.o的才是要加入编译
Type 'struct Point' has incompatible definitions in different translation units:typedef struct Point{...} Point--->typedef struct{...} Point
"ff_ctz", referenced from:位于libavutil/intmath.c,在其他库里pch #include "../libavutil/intmath.h"
NULL_IF_CONFIG_SMALL 在其他库里pch #include "../libavutil/internal.h"
undeclared identifier 'ff_log2_tab' 找不到--->在相应文件添加extern const uint8_t ff_log2_tab[256];
bz2... icv...找不到"_BZ2_bzDecompressInit", referenced from:
_matroska_decode_buffer in libavformat.a(matroskadec.o)
"_iconv", referenced from:libbz2和libiconv的链接库:添加libbz2.dylib,libiconv.dylib两个文件
"_avpriv_aac_parse_header", referenced from: libavcodec.o等,查看avpriv_aac_parse_header函数在哪个文件定义,再看这个文件是否被编译
A referenced from:B问题都看B在那个文件F引用了A,F未被加入编译则加入编译,已加入编译则A为系统库,未被-l
'SDL.h' file not found、 "_SDL_CreateTexture", referenced from: _sdl2_write_header in libavdevice.a(sdl2.o):加入SDL2链接库,并设置头文件和lib的路径
ARC forbids Objective-C objects in struct:build setting Object-c auto reference counting设为no
Initializer element is not a compile-time constant???忘了
../libavutil/libm.h:62: error: static declaration of 'lrint' follows non-static declaration
../libavutil/libm.h:69: error: static declaration of 'lrintf' follows non-static declaration
../libavutil/libm.h:76: error: static declaration of 'round' follows non-static declaration
../libavutil/libm.h:83: error: static declaration of 'roundf' follows non-static declaration----->没拷贝config.h
int attribute_align_arg avcodec_open Expected ; after top level declarator, error in xcode:需要pch #include "../libavutil/internal.h"
相关文章推荐
- Xcode中使用数据(硬件)断点调试
- Xcode使用断点调试
- Xcode中使用数据(硬件)断点调试
- 在使用CocoaPod的Xcode工程中断点没有调试信息的问题跟进
- 使用xcode调试代码的时候进入断点显示变量全是nil,我用NSLog输出那个变量却是有值的,这个是什么原因呢
- ios 使用xcode调试代码的时候进入断点显示变量全是nil,但NSLog输出那个变量却是有值的
- 使用xcode调试代码的时候进入断点显示变量全是nil,我用NSLog输出那个变量却是有值的,这个是什么原因呢?
- Xcode中使用数据(硬件)断点调试
- xcode 调试断点
- 使用Xcode和Instruments调试解决iOS内存泄露
- Xcode 调试技巧 --常用命令和断点
- 使用XCode联机调试你的iOS应用
- Xcode 断点使用
- Xcode调试断点不停止解决方案!
- 使用Xcode和Instruments调试解决iOS内存泄露
- C++中使用断点写调试方法
- 使用Xcode进行iOS设备无线调试
- Xcode 使用PhoneGap情况下调试真机
- 使用Xcode进行iOS设备无线调试
- 使用 PHPStorm + Xdebug 实现断点调试(二)