Linux ffmpeg 安装在 CentOS 64 位“使用 -fPIC 安装”错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9506046/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ffmpeg install on CentOS 64-bit 'install with -fPIC' error
提问by ndmweb
I get this error when attempting to compile ffmpeg on a 64bit CentOS machine.
尝试在 64 位 CentOS 机器上编译 ffmpeg 时出现此错误。
Here are my ./configure options:
这是我的 ./configure 选项:
./configure --enable-shared --enable-gpl --enable-nonfree --enable-postproc --enable-swscale --enable-pthreads --enable-libx264 --enable-libxvid --enable-libvorbis --enable-libfaac --enable-libmp3lame --enable-libvpx
./configure --enable-shared --enable-gpl --enable-nonfree --enable-postproc --enable-swscale --enable-pthreads --enable-libx264 --enable-libxvid --enable-libvorbis --enable-libfaac --enable-libmp3lame --enable-libvpx
make
make
I get the following error when compiling the source:
编译源代码时出现以下错误:
/usr/bin/ld: /usr/local/lib/libvpx.a(vpx_codec.c.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libvpx.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [libavcodec/libavcodec.so.54] Error 1
How do I get around this error, and get libvpx up and running with the latest ffmpeg on my 64-bit CentOS box?
我如何解决这个错误,并在我的 64 位 CentOS 机器上使用最新的 ffmpeg 启动和运行 libvpx?
回答by j?rgensen
(And the question is...?)
(问题是……?)
Shared libraries must be composed of PIC object code, but ffmpeg failed to do so.
共享库必须由 PIC 目标代码组成,但 ffmpeg 没有这样做。
回答by blahdiblah
Try
尝试
CFLAGS=-fPIC ./configure ...<your config options>...
To add the flag that the error mentions is missing.
添加错误提到的标志丢失。
回答by Felix Yan
回答by Shervin Emami
Since you configured FFMPEG with "--enable-shared", you also need to configure some of it's other libraries with "--enable-shared" also, and they must all use the same setting.
由于您使用“--enable-shared”配置了 FFMPEG,您还需要使用“--enable-shared”配置它的一些其他库,并且它们都必须使用相同的设置。
This error message is basically telling you to compile libvpx again with "--enable-shared" added to the configure command, then try compiling FFMPEG again (also configured with "--enable-shared"). Chances are that you will then get the same error but it will say "libx264" or "libmp3lame" instead of "libvpx", so you will also need to recompile those libs with "--enable-shared" in the configure command.
此错误消息基本上是告诉您在配置命令中添加“--enable-shared”再次编译libvpx,然后再次尝试编译FFMPEG(也配置为“--enable-shared”)。很可能你会得到同样的错误,但它会说“libx264”或“libmp3lame”而不是“libvpx”,所以你还需要在配置命令中使用“--enable-shared”重新编译这些库。
回答by Saheed
I got a similar error while compiling ffmpegon an x86_64 machine running Oracle Linux 6.3. Oracle Linux is based on Red Hat and is thus similar to CentOS in the original question.
在运行 Oracle Linux 6.3 的 x86_64 机器上编译ffmpeg 时,我遇到了类似的错误。Oracle Linux 基于 Red Hat,因此类似于原始问题中的 CentOS。
configure:
配置:
./configure --enable-shared --enable-nonfree --enable-libmp3lame --enable-libfaac --enable-libx264 --enable-encoder=x264 --enable-gpl
make:
制作:
/usr/bin/ld: /usr/local/lib/libx264.a(common.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libx264.a: could not read symbols: Bad value
In my case, this answer, although partly specific to Ubuntu, shed more light on the underlying issue with respect to x86_64 systems in general:
就我而言,这个答案虽然部分特定于 Ubuntu,但总体上更说明了与 x86_64 系统相关的潜在问题:
"I believe if you enable-shared on FFmpeg you have to do the same on x264 on x86_64 systems, otherwise you'll have a PIC shared FFmpeg and non-PIC static x264."
“我相信如果您在 FFmpeg 上启用共享,您必须在 x86_64 系统上的 x264 上执行相同的操作,否则您将拥有 PIC 共享 FFmpeg 和非 PIC 静态 x264。”
The fix was to ensure the x264 sources which I originally compiled using the "--enable-static" flag with configure(which generated "/usr/local/lib/libx264.a") was re-compiled using the "--enable-shared" flag which generates the correct target of "/usr/local/lib/libx264.so":
修复是为了确保我最初使用“--enable-static”标志和配置(生成“/usr/local/lib/libx264.a”)编译的x264源代码使用“--enable ”重新编译-shared” 标志生成正确的目标“/usr/local/lib/libx264.so”:
1st Attempt:
1. cd /tmp
2. wget ftp://ftp.videolan.org/pub/x264/snapshots/last_x264.tar.bz2
3. tar xfv last_x264.tar.bz2;
4. cd x264-snapshot-xxxxxx
5. ./configure --enable-static
6. make && make install
2nd Attempt:
1. cd /tmp/x264-snapshot-xxxxxx
2. make distclean
3. ./configure --enable-shared
4. make && make install
回答by BigKuma
I had this problem in MythTV build with libx264.a
我在使用 libx264.a 构建 MythTV 时遇到了这个问题
I downloaded and built as Saheed suggested.
我按照 Saheed 的建议下载并构建。
The only thing is that /usr/local/lib/libx264.a was not changed when I did "make install". I had to do "make install-lib-static"
唯一的问题是 /usr/local/lib/libx264.a 在我执行“make install”时没有改变。我必须做“make install-lib-static”