[FFmpeg-devel] Upgrade Trouble

Reinhard Tartler siretart
Sat Nov 28 22:20:46 CET 2009


Hey folks,

In the past, I've been receiving quite a bunch of strange distro bug
reports in FFmpeg using applications, where FFmpeg has been updated with
external repositories. For now, I've rejected these bugs but since I'm
currently seriously considering updating the FFmpeg packages, I've tried
to condense the problem to a minimal testcase. So here we go:

First, let's stage FFmpeg 0.5 as "older version". Note that in 0.5
libswscale needed to be enabled explicitly, this switch needs to be
removed for current trunk:

+ svn co svn://svn.ffmpeg.org/ffmpeg/branches/0.5 src
+ cd src
+ ./configure --enable-shared --disable-static --prefix=/var/tmp/ffmpeg/ \
              --enable-swscale --enable-ffmpeg
+ make
+ make install
+ ldd /var/tmp/ffmpeg/bin/ffmpeg
        linux-vdso.so.1 =>  (0x00007fff1ddfa000)
        libswscale.so.0 => /var/tmp/ffmpeg/lib/libswscale.so.0 (0x00007f2b797c2000)
        libavdevice.so.52 => /var/tmp/ffmpeg/lib/libavdevice.so.52 (0x00007f2b795bd000)
        libavformat.so.52 => /var/tmp/ffmpeg/lib/libavformat.so.52 (0x00007f2b792c8000)
        libavcodec.so.52 => /var/tmp/ffmpeg/lib/libavcodec.so.52 (0x00007f2b7892b000)
        libavutil.so.49 => /var/tmp/ffmpeg/lib/libavutil.so.49 (0x00007f2b7871c000)
        libm.so.6 => /lib/libm.so.6 (0x00007f2b78499000)
        libc.so.6 => /lib/libc.so.6 (0x00007f2b78146000)
        libdl.so.2 => /lib/libdl.so.2 (0x00007f2b77f42000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f2b799df000)
+ /var/tmp/ffmpeg/bin/ffmpeg -version
FFmpeg version 0.5, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration: --enable-shared --disable-static --prefix=/var/tmp/ffmpeg/ --enable-swscale --enable-ffmpeg
  libavutil     49.15. 0 / 49.15. 0
  libavcodec    52.20. 0 / 52.20. 0
  libavformat   52.31. 0 / 52.31. 0
  libavdevice   52. 1. 0 / 52. 1. 0
  libswscale     0. 7. 1 /  0. 7. 1
  built on Nov 28 2009 20:57:57, gcc: 4.3.2
FFmpeg 0.5
libavutil     49.15. 0 / 49.15. 0
libavcodec    52.20. 0 / 52.20. 0
libavformat   52.31. 0 / 52.31. 0
libavdevice   52. 1. 0 / 52. 1. 0
libswscale     0. 7. 1 /  0. 7. 1

The binary is installed and working correctly. No problems yet. Now
let's update FFmpeg. Please note that I'm leaving out the 'ffmpeg'
utility this time for demonstration purposes.  Imagine that experiment
with 'mplayer', 'vlc', 'xine' or any other FFmpeg using application:

+ svn co svn://svn.ffmpeg.org/ffmpeg/trunk src
+ cd src
+ ./configure --enable-shared --disable-static --prefix=/var/tmp/ffmpeg/ --disable-ffmpeg
+ make
+ make install
+ ldd /var/tmp/ffmpeg/bin/ffmpeg
        linux-vdso.so.1 =>  (0x00007fffaa359000)
        libswscale.so.0 => /var/tmp/ffmpeg/lib/libswscale.so.0 (0x00007ff9ac5f9000)
        libavdevice.so.52 => /var/tmp/ffmpeg/lib/libavdevice.so.52 (0x00007ff9ac3f4000)
        libavformat.so.52 => /var/tmp/ffmpeg/lib/libavformat.so.52 (0x00007ff9ac13b000)
        libavcodec.so.52 => /var/tmp/ffmpeg/lib/libavcodec.so.52 (0x00007ff9ab61a000)
        libavutil.so.49 => /var/tmp/ffmpeg/lib/libavutil.so.49 (0x00007ff9ab40b000)
        libm.so.6 => /lib/libm.so.6 (0x00007ff9ab188000)
        libc.so.6 => /lib/libc.so.6 (0x00007ff9aae35000)
        libavutil.so.50 => /var/tmp/ffmpeg/lib/libavutil.so.50 (0x00007ff9aac24000)
        /lib64/ld-linux-x86-64.so.2 (0x00007ff9ac819000)

Please note that libavutil is listed *twice* here. The first time with
libavutil.so.49 (that's coded in the FFmpeg binary) and the time with
libavutil.so.50, because that's what the new libavcodec.so.52 needs.

Interestingly, the binary doesn't fail to load:

+ /var/tmp/ffmpeg/bin/ffmpeg -version
FFmpeg version 0.5, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration: --enable-shared --disable-static --prefix=/var/tmp/ffmpeg/ --enable-swscale --enable-ffmpeg
  libavutil     49.15. 0 / 49.15. 0
  libavcodec    52.20. 0 / 52.42. 0
  libavformat   52.31. 0 / 52.39. 2
  libavdevice   52. 1. 0 / 52. 2. 0
  libswscale     0. 7. 1 /  0. 7. 2
  built on Nov 28 2009 20:57:57, gcc: 4.3.2
FFmpeg 0.5
libavutil     49.15. 0 / 49.15. 0
libavcodec    52.20. 0 / 52.42. 0
libavformat   52.31. 0 / 52.39. 2
libavdevice   52. 1. 0 / 52. 2. 0
libswscale     0. 7. 1 /  0. 7. 2

I'm now a bit confused. From the ldd output and from thinking on it I
believe that the dynamic loader will load both versions of libavutil.
Furthermore, I believe that the because libavutil.so.50 comes later in
the list, it will shadow all symbols that are named identically in
libavutil.so.49, while non identical symbols remain accessible.  This is
probably going to make problems as soon as some application is using the
old fifo implementation from libavutil.so.49 but uses symbols from
libavutil.so.50.

Is my analysis correct? If yes, you can imagine that the shown testcase
is exactly what happens in a distro setting. Media players have been
built against FFmpeg 0.5, and upgrading FFmpeg packages will change the
system in a very similar way as described here. How can the problem
described in my mail avoided in an *elegant* way?

In case it helps and/or someone wants to reproduce the problems, I've
uploaded my testscript and the full buildlog here:

http://wiki.tauware.de/~siretart/ffmpeg/.

-- 
Gruesse/greetings,
Reinhard Tartler, KeyID 945348A4




More information about the ffmpeg-devel mailing list