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

Aurelien Jacobs aurel
Sat Feb 28 02:10:55 CET 2009


Jason Garrett-Glaser wrote:

> On Fri, Feb 27, 2009 at 4:05 PM, Aurelien Jacobs <aurel at gnuage.org> wrote:
> > Jason Garrett-Glaser wrote:
> >
> >> On Fri, Feb 27, 2009 at 3:25 PM, Aurelien Jacobs <aurel at gnuage.org> wrote:
> >> > M?ns Rullg?rd wrote:
> >> >
> >> >> Robert Swain <robert.swain at gmail.com> writes:
> >> >>
> >> >> > 2009/2/27 M?ns Rullg?rd <mans at mansr.com>:
> >> >> >> Aurelien Jacobs <aurel at gnuage.org> writes:
> >> >> >>
> >> >> >>> Jason Garrett-Glaser wrote:
> >> >> >>>
> >> >> >>>> On Fri, Feb 27, 2009 at 12:00 PM, M?ns Rullg?rd <mans at mansr.com> wrote:
> >> >> >>>> > Peter Eszlari <peter.eszlari at googlemail.com> writes:
> >> >> >>>> >
> >> >> >>>> >> see $subj
> >> >> >>>> >>
> >> >> >>>> >> Index: configure
> >> >> >>>> >> ===================================================================
> >> >> >>>> >> --- configure (revision 17647)
> >> >> >>>> >> +++ configure (working copy)
> >> >> >>>> >> @@ -1687,6 +1687,16 @@
> >> >> >>>> >> ? ? ?die_gpl_disabled "The software scaler" ? ? swscale
> >> >> >>>> >> ?fi
> >> >> >>>> >>
> >> >> >>>> >> +if ! enabled pthreads; then
> >> >> >>>> >> + ? ?die_pthreads_disabled(){
> >> >> >>>> >> + ? ? ? ?name=$1
> >> >> >>>> >> + ? ? ? ?shift
> >> >> >>>> >> + ? ? ? ?enabled_any $@ && die "$name needs pthreads and --enable-pthreads is not specified."
> >> >> >>>> >> + ? ?}
> >> >> >>>> >> + ? ?die_pthreads_disabled "libx264" ? ? ? ? ? ? ? ? libx264
> >> >> >>>> >> + ? ?die_pthreads_disabled "libxvidcore" ? ? ? ? ? ? libxvid
> >> >> >>>> >> +fi
> >> >> >>>> >
> >> >> >>>> > That is not necessarily true.
> >> >> >>>>
> >> >> >>>> More correctly, if libxvid and libx264 were compiled with pthreads,
> >> >> >>>> they depend on pthreads.
> >> >> >>>
> >> >> >>> AFAIR, this is only a problem when libx264 is compiled statically
> >> >> >>> (which is the default) because static libs unfortunately don't embed
> >> >> >>> a list of their dependencies (unlike shared libs), and because our
> >> >> >>> beloved configure maintainers hate pkg-config and refuse to use it
> >> >> >>> to compensate static libs limitations...
> >> >> >>
> >> >> >> Using pkg-config would cause way more trouble that it might solve.
> >> >> >
> >> >> > Why?
> >> >>
> >> >> Because it doesn't work.
> >> >
> >> > I guess that most people who compiles ffmpeg against a static libx264 are
> >> > doing something like this anyway:
> >>
> >> I've never seen anyone use pkgconfig for compiling ffmpeg with static
> >> x264.
> >
> > In fact you are probably right. Because x264.pc is broken... (it is missing
> > some dependencies)
> >
> >> Everyone I have ever seen doing this (in #ffmpeg and elsewhere,
> >> and this is probably dozens upon dozens of people, if not hundreds)
> >> does something like the following:
> >>
> >> ./configure --enable-gpl --enable-libx264 --enable-pthreads <other options>
> >
> > This fails miserably.
> > At least depending on the way x264 was compiled (and maybe depending on
> > the OS too).
> > For example, when x264 is built with
> > ?./configure --enable-visualize
> > Then ffmpeg needs this to compile:
> > ?./configure --enable-gpl --enable-libx264 --extra-ldflags="-lpthread -lX11"
> >
> > (note that x264.pc don't contains the -lX11 :-( )
> 
> That doesn't surprise me, as visualize hasn't been maintained for
> years.  I'm surprised it still works.

It at least compiles.

> On that note, anyone have any ideas about how to fix ffmpeg's current
> problem with x264?  If x264.h is current but the x264 library itself
> is not, ffmpeg will think the version check succeeded and link itself
> to an ancient x264, resulting in random weird segfaults and other such
> things.  I have seen half a dozen people already with this problem in
> #ffmpeg.

This is not possible to detect in configure (at least not when
cross-compiling).
But it should be easy to detect at runtime, and fail gracefully instead
of segfaulting. I have no idea what the code looks like and I'm just
imagining the names, but the lavc init code could looks like this:
  if (X264_VERSION != x264_version())
      return ERROR;

Aurel




More information about the ffmpeg-devel mailing list