1
votes

I follow the ffmpeg tuorial, and install ffmpeg via ppa

But when I compiled the tuorial02.c, I got gcc error:

/usr/bin/ld: /opt/ffmpeg/lib//libavcodec.a(libvorbisenc.o): undefined reference to symbol 'vorbis_encode_setup_vbr'

//usr/lib/x86_64-linux-gnu/libvorbisenc.so.2: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status

My compile command is:

gcc -I /opt/ffmpeg/include/ -L /opt/ffmpeg/lib/  -o tutorial02 tutorial02.c -lavformat -lavcodec -lswscale `sdl-config --cflags --libs`  -lpthread -lz -lm -ldl

I have searched the reason for hours. I can't solve this. Can anyone help me?

Added I have add -lvorbisenc to the end. the error is lib not found. and libvorivisenc2 has been install. so this question is not a duplicate of Strange linking error: DSO missing from command line

And My OS is Linux mint 17.3

1
Try adding -lvorbisenc to the end of your compiling/linking command. It looks like the linker is complaining that it can't find vorbis_encode_setup_vbr, which is defined in libvorbisenc, which suggests you aren't linking to it. - Cornstalks
@Cornstalks when I add -lvorbisenc to the end of my command. and got error /usr/bin/ld: cannot find -lvorbisenc. but package libvorbisenc2 has been installed. And my os is Linux mint 17.3 - ldkxingzhe

1 Answers

1
votes

The error is telling you that the static library libavcodec.a references symbols from libvorbisenc but libvorbisenc isn't explicitly in your link command (though it did find a good candidate from another shared library in the link command). You'll need to add -lvorbisenc or $(pkg-config --libs vorbisenc) explicitly to your command line.

(Older versions of binutils would let you bring in shared libraries implicitly in this situation; however, newer versions of binutils are stricter.)