[FFmpeg-user] Weird issue when to link libraries of ffmpeg.
Pavel Koshevoy
pkoshevoy at gmail.com
Sat May 25 13:39:55 CEST 2013
On 5/24/13 6:30 PM, stanley zhang wrote:
> Hi, All,
>
> I want to build myself application based on ffmpeg libraries. What I did
> are very simple:
> (1) Configure, build and install latest ffmpeg;
> (2) Copy ffplay.c (changed to play.c), cmdutils.c, config.h,
> cmdutils_common_opts.h, and cmdutils.h from the parent directory of ffmpeg
> to my self directory.
> (3) Create a simple Makefile as the followings:
> all: play
> play:play.c cmdutils.c
> gcc -o play play.c cmdutils.c -lSDL -lavcodec -lavformat -lavutil
> -lswscale -lavfilter -lpostproc -lswresample
>
> (4) Build it. The errors can be met as the followings:
> ~/fftest/play$ make
> gcc -o play play.c cmdutils.c -lSDL -lavcodec -lavformat -lavutil -lswscale
> -lavfilter -lpostproc -lswresample
> /usr/local/lib/libavfilter.a(buffersink.o): In function `read_from_fifo':
> /home/stanley/ffmpeg/libavfilter/buffersink.c:166: undefined reference to
> `av_audio_fifo_read'
> ...(Some other logs are omitted)
>
> But I am sure the right libraries are linked and the function
> "read_from_fifo" are defined in the library libavutil.a:
> stanley at stanley-P31-ES3G:~/fftest/play$ objdump /usr/local/lib/libavutil.a
> -t |grep av_audio_fifo_size
> 00000480 g F .text 00000008 av_audio_fifo_size
> stanley at stanley-P31-ES3G:~/fftest/play$ objdump
> /usr/local/lib/libavfilter.a -t|grep av_buffersink_get_samples
> 00000790 g F .text 000001d3 av_buffersink_get_samples
>
> It seems not to be version issue.
>
>
You are linking to static libraries, therefore the order in which you
link to each library matters. avfilter probably depends on avutil, so
try putting -lavutil after -lavfilter
Pavel.
More information about the ffmpeg-user
mailing list