Install ffmpeg on CentOS 64-bit installation with -fPIC error

I get this error when trying to compile ffmpeg on a 64 bit CentOS machine.

Here are my 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

make

When compiling the source, the following error appears:

 /usr/bin/ld: /usr/local/lib/libvpx.a(vpx_codec.co): 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 to get around this error and run libvpx with the latest version of ffmpeg in my 64-bit CentOS field?

+8
linux 64bit ffmpeg
source share
6 answers

Since you configured FFMPEG to "--enable-shared", you also need to configure some of the other libraries with "--enable-shared", and they all must use the same setting.

This error message basically tells you to compile libvpx again with the addition of “--enable-shared” to the configure command, and then try to compile FFMPEG again (also configured with “--enable-shared”). You will most likely get the same error, but instead of “libvpx” you will see “libx264” or “libmp3lame”, so you will also need to recompile these libraries with “--enable-shared” in the configure command.

+10
source share

Try

 CFLAGS=-fPIC ./configure ...<your config options>... 

To add a flag that is not mentioned error.

+2
source share

I got a similar error when compiling ffmpeg on an x86_64 machine running Oracle Linux 6.3. Oracle Linux is based on Red Hat and thus is similar to CentOS in the original question.

Configure:

 ./configure --enable-shared --enable-nonfree --enable-libmp3lame --enable-libfaac --enable-libx264 --enable-encoder=x264 --enable-gpl 

Mark:

 /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 one, although partially dependent on Ubuntu, has shed more light on the main issue regarding x86_64 systems in general:

"I believe that if you enable FFmpeg sharing, you must do the same on x264 on x86_64 systems, otherwise you will have shared FFmpeg and PIC non-PIC static x264."

The fix was to ensure that the x264 sources that I originally compiled using the --enable-static flag with the setting (which generated "/usr/local/lib/libx264.a") were recompiled using the "--enable-shared" command, which generates the correct target "/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 
+2
source share

(And the question is ...?)

Shared libraries should consist of PIC object code, but ffmpeg failed to do this.

0
source share

Have you compiled libvpx with --shared and -fPIC so that it generates libvpx.so* ?

If not, you can try comment # 6 and # 7 on this question.

0
source share

I had this problem in building MythTV with libx264.a

I downloaded and built as Sahid suggested.

The only thing that / usr / local / lib / libx 264.a did not change when I did "make install". I had to do "make install-lib-static"

0
source share

All Articles