编译 FFmpeg h263 decoder出现编译错误undefined reference to `ff_find_pix_fmt'

摘要:
FFmpeg源代码使用RockPlayer提供的代码和编译脚本,点击这里下载。

FFmpeg 源代码使用 RockPlayer 提供的代码和编译脚本,点击这里下载。

configure 仅保留 h263 相关的 parser demuxer decoder 以及libswscale

--enable-decoder=h263 \
--enable-parser=h263 \
--enable-demuxer=h263 \

编译出现如下错误

libavformat/libavformat.a(utils.o): In function `av_find_stream_info':/home/pekall/Projects_private/FFmpegPlayer/lib/shaobin0604-rockplayer_ffmpeg_git_20100418-h263/libavformat/utils.c:2437: undefined reference to `ff_find_pix_fmt'

解决方法,需要加入 rawvideo decoder

--enable-decoder=rawvideo \

完整的编译脚本如下

#!/bin/bash
######################################################
# FFmpeg builds script for Android+ARM platform
#
# This script is released under term of
# CDDL (http://www.opensource.org/licenses/cddl1) # Wrote by pinxue (~@gmail.com) from RockPlayer.com
# 2010-8 ~ 2011-4
######################################################
######################################################
# Usage:
# put this script in top of FFmpeg source tree
# ./build_android
#
# It generates binary for following architectures:
# ARMv5TE (all android platform can use this version)
# ARMv6
# ARMv6+VFP
# ARMv7+VFPv3-d16 (Tegra2)
# ARMv7+Neon (Cortex-A8)
#
#
# Customizing:
# 1. Feel free to change ./configure parameters for more features
# 2. To adapt other ARM variants
# set $CPU and $OPTIMIZE_CFLAGS
# call build_one
######################################################
#NDK=~/android/android-ndk-r4
#PLATFORM=$NDK/build/platforms/android-8/arch-arm/
#PREBUILT=$NDK/build/prebuilt/darwin-x86/arm-eabi-4.4.0
NDK=~/opt/android-ndk-r6
PLATFORM=$NDK/platforms/android-8/arch-arm/
PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86
function build_one
{
# -fasm : required. Android header file uses asm keyword instead of __asm__ , but most of c dialect (like ansi,c99,gnu99) implies -fno-asm.
# ~/android/android-ndk-r4/build/platforms/android-5/arch-arm//usr/include/asm/byteorder.h: In function '___arch__swab32':# ~/android/android-ndk-r4/build/platforms/android-5/arch-arm//usr/include/asm/byteorder.h:25: error: expected ')' before ':' token
# -fno-short-enums : optimized. Else FFmpeg obj will generate a huge number of warning for variable-size enums,
# though we may suppress them by --no-enum-size-warning, it would be better to avoid it.
# .../ld: warning: cmdutils.o uses variable-size enums yet the output is to use 32-bit enums; use of enum values across objects may fail
# --extra-libs="-lgcc" : required. Else cannot solve some runtime function symbols
# ... undefined reference to `__aeabi_f2uiz'

# --enable-protocols : required. Without this option, the file open always fails mysteriously.
# FFmpeg's av_open_input_file will invoke file format probing functions, but because most of useful demuxers has flag of zero # which cause them are ignored during file format probling and fall to url stream parsing,
# if protocols are disabled, the file://url cannot be opened as well.
# $PREBUILT/bin/arm-eabi-ar d libavcodec/libavcodec.a inverse.o : required.
# FFmpeg includes two copies of inverse.c both in libavutil and libavcodec for performance consideration (not sure the benifit yet)
# Without this step, final ld of generating libffmpeg.so will fail silently, if invoke ld through gcc, gcc will collect more reasonable error message.
# -llog: debug only, FFmpeg itself doesn't require it at all.# With this option, we may simply includes "utils/Log.h" and use LOGx() to observe FFmpeg's behavior# PS, it seems the toolchain implies -DNDEBUG somewhere, it would be safer to use following syntax
# #ifdef NDEBUG
# #undef NDEBUG
# #define HAVE_NDEBUG
# #endif
# #include "utils/Log.h"
# #ifdef HAVE_NDEBUG
# #define NDEBUG
# #undef HAVE_NDEBUG
# #endif
# --whole-archive : required. Else ld generate a small .so file (about 15k)
# --no-stdlib : required. Android doesn't use standard c runtime but invited its own wheal (bionic libc) because of license consideration.
# space before \ of configure lines: required for some options. Else next line will be merged into previous lines's content and cause problem.# Especially the --extra-cflags, the next line will pass to gcc in this case and configure will say gcc cannot create executable.
# many options mentioned by articles over internet are implied by -O2 or -O3 already, need not repeat at all.
# two or three common optimization cflags are omitted because not sure about the trade off yet. invoke NDK build system with V=1 to find them.
# -Wl,-T,$PREBUILT/arm-eabi/lib/ldscripts/armelf.x mentioned by almost every articles over internet, but it is not required to specify at all.
# -Dipv6mr_interface=ipv6mr_ifindex : required. Android inet header doesn't use ipv6mr_interface which is required by rfc, seems it generate this user space header file directly from kernel header file, but Linux kernel has decided to keep its own name for ever and ask user space header to use rfc name.
# HAVE_SYS_UIO_H : required. Else:
# In file included from ~/android/android-ndk-r4/build/platforms/android-5/arch-arm//usr/include/linux/socket.h:29,# from ~/android/android-ndk-r4/build/platforms/android-5/arch-arm//usr/include/sys/socket.h:33,# from libavformat/network.h:35,
# from libavformat/utils.c:46:
#~/android/android-ndk-r4/build/platforms/android-5/arch-arm//usr/include/linux/uio.h:19: error: redefinition of 'struct iovec'#
# --disable-doc : required because of strange bug of toolchain.
./configure --target-os=linux \
--prefix=$PREFIX \
--enable-cross-compile \
--extra-libs="-lgcc" \
--arch=arm \
--cc=$PREBUILT/bin/arm-linux-androideabi-gcc \
--cross-prefix=$PREBUILT/bin/arm-linux-androideabi- \
--nm=$PREBUILT/bin/arm-linux-androideabi-nm \
--sysroot=$PLATFORM \
--extra-cflags="-O3 -fpic -DANDROID -DHAVE_SYS_UIO_H=1 -Dipv6mr_interface=ipv6mr_ifindex -fasm -Wno-psabi -fno-short-enums -fno-strict-aliasing -finline-limit=300 $OPTIMIZE_CFLAGS " \
--disable-shared \
--enable-static \
--extra-ldflags="-Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -nostdlib -lc -lm -ldl -llog" \
--disable-everything \
--disable-encoders \
--disable-muxers \
--enable-decoder=rawvideo \
--enable-decoder=h263 \
--enable-parser=h263 \
--enable-demuxer=h263 \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-ffserver \
--disable-network \
--disable-indevs \
--disable-bsfs \
--disable-filters \
--disable-protocols \
--disable-avfilter \
--disable-avdevice \
--disable-doc \
--enable-zlib \
--enable-asm \
$ADDITIONAL_CONFIGURE_FLAG
make clean
make -j4 install
$PREBUILT/bin/arm-linux-androideabi-ar d libavcodec/libavcodec.a inverse.o
$PREBUILT/bin/arm-linux-androideabi-ld -rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -soname libffmpeg.so -shared -nostdlib -z,noexecstack -Bsymbolic --whole-archive --no-undefined -o $PREFIX/libffmpeg.so libavcodec/libavcodec.a libavformat/libavformat.a libavutil/libavutil.a libswscale/libswscale.a -lc -lm -lz -ldl -llog --warn-once --dynamic-linker=/system/bin/linker $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/libgcc.a
}
#arm v5te
CPU=armv5te
OPTIMIZE_CFLAGS="-marm -march=$CPU"
PREFIX=./android/$CPU
ADDITIONAL_CONFIGURE_FLAG=
build_one
#arm v6
#CPU=armv6
#OPTIMIZE_CFLAGS="-marm -march=$CPU"
#PREFIX=./android/$CPU
#ADDITIONAL_CONFIGURE_FLAG=
#build_one
#arm v7vfpv3
#CPU=armv7-a
#OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=vfpv3-d16 -marm -march=$CPU "
#PREFIX=./android/$CPU
#ADDITIONAL_CONFIGURE_FLAG=
#build_one
#arm v7vfp
#CPU=armv7-a
#OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=vfp -marm -march=$CPU "
#PREFIX=./android/$CPU-vfp
#ADDITIONAL_CONFIGURE_FLAG=
#build_one
#arm v7n
#CPU=armv7-a
#OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=neon -marm -march=$CPU -mtune=cortex-a8"
#PREFIX=./android/$CPU
#ADDITIONAL_CONFIGURE_FLAG=--enable-neon
#build_one
#arm v6+vfp
#CPU=armv6
#OPTIMIZE_CFLAGS="-DCMP_HAVE_VFP -mfloat-abi=softfp -mfpu=vfp -marm -march=$CPU"
#PREFIX=./android/${CPU}_vfp
#ADDITIONAL_CONFIGURE_FLAG=
#build_one

