CentOS Compile ffmpeg libx264 not found

CentOS Compile ffmpeg libx264 not found

首先 CentOS make install x264时,只将x264可执行文件install到/usr/local/bin,还需要make install-lib-static

此时./configure --disable-yasm --enable-libx264 --enable-gpl --enable-static --enable-shared还是出现

ERROR: libx264 not found

查看config.log发现:

/ Usr/local/lib/libx264.a (opencl.o): In function `x264_opencl_load_library ':
opencl.c: (. text +0 x411): undefined reference to `dlopen '
opencl.c: (. text +0 x42b): undefined reference to `dlsym '
opencl.c: (. text +0 x448): undefined reference to `dlsym '
opencl.c: (. text +0 x465): undefined reference to `dlsym '
opencl.c: (. text +0 x482): undefined reference to `dlsym '
opencl.c: (. text +0 x49f): undefined reference to `dlsym '

### 此时增加--extra-ldflags=-ldl 支持动态链接装入器libdl(它有4个库函数 dlopen, dlerror, dlsym, dlclose)

./configure --disable-yasm --enable-libx264 --enable-gpl --enable-static --enable-shared --extra-ldflags=-ldl
configure成功。
 
  

使用库时注意顺序(在Mac上没有出现这种引用顺序问题),

LIBS += /usr/local/lib/libavformat.a
LIBS += /usr/local/lib/libavdevice.a
LIBS += /usr/local/lib/libavcodec.a
LIBS += /usr/local/lib/libavutil.a
LIBS += /usr/local/lib/libx264.a


否则会出现错误:

/usr/local/lib/libavformat.a(allformats.o): In function `av_register_all':
allformats.c:(.text+0x1b): undefined reference to `avcodec_register_all'

ac3dec.c:(.text+0x112): undefined reference to `ff_ac3_parse_header'
/usr/local/lib/libavformat.a(adtsenc.o): In function `ff_adts_decode_extradata':
adtsenc.c:(.text+0x68): undefined reference to `ff_mpeg4audio_get_config'
adtsenc.c:(.text+0x175): undefined reference to `ff_copy_pce_data'
/usr/local/lib/libavformat.a(aiffdec.o): In function `aiff_read_header':
aiffdec.c:(.text+0x5de): undefined reference to `av_get_bits_per_sample'

/usr/local/lib/libavformat.a(utils.o): In function `ff_add_index_entry.clone.2':
utils.c:(.text+0x48d8): undefined reference to `av_fast_realloc'
/usr/local/lib/libavformat.a(utils.o): In function `av_new_stream':
utils.c:(.text+0x4c37): undefined reference to `avcodec_alloc_context'
/usr/local/lib/libavformat.a(utils.o): In function `ff_interleave_add_packet.clone.3':
utils.c:(.text+0x553e): undefined reference to `av_dup_packet'

你可能感兴趣的:(CentOS Compile ffmpeg libx264 not found)