[英]Compile FFMPEG + x264 - undefined references
I have been trying to find a solution online for a couple of days with no luck. 几天来我一直在网上寻找解决方案,但是没有运气。 I am using Ubuntu and trying to compile the latest FFMPEG stable version (1.0.1) with x264 support.
我正在使用Ubuntu,并尝试编译具有x264支持的最新FFMPEG稳定版本(1.0.1)。 I made sure I uninstalled any existing x264 then I downloaded the latest x264 source and compiled it with the following config:
我确保卸载了任何现有的x264,然后下载了最新的x264源,并使用以下配置对其进行了编译:
./configure --prefix=$PREFIX \
--enable-shared \
--enable-static \
--disable-gpac \
--extra-cflags=" -I$ARM_INC -fPIC -DANDROID -fpic -mthumb-interwork -ffunction-sections -funwind-tables -fno-short-enums -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -Wno-psabi -march=armv5te -msoft-float -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -DANDROID -Wa,--noexecstack -MMD -MP " \
--extra-ldflags=" -nostdlib -Bdynamic -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,nocopyreloc -Wl,-soname,/usr/lib/libz.so -Wl,-rpath-link=$ARM_LIB,-dynamic-linker=/system/bin/linker -L$ARM_LIB -lc -lm -ldl -lgcc" \
--cross-prefix=${ARM_PRE}- \
--disable-asm \
--host=arm-linux \
make clean
make install
All goes well, and I checked the installed version: 一切顺利,我检查了已安装的版本:
x264 -V
x264 0.129.x
built on Dec 27 2012, gcc: 4.6.1
configuration: --bit-depth=8 --chroma-format=all
x264 license: GPL version 2 or later
I then try to compile FFMPEG with the following options: 然后,我尝试使用以下选项编译FFMPEG:
./configure --target-os=linux \
--enable-libx264 \
--enable-gpl \
--prefix=$PREFIX \
--extra-cflags="-I/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/android/armv7-a/include -I/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/x264 -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 " \
--extra-ldflags="-Wl,-rpath-link=$PLATFORM/usr/lib -L/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/android/armv7-a/lib -L$PLATFORM/usr/lib -nostdlib -lc -lm -ldl -llog" \
--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 \
The configure and make clean/make install work well, but when I try to create the .so file the following command fails: configure和make clean / make install效果很好,但是当我尝试创建.so文件时,以下命令失败:
/home/tishu/Apps/android-ndk-r8d/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-ld
-rpath-link=./android/armv7-a/usr/lib -L/home/tishu/Apps/android-ndk-r8d/platforms/android-14/arch-arm/usr/lib -soname libffmpeg.so -shared -nostdlib -z,noexecstack -Bsymbolic \
--whole-archive --no-undefined -o ./android/armv7-a/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 /home/tishu/Apps/android-ndk-r8d/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.4.3/libgcc.a
This fails with the following output: 这将失败,并显示以下输出:
libavcodec/libavcodec.a(libx264.o): In function `X264_frame':
/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:159: undefined reference to `x264_picture_init'
/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:179: undefined reference to `x264_encoder_reconfig'
/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:190: undefined reference to `x264_encoder_encode'
/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:196: undefined reference to `x264_encoder_delayed_frames'
libavcodec/libavcodec.a(libx264.o): In function `encode_nals':
/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:101: undefined reference to `x264_bit_depth'
libavcodec/libavcodec.a(libx264.o): In function `X264_close':
/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:231: undefined reference to `x264_encoder_close'
libavcodec/libavcodec.a(libx264.o): In function `X264_init':
/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:284: undefined reference to `x264_param_default'
/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:292: undefined reference to `x264_param_default_preset'
/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:314: undefined reference to `x264_param_parse'
/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:459: undefined reference to `x264_param_apply_fastfirstpass'
/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:490: undefined reference to `x264_param_apply_profile'
/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:533: undefined reference to `x264_encoder_open_129'
/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:544: undefined reference to `x264_encoder_headers'
The x264 version it is looking for (129) is the one installed and compiled succesfully with --eanable-shared. 它正在寻找的x264版本(129)是使用--eanable-shared成功安装并编译的版本。 Obviously all compiles fine when I do not include libx64.
当我不包括libx64时,显然所有编译都可以。
Question: How can I specify the include path for the last command? 问题:如何为最后一个命令指定包含路径? I tried adding the path to $PATH and also adding this as an argument with no luck: -I/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/x264
我尝试将路径添加到$ PATH中,并且也将此添加为没有运气的参数:-I / home / tishu / Workspaces / ffmpeg / ffmpeg / jni / x264
Thanks 谢谢
For followers (not even android but similar message), 对于关注者(甚至不是android,而是类似的消息),
/.../mingw-w64-i686/lib/gcc/.../i686-w64-mingw32/bin/ld:
libavcodec/libavcodec.a(libx264.o):libx264.c:(.text+0x3c):
undefined reference to `x264_bit_depth'
: undefined reference to `x264_encoder_open_152'
appears this constant was "dropped" early 2017 see https://trac.ffmpeg.org/ticket/6966 and https://trac.ffmpeg.org/ticket/6932 似乎该常量在2017年初被“删除”,请参见https://trac.ffmpeg.org/ticket/6966和https://trac.ffmpeg.org/ticket/6932
fix: update ffmpeg, or downdate libx264...or something... 修复:更新ffmpeg或将libx264更新日期...
though these days it's supposed to kind of support older version of libx264 as well... 尽管这些天应该也支持旧版本的libx264 ...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.