编译完成之后生成大约3.3M的libffmpeg.so

参考

免责声明:文章转载自《编译 FFmpeg h263 decoder出现编译错误undefined reference to `ff_find_pix_fmt'》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇idea git 配置代理C# 计时器的三种使用方法下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

Linux如何进行GPIO读写操作的?

摘要:本文介绍GPIO的读写,介绍基本原理,以及不同读写方式的性能。 本文分享自华为云社区《Linux 基于sysfs的GPIO读写操作》,作者:一颗小树x 。 前言 最近接触到Linux系统中的GPIO开发,这里做个小总结,也分享一下;本文会介绍GPIO的读写,介绍基本原理,以及不同读写方式的性能。 一、GPIO sysfs interface 基本原...

zabbix准备:php安装

一.安装php依赖库 ftp://xmlsoft.org/libxml2/libxml2-2.9.3.tar.gz yum install python-devel -y cd /download/ wget -c ftp://xmlsoft.org/libxml2/libxml2-2.9.3.tar.gz tar xf libxml2-2.9.3...

使用Linux最常见的十大问题

目前来说三大pc操作系统占领着全球的所有市场,而作为免费操作系统,Linux可以是一款替代Windows、OSX平台的流行系统之一。但是还是有不少人都认为自己从未接触过Linux,其实通常用使用的 “Android”智能手机系统就是由Linux提供技术支持,由于Linux代码通用性好,几乎能满足任何用户的需求。详细可以学习Linux视频教程。 如果用户想...

Linux下解压缩文件命令总结

---------------------------------------------tar命令: -v 可视化-c 新建包-f 指定文件名(除非你用默认用户名)-x 解压target.tar-r 增加file文件到target.tar-t 列出target.tar中的文件-u 更新target.tar中的file文件-z 调用gzip-j 调用bzi...

【学习总结】快速上手Linux玩转典型应用-第5章-远程连接SSH专题

课程目录链接 快速上手Linux玩转典型应用-目录 目录 1. 认识SSH 2. 服务器安装SSH服务 3. 客户端安装SSH工具 4. 客户端链接SSH服务 5. SSH config 6. SSH免密登录 ============================================================== =====...

linux下的软件包安装

linux下安装软件包有两种方法:源文件编译安装(source)和rpm 安装。 1.源文件包安装的通用方法。 一般安装源代码的程序你得要看它的README,一般在它的目录下都有的。 01.配置: 构建应用的第一步就是执行configure脚本,该脚本位于程式源文件的主目录下: [root@localhost~]#./configure 该脚本将扫描系统,...