[FFmpeg-devel] ffmpeg static library linking issue

yuvaraj r yuvaraj.tr at gmail.com
Mon Feb 6 13:38:07 CET 2012


Hi All,


I compiled the ffmpeg source to generate the static(.a foramt)
libraries  in linux.

When i am linking the static libraries with my application,

i am getting undefined reference for many functions.

Even i tried with pkg-config.

Here command , what i tried


gcc -shared -Wl,-soname,librecorder.so.1 '-Wl,-rpath,lib'  -lpthread
-lXdamage -lXfixes -lXmu -lXi -lX11
-L/home/peter/Desktop/screenrecorder/librecorder/src/../dependencies/lib
 -lavformat -lavcodec -lavutil -lswscale `pkg-config --libs --cflags
libavutil` `pkg-config --libs --cflags libswscale` `pkg-config --libs
--cflags libavcodec` `pkg-config --libs --cflags libavformat` -o
librecorder.so.1.1 init.o main_entry.o xtoffmpeg.o


It is generated the librecorder library. I have all dependency libs

when executing ld command

#ld librecorder.so.1.1

librecorder.so.1: undefined reference to `av_new_stream'
librecorder.so.1: undefined reference to `av_read_packet'
librecorder.so.1: undefined reference to `avcodec_alloc_frame'
librecorder.so.1: undefined reference to `av_close_input_file'
librecorder.so.1: undefined reference to `audio_resample'
librecorder.so.1: undefined reference to `avcodec_find_encoder'
librecorder.so.1: undefined reference to `av_find_input_format'
librecorder.so.1: undefined reference to `avcodec_encode_audio'
librecorder.so.1: undefined reference to `dump_format'
librecorder.so.1: undefined reference to `av_open_input_file'
librecorder.so.1: undefined reference to `avcodec_find_decoder'
librecorder.so.1: undefined reference to `avcodec_close'
librecorder.so.1: undefined reference to `av_find_stream_info'
librecorder.so.1: undefined reference to `audio_resample_init'
librecorder.so.1: undefined reference to `avpicture_get_size'
librecorder.so.1: undefined reference to `av_register_all'
librecorder.so.1: undefined reference to `avcodec_decode_audio'
librecorder.so.1: undefined reference to `avcodec_open'
librecorder.so.1: undefined reference to `avcodec_encode_video'
librecorder.so.1: undefined reference to `av_destruct_packet_nofree'
librecorder.so.1: undefined reference to `avpicture_fill'
librecorder.so.1: undefined reference to `av_set_parameters'
librecorder.so.1: undefined reference to `av_alloc_format_c

Now problem with static libraries.


#pkg-config --list-all | grep mpeg
libswscale                       libswscale - FFmpeg image rescaling library
libavutil                        libavutil - FFmpeg utility library
libavformat                      libavformat - FFmpeg container format library
libavcodec                       libavcodec - FFmpeg codec library


How do i solve this issue


Thanks


Yuvaraj R


More information about the ffmpeg-devel mailing list