[Libav-user] undefined reference errors from linker

Srinath M srinath3142 at gmail.com
Wed Jan 23 11:49:07 CET 2013

On Wed, Jan 23, 2013 at 3:22 PM, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:

> Srinath M <srinath3142 at ...> writes:
> > clang -o tld tld.o -L"../lib" -lccv -lavformat -lavcodec -lswscale -lz
> -lm
> >
> > /usr/local/lib/libavformat.a(concat.o): In function `concat_close':
> > /home/srinath/Downloads/ffmpeg-1.1.1/libavformat/concat.c:52:
> > undefined reference to `av_freep'
> Whenever you link with one of FFmpeg's libraries, you
> have to add avutil which is a prerequisite for all
> other libraries.
> Generally, it may be a good idea to run "grep" in such
> a case (or even nm), it may tell you were the missing
> symbol is defined.
> Please do not top-post here, it is considered rude.
> Carl Eugen

Thanks Carl, that reduced the linker errors from more than a 100 to about
This is a sample of the 10 or so that remain
clang -o tld tld.o -L"../lib" -lccv -lavformat -lavcodec -lswscale -lavutil
-lz -lm

/usr/local/lib/libavformat.a(matroskadec.o): In function
undefined reference to `BZ2_bzDecompressInit'

/usr/local/lib/libavformat.a(udp.o): In function `udp_close':
/home/srinath/Downloads/ffmpeg-1.1.1/libavformat/udp.c:824: undefined
reference to `pthread_cancel'

And 8 more similar errors.

nm libavformat.a | grep 'matroska_decode_buffer'
000005e0 t matroska_decode_buffer

nm libavformat.a | grep 'BZ2_bzDecompressInit'
         U BZ2_bzDecompressInit

Infact when i run nm with the -U option it lists a large number of
undefined symbols.
How could i make ffmpeg and compile the /doc/examples succesfully and still
have so many undefined symbols?
Are these dependency packages that would normally be installed by Ubuntu or
other Linux flavors? I don't think so because some of the undefined symbols
are things such as
         U __divdi3
         U __udivdi3
         U av_add_index_entry
         U av_free
         U av_get_packet
         U av_log
         U av_log_ask_for_sample
         U av_malloc

> _______________________________________________
> Libav-user mailing list
Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130123/13d84906/attachment.html>

More information about the Libav-user mailing list