[FFmpeg-devel] [PATCH] define private libs properly in pkgconfig files

Aurelien Jacobs aurel
Fri May 9 13:04:14 CEST 2008

Anssi Hannula wrote:

> Aurelien Jacobs wrote:
> > Anssi Hannula wrote:
> > 
> >> j at v2v.cc wrote:
> >>> On Thu, 2008-05-08 at 04:46 +0300, Anssi Hannula wrote:
> >>>
> >>>> If you are linking statically, you have to use '--static' option
> >>>> of pkg-config. Then all libraries are printed.
> >>> how can i do that with ?PKG_CHECK_MODULES?
> >>> pkg-config does not seam to check or know if only static linking
> >>> is possible. by default ffmpeg does not install shared libs.
> >> Indeed, PKG_CHECK_MODULES does not know that.
> > 
> > And thus, PKG_CHECK_MODULES have to be fixed to support static libs.
> > (aren't you starting to feel the autotools ugliness ? ;-)
> > 
> >> So I guess the way to make it behave correctly is indeed to not
> >> make $name-uninstalled.pc use Libs.private and only make $name.pc
> >> use Libs.private when the shared library is created.
> > 
> > That's wrong. Both $name-uninstalled.pc and $name.pc can be used
> > to link with static as well as shared libs if both are built.
> $name-uninstalled.pc can only be used to link statically, as it
> hardcodes the static library name.

Indeed, sorry.
I guess it would be possible to improve *-uninstalled.pc to support
shared libs, but that's certainly not worth.

> > Current .pc files seems to be OK. The actual bug is in
> Unfortunately AFAICS that would not be easy to fix.

I probably fails to understand something (I don't know pkg-config
very well). But the problem originally mentioned seems pretty easy
to solve.
PKG_CHECK_MODULES should use `pkg-config --libs`, then try to link
a test program with this, and if it don't work, try again with
`pkg-config --libs --static`.
What problem did I missed ?

Maybe it's not nice that `pkg-config --libs` don't work when only
static libs are installed, but that shouldn't be a problem for

But, now that I understand your patch a bit better, I think it may
be OK, as long as `pkg-config --libs --static` still always work
when static libs are installed.


More information about the ffmpeg-devel mailing list