[FFmpeg-devel] Fix libx264

Felipe Contreras felipe.contreras
Sat Feb 20 16:24:35 CET 2010

2010/2/16 M?ns Rullg?rd <mans at mansr.com>:
> Felipe Contreras <felipe.contreras at gmail.com> writes:
>> 2010/2/7 M?ns Rullg?rd <mans at mansr.com>:
>>> Felipe Contreras <felipe.contreras at gmail.com> writes:
>>>> Is it wrong in this case? If you want -pthread instead of -lpthread
>>>> then x264's pc file can be corrected.
>>> Wrong. ?The correct flag depends on the compiler, and .pc files don't
>>> take that into account. pkg-config is flawed. ?End of story.
>> I read a bit about -pthread vs -lpthread and it seems -pthread is
>> essentially '-D_REENTRANT -lpthread' but since x264 headers don't use
>> _REENTRANT, -pthread is the same as -lpthread.
> Even if x264 headers do not use check _REENTRANT, system headers
> might.
>> Of course this is only true on certain platforms. Other platforms
>> mights prefer other flags. Note the word *platform* not compiler.
> The compiler is part of the platform. ?Did you even bother checking
> obscure systems like AIX? ?IIRC it really makes a difference there.

Looking at x264's configure, there's no checks for AIX platform so
that argument is mute.

But supposing special flags are needed; the compiler is a subset of
the platform, but if you use a different compiler on the *same*
platform, then the flags don't change.

On the *same* platform, pkg-config will return the same, which is what
you want. Say in some MinGW platform you might need "-lpthreadGC2
-lwsock32 -DPTW32_STATIC_LIB", well that's what you should use
regardless of the compiler.

>> IOW; if x264 was compiled with -lpthread, that's what FFmpeg should
>> use, regardless of the compiler used. Otherwise linking to x264 will
>> fail.
> You are still wrong. ?If x264 was compiled with thread support,
> anything linking to it must also be compiled and linked with full
> thread support. ?On *some* systems this is as simple as linking with
> -lpthread, on others it is not. ?Passing --enable-pthreads to FFmpeg
> configure will do the right thing.

Indeed, -lpthread might not be enough on some systems, the good thing
is x264's configure already did the checks and if it needs
-D_REENTRANT or whatever; pkg-config will return that.

>> So you are wrong; pkg-config is not flawed.
> Yes it is. ?It can only provide specific flags, which is not
> sufficient information, and may even break things if a different
> compiler is used.

You don't need different flags if you use a different compiler, you
need different flags if you use a different system, but pkg-config is
meant to be used on the same system. So there are no problems.

>> Anyway, regardless of what your opinions are, the fact remains the
>> same: FFmpeg compilation is broken for x264 as static library.
> No, use --enable-pthreads. ?It works for everybody else.

Ah, so FFmpeg build system requires _me_ to chase down dependencies,
very user friendly.

Felipe Contreras

More information about the ffmpeg-devel mailing list