R: R: R: [GRASS-dev] GRASS FFMPEG support

Glynn Clements glynn at gclements.plus.com
Fri Jun 13 23:59:03 EDT 2008


marco.pasetti at alice.it wrote:

> >When posting error messages, please include the command which
> >generated the error.
>  
> Sorry, I thought it was clear that it was simply the make command

No, I mean the "gcc ... -shared" command which actually links the
library. That's what is generating the errors.

>  
> >However, as OGSF uses av_free directly, configure should really be
> >testing explicitly for libavutil. It isn't necessary on Linux, but
> >Windows handles DLLs differently.
>  
> mmm... probably I need to make things more clear than they actually are now for me!
> avutil.dll is in the same place where the other ffmpegs DLLs are!

The problem is that lib/OGSF/Makefile doesn't actually specify that
-lavutil is required when building the OGSF DLL.

It isn't needed on e.g. Linux, because shared libraries are allowed to
contain unresolved symbols. Those symbols need to be supplied at
run-time, but that happens because libavformat and libavcodec both
depend upon libavutil, so it gets loaded anyhow.

But Windows requires all symbols to be resolved at the point that you
build a DLL. As the OGSF DLL uses av_free() directly, -lavutil must be
specified.

> but there's another thing that I don't undestand: when I create a ddl with gcc on MinGW I usually do as follows:
> 
> gcc -shared -s -o libname.dll -Wl,--out-implib,libname.a  $LIBOBJECTS
> 
> where libname.dll and libname.a are usually installed in
> /usr/local/bin and /usr/local/lib respectively; and when I create an
> executable that uses that library I do:
> 
> gcc -s -g -O2 -o exename.exe $EXEOBJECTS -L./ -lname
>  
> I'm mainly referring to those articles:
> http://www.mingw.org/docs.shtml#compilingandbuilding
> http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html#Link-Options
> 
> The strange thing is that there are no *.a import library files
> created by FFMPEG, while I always have them for each library I
> compiled!

AFAICT, you don't actually need import libraries; you can just link
directly against the DLL.

> Last thing: the FFMPEG make script installed the DLLs in
> /ffmpeg/bin,

Windows doesn't have a separate search path for DLLs, it just looks in
$PATH. For Cygwin/MinGW, the "lib" directories are only used for
import libraries; DLLs go in the "bin" directory as that will already
be in $PATH.

> while the /ffmpeg/lib dir is empty, except for the
> pkgconfig folder, that contains the libav*.pc files; I googled for
> them, but I didn't find relevant information on what they exaclty
> are. Do you know some useful articles about that, please?

*.pc are pkg-config files. On Linux, the "official" way to determine
the CFLAGS/LDFLAGS required to use a particular package is e.g.:

	$ pkg-config --cflags libavcodec
	-I/usr/include/ffmpeg  
	$ pkg-config --libs libavcodec
	-lavcodec -lz -la52 -lmp3lame -lx264 -lxvidcore -lfaac -lfaad -ldl -lX11 -lXext -ltheora -lvorbisenc -lavutil -lvorbis -lm -logg  

Except that most of the -l switches are only necessary if you're using
static libraries, so everyone now adds -Wl,--as-needed to ignore the
redundant -l switches from pkg-config (and from libtool's .la files). 
We don't use pkg-config for FFMPEG (we only use it for cairo at the
moment), so this isn't an issue.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list