[FFmpeg-user] Linking applications with FFmpeg

Misha Penkov misha.penkov at gmail.com
Thu Sep 20 11:38:44 CEST 2012


Hello,

I'm maintaining the FFmpeg tutorials at
https://github.com/mpenkov/ffmpeg-tutorial.  Recently, I've noticed
that the tutorial does not link anymore:

mpenkov at misha-desktop:~/git/ffmpeg-tutorial$ make bin/tutorial01.out
gcc -Wall -ggdb `pkg-config --cflags libavcodec libavformat libavutil
libswscale sdl` -c tutorial01.c -o obj/tutorial01.o
gcc -Wall -ggdb `pkg-config --cflags libavcodec libavformat libavutil
libswscale sdl` `pkg-config --cflags libavcodec libavformat libavutil
libswscale sdl` `pkg-config --libs libavcodec libavformat libavutil
libswscale sdl` -lm obj/tutorial01.o  -o bin/tutorial01.out
obj/tutorial01.o: In function `main':
/home/mpenkov/git/ffmpeg-tutorial/tutorial01.c:70: undefined reference
to `av_register_all'
/home/mpenkov/git/ffmpeg-tutorial/tutorial01.c:73: undefined reference
to `avformat_open_input'
/home/mpenkov/git/ffmpeg-tutorial/tutorial01.c:77: undefined reference
to `avformat_find_stream_info'
/home/mpenkov/git/ffmpeg-tutorial/tutorial01.c:81: undefined reference
to `av_dump_format'
/home/mpenkov/git/ffmpeg-tutorial/tutorial01.c:97: undefined reference
to `avcodec_find_decoder'
/home/mpenkov/git/ffmpeg-tutorial/tutorial01.c:103: undefined
reference to `avcodec_open2'
/home/mpenkov/git/ffmpeg-tutorial/tutorial01.c:107: undefined
reference to `avcodec_alloc_frame'
/home/mpenkov/git/ffmpeg-tutorial/tutorial01.c:110: undefined
reference to `avcodec_alloc_frame'
/home/mpenkov/git/ffmpeg-tutorial/tutorial01.c:115: undefined
reference to `avpicture_get_size'
/home/mpenkov/git/ffmpeg-tutorial/tutorial01.c:117: undefined
reference to `av_malloc'
/home/mpenkov/git/ffmpeg-tutorial/tutorial01.c:120: undefined
reference to `sws_getContext'
/home/mpenkov/git/ffmpeg-tutorial/tutorial01.c:137: undefined
reference to `avpicture_fill'
/home/mpenkov/git/ffmpeg-tutorial/tutorial01.c:146: undefined
reference to `avcodec_decode_video2'
/home/mpenkov/git/ffmpeg-tutorial/tutorial01.c:152: undefined
reference to `sws_scale'
/home/mpenkov/git/ffmpeg-tutorial/tutorial01.c:171: undefined
reference to `av_free_packet'
/home/mpenkov/git/ffmpeg-tutorial/tutorial01.c:142: undefined
reference to `av_read_frame'
/home/mpenkov/git/ffmpeg-tutorial/tutorial01.c:175: undefined
reference to `av_free'
/home/mpenkov/git/ffmpeg-tutorial/tutorial01.c:176: undefined
reference to `av_free'
/home/mpenkov/git/ffmpeg-tutorial/tutorial01.c:179: undefined
reference to `av_free'
/home/mpenkov/git/ffmpeg-tutorial/tutorial01.c:182: undefined
reference to `avcodec_close'
/home/mpenkov/git/ffmpeg-tutorial/tutorial01.c:185: undefined
reference to `avformat_close_input'
collect2: ld returned 1 exit status
make: *** [bin/tutorial01.out] Error 1

Other people seem to have run into similar issues, but without a solution:

http://stackoverflow.com/questions/12455691/while-build-a-demo-about-ffmpeg-it-occurs-undefined-reference-to-av-registe
http://ffmpeg.org/pipermail/libav-user/2012-February/001236.html

Some background info:

mpenkov at misha-desktop:~/git/ffmpeg-tutorial$ ffmpeg
ffmpeg version N-44622-g16e52c8 Copyright (c) 2000-2012 the FFmpeg developers
  built on Sep 20 2012 18:16:09 with gcc 4.4.3 (Ubuntu 4.4.3-4ubuntu5.1)
  configuration: --enable-gpl --enable-libfaac --enable-libmp3lame
--enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libtheora --enable-libvorbis --enable-libx264
--enable-nonfree --enable-postproc --enable-version3 --enable-x11grab
--enable-libvpx --disable-shared --enable-pic
  libavutil      51. 73.101 / 51. 73.101
  libavcodec     54. 56.100 / 54. 56.100
  libavformat    54. 27.101 / 54. 27.101
  libavdevice    54.  2.100 / 54.  2.100
  libavfilter     3. 16.104 /  3. 16.104
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile
options] outfile}...

mpenkov at misha-desktop:~/git/ffmpeg-tutorial$ pkg-config --list-all | grep mpeg
libavutil                      libavutil - FFmpeg utility library
libavcodec                     libavcodec - FFmpeg codec library
libpostproc                    libpostproc - FFmpeg postprocessing library
libswresample                  libswresample - FFmpeg audio rescaling library
libavfilter                    libavfilter - FFmpeg video filtering library
libavformat                    libavformat - FFmpeg container format library
libswscale                     libswscale - FFmpeg image rescaling library
libavdevice                    libavdevice - FFmpeg device handling library

mpenkov at misha-desktop:~/git/ffmpeg-tutorial$ pkg-config --cflags
libavcodec libavformat libavutil libswscale sdl
-D_GNU_SOURCE=1 -D_REENTRANT -I/usr/local/include -I/usr/include/SDL

mpenkov at misha-desktop:~/git/ffmpeg-tutorial$ pkg-config --libs
libavcodec libavformat libavutil libswscale sdl
-pthread -L/usr/local/lib -lavformat -lavcodec -ldl -lXfixes -lXext
-lX11 -lasound -lx264 -lvpx -lvorbisenc -lvorbis -ltheoraenc
-ltheoradec -logg -lopencore-amrwb -lopencore-amrnb -lmp3lame -lfaac
-lbz2 -lz -lrt -lswscale -lavutil -lm -lSDL

mpenkov at misha-desktop:~/git/ffmpeg-tutorial$ nm
/usr/local/lib/libavformat.a | grep av_register_all
0000000000000000 T av_register_all

Does anybody have any ideas what could be going wrong?

Cheers,
Michael


More information about the ffmpeg-user mailing list