[FFmpeg-devel] [PATCH] --enable-libx264 and --enable-libxvid depend on --enable-pthread

Måns Rullgård mans
Sat Feb 28 02:49:08 CET 2009


Aurelien Jacobs <aurel at gnuage.org> writes:

> M?ns Rullg?rd wrote:
>
>> Aurelien Jacobs <aurel at gnuage.org> writes:
>> 
>> > M?ns Rullg?rd wrote:
>> >
>> >> Brad <brad at comstyle.com> writes:
>> >> 
>> >> > On Friday 27 February 2009 18:43:58 M?ns Rullg?rd wrote:
>> >> >> pkg-config fails miserably if you are cross-compiling, something
>> >> >> FFmpeg must support.
>> >
>> > I've already cross-compiled numbers of packages, some of them using
>> > pkg-config, so it doesn't seem to be as broken as you pretend.
>> 
>> How did you make it not suggest -L/usr/lib for the linker flags?
>
> man pkg-config suggest that pkg-config never output -L/usr/lib as
> part of the linker flags, except if you set PKG_CONFIG_ALLOW_SYSTEM_LIBS.

That variable is not set.  I made sure of that.  I somewhere found a
mention of a PKG_CONFIG_SYSROOT_DIR variable that sounded promising.
Setting this did indeed get rid of the bad -L flags.  Unfortunately,
it also made pkg-config stop printing any -l flags at all.  Useless.

> Anyway, the .pc files generated by a lib built in a correctly setup
> cross-compile environment should point to the appropriate lib directory.
>
> And if the .pc files are broken and still point to /usr/lib or
> something like this, you could also override the prefix using
> --define-variable such as:
>   $ pkg-config --define-variable=prefix=/foo --libs x264
>   -L/foo/lib -lx264 -lpthread

That would require me to edit the configure scripts of all packages I
want to compile.  That's not practical.

> If all this don't work, then the .pc file is probably broken beyond
> belief, and you should report it to the one who wrote it.

Yes, all .pc files are broken beyond belief.  That's what I've been
saying all along.

I'm getting by with a wrapper script containing

  pkg-config "$@" | sed "s!\\(-[IL]\\)\\(/lib\\|/usr\\)!\\1${ROOT}\\2!"

but that isn't a complete solution.

>> >> > Everything else just fails miserably all the time.
>> >
>> > True. --enable-libx264 don't work, weather you're cross-compiling
>> > or not. So using pkg-config won't make cross-compiling more broken...
>> 
>> Using pkg-config throughout, which is what I assumed was suggested,
>> would break much more than x264.
>
> What was suggested is to use pkg-config to get the linking dependencies
> of all the static libraries we try to link to.
> And if something break, that's most probably due to a buggy .pc file and
> should be reported.

Not if, when.  We have a solution that works.  Why change to something
that needs to be adjusted every time some random .pc file breaks in a
new way?

>> > The following is working:
>> > $ ./configure --enable-gpl --enable-libx264 --extra-ldflags="-lpthread -lX11"
>> >
>> > But the needed libraries would be different depending on the way
>> > x264 was built.
>> 
>> It is the responsibility of x264 to document its dependencies.
>
> It does... Throught it's x264.pc file. (disregarding the bugs it contains ;-)

And disregarding the bugs in pkg-config that prevent easy access to
the information.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list