So I manually installed the latest ffmpeg a while ago, because one of my projects needs the latest .55 ffmpeg libraries (I think I used this: https://trac.ffmpeg.org/wiki/UbuntuCompilationGuide). So now in /usr/local/lib, I have:

/usr/local/lib/libavcodec.a  /usr/local/lib/libavcodec.so
/usr/local/lib/libavcodec.so.55  /usr/local/lib/libavcodec.so.55.38.101

The problem is that in /usr/lib/x86_64-linux-gnu, I have:

/usr/lib/x86_64-linux-gnu/libavcodec.a   /usr/lib/x86_64-linux-gnu/libavcodec.so.53
/usr/lib/x86_64-linux-gnu/libavcodec.so  /usr/lib/x86_64-linux-gnu/libavcodec.so.53.35.0

When I compile my code, I get this linker error:

/usr/bin/ld: warning: libavcodec.so.55, needed by /usr/local/lib/libopencv_highgui.so, may conflict with libavcodec.so.53
/usr/bin/ld: obj/h264_decoder.o: undefined reference to symbol 'avcodec_free_frame@@LIBAVCODEC_55'
/usr/bin/ld: note: 'avcodec_free_frame@@LIBAVCODEC_55' is defined in DSO /usr/local/lib/libavcodec.so.55 so try adding it to the linker command line
/usr/local/lib/libavcodec.so.55: could not read symbols: Invalid operation
collect2: ld returned 1 exit status

If I get rid of the conflicting library files in /usr/lib/x86_64-linux-gnu, then my code compiles with no errors. However, then other programs (e.g. the Movie Player) stop working. What's the best way to solve this problem?

  • Did you modify the commands from the guide? If yes, what did you do differently? It does not create shared libraries and it does not install anything to /usr. – llogan Nov 18 '13 at 5:50
  • Hmm.. I guess I must have not followed it exactly. Yes, I remember enabling shared libraries and I guess I did not follow their install directory locations fully. On my other machine, I have the .55's in /usr/local/lib and .53's in /usr/lib/x86_64-linux-gnu/ and everything seems to work fine... – t2k32316 Nov 20 '13 at 3:36
  • Actually, it doesn't work on my other machine either. – t2k32316 Nov 20 '13 at 4:07

Not sure if this is the best fix, but I just added:


to my linker flags (right after I included the libraries for opencv per https://stackoverflow.com/a/15975490/229311) and it effectively got rid of the error.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.