[FFmpeg-devel] [PATCH] Fix pkg-config detection when using a cross-prefix

Kyle Schwarz kshawkeye at gmail.com
Mon Jul 2 21:47:40 CEST 2012

On 7/2/2012 3:42 PM, Michael Niedermayer wrote:
> On Mon, Jul 02, 2012 at 01:37:50PM -0400, Kyle Schwarz wrote:
>> On 7/2/2012 1:03 PM, Michael Niedermayer wrote:
>>> On Fri, Jun 29, 2012 at 10:08:06PM -0400, Kyle Schwarz wrote:
>>>> On 6/29/2012 11:04 AM, Michael Niedermayer wrote:
>>>>> On Fri, Jun 29, 2012 at 10:58:28AM -0400, Derek Buitenhuis wrote:
>>>>>> On 29/06/2012 2:30 AM, Kyle Schwarz wrote:
>>>>>>> The attached patch resolves a pkg-config issue.
>>>>>>> When a cross-prefix is used, FFmpeg searches for a cross-prefixed
>>>>>>> pkg-config, and fails to use pkg-config if none if found.
>>>>>>> This patch allows a native system pkg-config to be used if a prefixed
>>>>>>> one is not found.
>>>>>> This seems like it could go quite wrong in some situations...
>>>>> seconded
>>>> Can you give me an example of when it could go bad?
>>> assume you have libfoo 0.1 installed on your host and you cross
>>> compile and link to libfoo 9.0.
>>> the hosts pkg-config will search the hosts .pc files which will
>>> contain "instructions" to link to libfoo 0.1. Thes 2 libs may depend
>>> on different other libs, need different linker flags and be in
>>> different directories
>> The PKG_CONFIG_PATH is what controls where the .pc files are found.
>>> The problem i see is not using the hosts pkg-config but rather the
>>> hosts installed .pc files. But the hosts pkg-config will use them
>>> by default and i dont see something that would prevent it
>> As long as the PKG_CONFIG_PATH is set properly the host system libs
>> will not be used.
> who or what would set this path ?

Everyone using the native pkg-config or installed their libs to a 
prefixed dir.

> i think configure doesnt set nor check it (at least my grep failed
> to find any indication for it)
> a seperate pkg-config binary could use a different path ... so it
> wouldnt need PKG_CONFIG_PATH set ...
> but if we would use the hosts then it certainly would be bad if the
> path isnt set.

No one compiles a pkg-config for a cross toolchain. It has a lot of 
circular dependency's and is a pain to compile. Everyone simple finds 
some way to hack the FFmpeg to use the native one. These hacks would not 
be needed if FFmpeg's configure functioned like other package configures 
and had a fallback.

More information about the ffmpeg-devel mailing list