使用ffmeg插件

时间:2018-05-11 18:37:05

标签: build ffmpeg openscenegraph fpic

我尝试使用FFMPEG插件构建OpenSceneGraph(OSG)。使用:

  • CentOS 7.2 64位
  • GCC 4.8.5
  • OSG 3.4.0
  • FFMPEG 2.8

对于FFMPEG,我./configure没有选项,makemake install。在OSG中,我cmake .make。我明白了:

Linking CXX shared module ../../../lib/osgPlugins-3.4.0/osgdb_ffmpeg.so
/usr/bin/ld: /usr/local/lib/libavformat.a(allformats.o): relocation R_X86_64_32 against symbol `ff_a64_muxer' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libavformat.a(amr.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
...(and a ton of others like this)

所以我回到FFMPEG和./configure --enable-pic。来自--help:

  --enable-pic             build position-independent code

make cleanmakemake install

然后我去OSG和make并且变得更少,但仍然得到一个:

Linking CXX shared module ../../../lib/osgPlugins-3.4.0/osgdb_ffmpeg.so
/usr/bin/ld: /usr/local/lib/libavcodec.a(vc1dsp_mmx.o): relocation R_X86_64_PC32 against symbol `ff_pw_9' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status

我做了一些关于如何判断一个对象是用PIC构建并找到的研究:

terminal-> readelf --relocs ./libavcodec/x86/vc1dsp_mmx.o | egrep '(GOT|PLT|JU?MP_SLOT)'

000000000ea6  007300000004 R_X86_64_PLT32    0000000000000000 ff_avg_pixels16_mmx - 4
000000000eb6  007400000004 R_X86_64_PLT32    0000000000000000 ff_avg_pixels8_mmx - 4
000000000ec6  007500000004 R_X86_64_PLT32    0000000000000000 ff_put_pixels16_mmx - 4
000000000ed6  007600000004 R_X86_64_PLT32    0000000000000000 ff_put_pixels8_mmx - 4

当我在没有--enable-pic的情况下构建时,上一个命令不返回任何内容。

对于libavcodec.a,我在其上nm寻找此符号ff_pw_9,并找到了这些引用:

constants.o:
...
00000000000002d0 R ff_pw_9
...

vc1dsp_mmx.o:
...
                 U ff_pw_9
...

vp8dsp_loopfilter.o:
...
                 U ff_pw_9
...

我在这里缺少什么?

0 个答案:

没有答案