Hello,
I am developing an application that uses libavcodec, libavformat, and
libswscale, which compiles a runs fine by simply using the system header
files ( #include <ffmpeg/avcodec.h>, etc) and system libraries
( -lavcodec, etc ). FFMPEG was configured as follows:
--enable-gpl --enable-libx264 --enable-shared --enable-swscale
Now, in order to make my application easy to install for other users, I
want to include the necessary ffmpeg library bits in my tarball and have
them load dynamically. This is how I've tried to accomplish this:
- Created an ffmpeg/ folder in my application folder
- Copied libavcodec.so.51, libavformat.so.52, and libswscale.so.0 into
the folder, then renamed them to *.so.
- Copied avcodec.h, avformat.h, and swscale.h into the folder. It also
seemed like I needed avio.h, so it was also put there.
In my application, the libraries are used with:
#include "avcodec.h"
#include "avformat.h"
#include "swscale.h"
And the application is compiled with these flags, among others:
-Iffmpeg/ -Lffmpeg/ -lavcodec -lavformat -lswscale
So, these are the steps that I have used in order to accomplish this.
However, as I try to compile my application I get an "undefined
reference to..." on all functions used, as far as I can tell - i.e. a
linker error (see below for full output). I've tried playing around with
this and even tried to load things statically, without success.
What step am I missing here? I appreciate any input that you might have.
Cheers,
Ola
--- Output from compilation ---
ffmpeg/avcodec.h:2309: warning: ‘ImgReSampleContext’ is deprecated
(declared at ffmpeg/avcodec.h:2303)
ffmpeg/avcodec.h:2319: warning: ‘ImgReSampleContext’ is deprecated
(declared at ffmpeg/avcodec.h:2303)
/tmp/ccXY3PX5.o: In function `GXLinuxDecoder::DecodeVideoPacket(unsigned
char const*, int, AVFrame*, int*)':
/home/olamo/geelix/LinuxApp/GXLinuxDecoder.h:182: undefined reference to
`av_new_packet(AVPacket*, int)'
/home/olamo/geelix/LinuxApp/GXLinuxDecoder.h:188: undefined reference to
`av_dup_packet(AVPacket*)'
/home/olamo/geelix/LinuxApp/GXLinuxDecoder.h:199: undefined reference to
`avcodec_decode_video(AVCodecContext*, AVFrame*, int*, unsigned char
const*, int)'
/home/olamo/geelix/LinuxApp/GXLinuxDecoder.h:212: undefined reference to
`sws_scale(SwsContext*, unsigned char**, int*, int, int, unsigned
char**, int*)'
/tmp/ccXY3PX5.o: In function `GXLinuxDecoder::CloseDecoder()':
/home/olamo/geelix/LinuxApp/GXLinuxDecoder.h:150: undefined reference to
`av_free(void*)'
/home/olamo/geelix/LinuxApp/GXLinuxDecoder.h:153: undefined reference to
`av_free(void*)'
/home/olamo/geelix/LinuxApp/GXLinuxDecoder.h:154: undefined reference to
`av_free(void*)'
/home/olamo/geelix/LinuxApp/GXLinuxDecoder.h:157: undefined reference to
`av_free(void*)'
/home/olamo/geelix/LinuxApp/GXLinuxDecoder.h:160: undefined reference to
`avcodec_close(AVCodecContext*)'
/tmp/ccXY3PX5.o: In function `GXLinuxDecoder::InitDecoder(PixelFormat,
CodecID, int, int, PixelFormat)':
/home/olamo/geelix/LinuxApp/GXLinuxDecoder.h:72: undefined reference to
`av_register_all()'
/home/olamo/geelix/LinuxApp/GXLinuxDecoder.h:73: undefined reference to
`avcodec_alloc_context()'
/home/olamo/geelix/LinuxApp/GXLinuxDecoder.h:84: undefined reference to
`av_malloc(unsigned int)'
/home/olamo/geelix/LinuxApp/GXLinuxDecoder.h:93: undefined reference to
`avcodec_find_decoder(CodecID)'
/home/olamo/geelix/LinuxApp/GXLinuxDecoder.h:101: undefined reference to
`avcodec_open(AVCodecContext*, AVCodec*)'
/home/olamo/geelix/LinuxApp/GXLinuxDecoder.h:108: undefined reference to
`avcodec_alloc_frame()'
/home/olamo/geelix/LinuxApp/GXLinuxDecoder.h:109: undefined reference to
`avcodec_alloc_frame()'
/home/olamo/geelix/LinuxApp/GXLinuxDecoder.h:118: undefined reference to
`avpicture_get_size(int, int, int)'
/home/olamo/geelix/LinuxApp/GXLinuxDecoder.h:119: undefined reference to
`av_malloc(unsigned int)'
/home/olamo/geelix/LinuxApp/GXLinuxDecoder.h:122: undefined reference to
`avpicture_fill(AVPicture*, unsigned char*, int, int, int)'
/home/olamo/geelix/LinuxApp/GXLinuxDecoder.h:127: undefined reference to
`sws_getContext(int, int, int, int, int, int, int, SwsFilter*,
SwsFilter*, double*)'
/tmp/ccXY3PX5.o: In function `GXLinuxRenderer::RenderFrame(AVFrame*)':
/home/olamo/geelix/LinuxApp/GXLinuxRenderer.h:155: undefined reference
to `sws_scale(SwsContext*, unsigned char**, int*, int, int, unsigned
char**, int*)'
/tmp/ccXY3PX5.o: In function `GXLinuxRenderer::InitRenderer(int, int,
PixelFormat)':
/home/olamo/geelix/LinuxApp/GXLinuxRenderer.h:66: undefined reference to
`sws_getContext(int, int, int, int, int, int, int, SwsFilter*,
SwsFilter*, double*)'
/tmp/ccXY3PX5.o: In function `GXLinuxClient::DoConnect()':
/home/olamo/geelix/LinuxApp/GXLinuxClient.h:369: undefined reference to
`avcodec_alloc_frame()'
/home/olamo/geelix/LinuxApp/GXLinuxClient.h:376: undefined reference to
`avpicture_get_size(int, int, int)'
/home/olamo/geelix/LinuxApp/GXLinuxClient.h:377: undefined reference to
`av_malloc(unsigned int)'
/home/olamo/geelix/LinuxApp/GXLinuxClient.h:378: undefined reference to
`avpicture_fill(AVPicture*, unsigned char*, int, int, int)'
collect2: ld returned 1 exit status
make: *** [client] Error 1
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user