[FFmpeg-devel] Fix libx264

Måns Rullgård mans
Tue Feb 16 10:41:42 CET 2010


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.

> 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.

> 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.

> 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.

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



More information about the ffmpeg-devel mailing list