9

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

Here are my ./configure options:

./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

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?

ndmweb
  • 3,370
  • 6
  • 33
  • 37
  • http://stackoverflow.com/questions/27226157/how-to-setup-ffmpeg-for-centos-release-6-5-server – Hitesh Dec 03 '14 at 06:06
  • Sometimes what is happening is when you are running -fPIC, it will throw this error again for some sub object file. Just take backup of that object file and run make again. Example. you are running for TotalSum.cpp and it has reference to another file CalculateSum.o. Now, the error comes on CalculateSum.o. So, take backup of CalculateSum.o as well and run -fPIC. the error will go away. – bgth Jul 18 '15 at 11:13

6 Answers6

11

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.

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.

Shervin Emami
  • 2,695
  • 25
  • 17
  • http://stackoverflow.com/questions/27226157/how-to-setup-ffmpeg-for-centos-release-6-5-server – Hitesh Dec 03 '14 at 06:07
3

I got a similar error while compiling ffmpeg on 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.

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:

"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."

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":

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
Saïd
  • 8,780
  • 1
  • 28
  • 28
2

Try

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

To add the flag that the error mentions is missing.

blahdiblah
  • 33,069
  • 21
  • 98
  • 152
0

I had this problem in MythTV build with libx264.a

I downloaded and built as Saheed suggested.

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"

0

(And the question is...?)

Shared libraries must be composed of PIC object code, but ffmpeg failed to do so.

jørgensen
  • 10,149
  • 2
  • 20
  • 27
  • sorry i thought the question was implied. How do I get around this error, and get libvpx up and running with the latest ffmpeg on my 64-bit machine? – ndmweb Feb 29 '12 at 22:37
  • http://stackoverflow.com/questions/27226157/how-to-setup-ffmpeg-for-centos-release-6-5-server – Hitesh Dec 03 '14 at 06:09
0

Did you compile your libvpx with --shared and -fPIC so it generated libvpx.so*?

If not, you can try comment #6 and #7 in this issue.

Felix Yan
  • 14,841
  • 7
  • 48
  • 61
  • Please help me !!!! ... http://stackoverflow.com/questions/27226157/how-to-setup-ffmpeg-for-centos-release-6-5-server – Hitesh Dec 03 '14 at 06:26