[FFmpeg-devel] usage of Requires.private in *.pc files

Reinhard Tartler siretart
Sat Nov 15 10:03:07 CET 2008


Sorry for the late reply, I was (and still am) terribly busy at work,
and wanted to rethink the whole patch. I think I've come to a conlcusion
and can reason it.

Dominik 'Rathann' Mierzejewski <dominik at rangers.eu.org> writes:

> If I understand correctly, Requires.private and Libs.private should only be
> present if the static versions of FFmpeg libs are built, right? That's
> why

Please forget Requires.private for a moment.

I think this is not a requirement by pkg-config but ffmpeg, which I
don't understand entirely. When a program ist to be linked statically
and uses pkg-config, pkg-config will only look at Libs.private. This is
pretty untypical in a distribution setting. For linking dynamically
pkg-config will only consider the field Libs.

Requires.private is used for declaring dependencies. I don't see that in
ffmpeg it is necessary for anything else than declaring "ffmpeg
internal" dependencies, see below.

> I said your patch is wrong, too, but the main reason is your proposed addition
> of "$requires" to Libs.private, because it'll generate a line like this:
>
> Libs.private: -lz -pthread -lm -lfaac ... -lXext libraw1394 theora vorbisenc libavutil = 49.10.0
>
> Don't you see it's wrong? Libs[.private] is supposed to contain something you
> can pass to the linker. Or am I wrong here?

No, you are right. I'm sorry. That would break the build horribly.

I've come now to this patch which removes the variable $pkg_requires entirely.

--- a/configure
+++ b/configure
@@ -2059,11 +2059,6 @@ check_deps $CONFIG_LIST       \
            $OUTDEV_LIST       \
            $PROTOCOL_LIST     \
 
-enabled libdc1394 && append pkg_requires "libraw1394"
-enabled libdirac  && append pkg_requires "dirac"
-enabled libtheora && append pkg_requires "theora"
-enabled libvorbis && append pkg_requires "vorbisenc"
-
 echo "install prefix            $prefix"
 echo "source path               $source_path"
 echo "C compiler                $cc"
@@ -2381,16 +2376,16 @@ EOF
 }
 
 pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION"
-pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "$pkg_requires libavutil = $LIBAVUTIL_VERSION"
-pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "$pkg_requires libavcodec = $LIBAVCODEC_VERSION"
-pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "$pkg_requires libavformat = $LIBAVFORMAT_VERSION"
+pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
+pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
+pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"
 enabled avfilter &&
-    pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "$pkg_requires libavutil = $LIBAVUTIL_VERSION"
+    pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
 enabled postproc &&
     pkgconfig_generate libpostproc "FFmpeg post processing library" "$LIBPOSTPROC_VERSION"
 if enabled swscale; then
     pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"
 else
-    pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "$pkg_requires libavcodec = $LIBAVCODEC_VERSION"
+    pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "libavcodec = $LIBAVCODEC_VERSION"
     apply libswscale/libswscale.pc sed s/^Libs:.*$/Libs:/
 fi


The generated pc files for avcodec look like this:

::::::::::::::
libavcodec/libavcodec.pc
::::::::::::::
prefix=/usr/local
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/include

Name: libavcodec
Description: FFmpeg codec library
Version: 52.2.0
Requires: 
Requires.private: libavutil = 49.12.0
Conflicts:
Libs: -L${libdir} -lavcodec 
Libs.private: -lz -lbz2 -lm -ltheora -logg -lvorbisenc -lvorbis -logg -ldc1394 -lraw1394 -ldl -ldl
Cflags: -I${includedir}
::::::::::::::
libavcodec/libavcodec-uninstalled.pc
::::::::::::::
prefix=
exec_prefix=
libdir=${pcfiledir}
includedir=/srv/scratch/packages/pkg-multimedia/svn.experimental/build-area/ffmpeg-debian-0.svn20081108

Name: libavcodec
Description: FFmpeg codec library
Version: 52.2.0
Requires: libavutil = 49.12.0
Conflicts:
Libs: ${libdir}/libavcodec.a   -lz -lbz2 -lm -ltheora -logg -lvorbisenc -lvorbis -logg -ldc1394 -lraw1394    -ldl -ldl
Cflags: -I${includedir}


For libswscale:

::::::::::::::
libswscale/libswscale.pc
::::::::::::::
prefix=/usr/local
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/include

Name: libswscale
Description: FFmpeg image rescaling library
Version: 0.6.1
Requires: 
Requires.private: libavutil = 49.12.0
Conflicts:
Libs: -L${libdir} -lswscale 
Libs.private: 
Cflags: -I${includedir}
::::::::::::::
libswscale/libswscale-uninstalled.pc
::::::::::::::
prefix=
exec_prefix=
libdir=${pcfiledir}
includedir=/srv/scratch/packages/pkg-multimedia/svn.experimental/build-area/ffmpeg-debian-0.svn20081108

Name: libswscale
Description: FFmpeg image rescaling library
Version: 0.6.1
Requires: libavutil = 49.12.0
Conflicts:
Libs: ${libdir}/libswscale.a 
Cflags: -I${includedir}


and libavformat:

::::::::::::::
libavformat/libavformat.pc
::::::::::::::
prefix=/usr/local
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/include

Name: libavformat
Description: FFmpeg container format library
Version: 52.23.1
Requires: 
Requires.private: libavcodec = 52.2.0
Conflicts:
Libs: -L${libdir} -lavformat 
Libs.private: -lz -lbz2 -lm -ltheora -logg -lvorbisenc -lvorbis -logg -ldc1394 -lraw1394 -ldl -ldl
Cflags: -I${includedir}
::::::::::::::
libavformat/libavformat-uninstalled.pc
::::::::::::::
prefix=
exec_prefix=
libdir=${pcfiledir}
includedir=/srv/scratch/packages/pkg-multimedia/svn.experimental/build-area/ffmpeg-debian-0.svn20081108

Name: libavformat
Description: FFmpeg container format library
Version: 52.23.1
Requires: libavcodec = 52.2.0
Conflicts:
Libs: ${libdir}/libavformat.a   -lz -lbz2 -lm -ltheora -logg -lvorbisenc -lvorbis -logg -ldc1394 -lraw1394    -ldl -ldl
Cflags: -I${includedir}


The fact that -ldl is named twice is not something the patch above
produes but comes from somewhere else. I don't think it is harmful, but
not nice either.

I've left in the Requires.private field for libavutil, since libavcodec,
libavformat and others DO expose internals of libavutil. At least the
types "PixelFormat" and "AVRational" are actively exposed. So the hard
depedency is indeed warranted here.

-- 
Gruesse/greetings,
Reinhard Tartler, KeyID 945348A4





More information about the ffmpeg-devel mailing list