Gcc Ffmpeg编译失败,因为体系结构x86\u 64的未定义符号\u x264\u编码器\u打开\u 112

Gcc Ffmpeg编译失败,因为体系结构x86\u 64的未定义符号\u x264\u编码器\u打开\u 112,gcc,ffmpeg,ld,undefined-symbol,Gcc,Ffmpeg,Ld,Undefined Symbol,我正在从源代码处编译关于雪豹的ffmpeg。使用Macport不是一个选项,因为我在ffmpeg中有一些自定义修改。make命令包括: $ ./configure --enable-gpl --enable-libmp3lame --enable-static \ --disable-shared --enable-libx264 --enable-pthreads \ --disable-doc --enable-avfilter $ make

我正在从源代码处编译关于雪豹的ffmpeg。使用Macport不是一个选项,因为我在ffmpeg中有一些自定义修改。make命令包括:

$ ./configure --enable-gpl --enable-libmp3lame --enable-static \
            --disable-shared --enable-libx264 --enable-pthreads \
            --disable-doc --enable-avfilter
$ make
错误:

CC  ffplay.o
ffplay.c: In function ‘SDL_main’:
ffplay.c:3157: warning: assignment discards qualifiers from pointer target type
LD  ffplay_g
Undefined symbols for architecture x86_64:
  "_x264_encoder_open_112", referenced from:
      _X264_init in libavcodec.a(libx264.o)
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [ffplay_g] Error 1

我已经从源代码处编译了libx264,运行良好

$ cd x264-snapshot-20101228-2245; ./configure && make && sudo make install
。。。它包含符号“\ux264\uEncoder\uOpen\u112”


可能出了什么问题?

尝试使用--enable static配置x264


我遇到了一个类似的问题,这对我来说是一个解决方案。

来自
/opt/local/lib
/usr/lib
的类似名称的lib之间存在冲突。前者由Macport维护,后者是我自己的开发区。由于我想使用后一个位置,我必须删除/临时重命名
/opt/local/lib
中的位置,以强制gcc从
/usr/lib
中提取它们

在您的情况下,路径可能会有所不同,但您了解其中的含义


如果您有一个更干净的方法来实现这一点,我将全神贯注地为Mac OSX上的自制用户添加以下问题:

我在
/usr/lib
中还有额外的libx264 lib,我必须删除它们

这导致使用
brew安装ffmpeg-使用clang
brew安装ffmpeg-使用gcc构建ffmpeg时出现此错误:

LD  libavcodec/libavcodec.53.dylib
AR  libavcodec/libavcodec.a
Undefined symbols for architecture x86_64:
  "_x264_bit_depth", referenced from:
      _X264_init_static in libx264.o
      _X264_frame in libx264.o
  "_x264_picture_init", referenced from:
      _X264_frame in libx264.o
  "_x264_param_default_preset", referenced from:
      _X264_init in libx264.o
  "_x264_param_apply_fastfirstpass", referenced from:
      _X264_init in libx264.o
  "_x264_param_apply_profile", referenced from:
      _X264_init in libx264.o
  "_x264_encoder_open_120", referenced from:
      _X264_init in libx264.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [libavcodec/libavcodec.53.dylib] Error 1
额外的文件是:

/usr/lib/libx264.79.dylib
/usr/lib/libx264.a
/usr/lib/libx264.dylib
但是,这些版本可能会有所不同。删除后,生成成功


将此答案留在这里是因为试图找到与
libavcodec
的连接时非常混乱。失败。

Hi@weekens,我担心这不起作用,因为x264的配置不接受--enable static
$。/configure--enable static Unknown选项--enable static,被忽略
@saptashi,这很奇怪,它以前对我有用。尝试从Github获取我的分支,只是为了检查它是否有效<代码>git克隆git://github.com/weekens/x264-devel.git
你是对的-来自
git://git.videolan.org/x264.git
确实支持--enable static选项。我一直在使用一个旧的快照,这是混乱的根源。但是,使用--enable static并不能解决我的问题。这是预期的,因为我已经有一个静态。一个库。你解决过这个问题吗?我遇到了完全相同的问题…@Bearded我没有确切的答案,但我必须继续重建图书馆。我猜是macport发生了冲突。因此,您可能希望临时删除这些lib,以强制gcc从
/usr
而不是
/opt
中选择x264.a。随时通知我们!我也遇到了同样的问题,我只是从我的路径中删除了/opt/local/lib,而我这样做了。/configure,解决了这个问题。建筑完成后,我把它放回我的道路上。
/usr/lib/libx264.79.dylib
/usr/lib/libx264.a
/usr/lib/libx264.dylib