ffmpeg升级4.3.1版本,套用2.4.2版本静态库编译环境,编译不过问题
之前的静态库编译脚本,直接将需要编译的文件全部放入编译列表编译即可,最新的ffmpeg下载下来以后,为了省事,直接套用老的方式,各种编不过,本人编译ffmpeg静态库只用到了libavutil libavformat libavcodec,其它几个未涉及~
下面说一下遇到的问题及解决方式:
1.许多地方提示函数在声明之前被调用的问题,统一加宏处理,config.h文件加入如下宏:
#define HAVE_COPYSIGN 1
#define HAVE_ERF 1
#define HAVE_ISFINITE 1
#define HAVE_HYPOT 1
#define HAVE_AVX512 0
#define CONFIG_OSSFUZZ 1
2.编译提示缺少各种*_list.c文件,编译出错,例如打印:
bsf.c: In function 'av_bsf_list_parse_str':
bsf.c:541:5: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
while (bsf_str = av_strtok(buf, ",", &saveptr)) {
^
bitstream_filters.c: In function 'av_bsf_iterate':
bitstream_filters.c:69:34: error: 'bitstream_filters' undeclared (first use in this function)
const AVBitStreamFilter *f = bitstream_filters[i];
^
bitstream_filters.c:69:34: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [bitstream_filters.o] 错误 1
这个查了好久的相关资料,没有运行configure脚本,导致没有生成这些list.c文件,相关说明去这里,传送阵:https://my.oschina.net/u/2326611/blog/798200
3.有些比较老的编译器,不支持if条件判断中定义变量,如下:
if(int i = 0; …),编译直接报错,这个没啥好说的,手动一个一个的改吧,把定义放到“int i = 0”放到外面就好了;
4.说一下*_list.c文件生成方式,linux下进入ffmpeg目录下,看一下有没有configure文件,有的话再进行命令操作;
[@localhost ffmpeg]$ ls
Changelog CONTRIBUTING.md COPYING.LGPLv2.1 doc INSTALL.md libavfilter libavutil libswscale Makefile RELEASE VERSION
compat COPYING.GPLv2 COPYING.LGPLv3 ffbuild libavcodec libavformat libpostproc LICENSE.md presets tests
configure COPYING.GPLv3 CREDITS fftools libavdevice libavresample libswresample MAINTAINERS README.md tools
[@localhost ffmpeg]$ ./configure
tput: unknown terminal "xterm"
tput: unknown terminal "xterm"
nasm/yasm not found or too old. Use --disable-x86asm for a crippled build.
If you think configure made a mistake, make sure you are using the latest
version from Git. If the latest version fails, report the problem to the
ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "ffbuild/config.log" produced by configure as this will help
solve the problem.
[@localhost ffmpeg]$ ./configure --disable-x86asm
tput: unknown terminal "xterm"
tput: unknown terminal "xterm"
install prefix /usr/local
source path .
C compiler gcc
C library glibc
ARCH x86 (generic)
big-endian no
runtime cpu detection yes
standalone assembly no
x86 assembler nasm
MMX enabled yes
MMXEXT enabled yes
configure内容太多,没怎么研究,直接执行了,需要等好几分钟来执行这个脚本,打印太多,就不全部贴出来了,成功后就会在所有lib*目录下生成编译缺失的各种list.c文件了