After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 763940 - 'configure' using system libav always fails with "Uncompatible libavcodec found"
'configure' using system libav always fails with "Uncompatible libavcodec found"
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-libav
1.7.91
Other Linux
: Normal normal
: 1.8.0
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-03-20 13:43 UTC by Egor Zaharov
Modified: 2016-03-21 11:38 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch (798 bytes, patch)
2016-03-20 13:43 UTC, Egor Zaharov
committed Details | Review

Description Egor Zaharov 2016-03-20 13:43:25 UTC
Created attachment 324361 [details] [review]
Patch

Output from configure:
  checking for LIBAV... yes
  checking for SWSCALE... yes
  checking avi.h usability... no
  checking avi.h presence... no
  checking for avi.h... no
  configure: Using system-installed libav code
  checking whether libav is provided by FFmpeg... no
  configure: error: Uncompatible libavcodec found

Checked configure.ac and found what it checks version based on <libavcodec/avcodec.h>, and checking LIBAVCODEC_VERSION_MICRO >= 100.

But this is ffmpeg 3.0:
  [nexfwall@VPCYB1S1R-OS00 RPMBuild]$ grep "LIBAVCODEC_VERSION_MICRO" /usr/include/ffmpeg/libavcodec/version.h
  #define LIBAVCODEC_VERSION_MICRO 102

Also found, what it saves CPPFLAGS to a var, and then appends libav pkg-config flags. But restore them before checking libavcodec version:
...
  PKG_CHECK_MODULES(SWSCALE, libswscale libavutil)
  saved_CPPFLAGS="$CPPFLAGS"
  CPPFLAGS="$CPPFLAGS $LIBAV_CFLAGS"
  AC_CHECK_HEADERS([avi.h])
  CPPFLAGS="$saved_CPPFLAGS"
  AC_DEFINE([LIBAV_SOURCE], ["system install"], [Describes where the Libav libraries come from.])
...

But it should restore it only after checking libav provider version. After this:
...
  AC_LINK_IFELSE([AC_LANG_PROGRAM([[
    #include <libavcodec/avcodec.h>
    ]],[[
        #if LIBAVCODEC_VERSION_MICRO >= 100
        /* FFmpeg uses 100+ as its micro version */
        #else
        #error libav provider should be FFmpeg
        #endif
    ]])], [is_ffmpeg=yes], [is_ffmpeg=no])
  AC_MSG_RESULT([$is_ffmpeg])
...

So here is the patch. Now configure runs properly.
Comment 1 Sebastian Dröge (slomo) 2016-03-20 21:42:44 UTC
This was introduced by bug #758183. Apparently the ffmpeg and libav people decided back then that libav will have MICRO>=100 and ffmpeg takes the ones before... and now ffmpeg broke that. Great!

Reynaldo, what is the correct way to check for this nowadays?
Comment 2 Sebastian Dröge (slomo) 2016-03-21 08:39:33 UTC
https://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavcodec/version.h;h=6e42810765c3403a556a7946ace70e37e1fffe07;hb=HEAD#l32
https://git.libav.org/?p=libav.git;a=blob;f=libavcodec/version.h;h=d5045fb2caad425a5c6bc3004ec05d0807f24b3e;hb=HEAD#l32

It's actually the other way around, and the way it is currently. FFMPEG >= 100, libav < 100. So all good


commit 6ca5f88ddefed16a017e4c4b6543281da2577557
Author: Egor Zaharov <nexfwall@yandex.ru>
Date:   Sun Mar 20 13:43:00 2016 +0000

    configure: Restore CPPFLAGS after the last check
    
    The next checks can also set CPPFLAGS.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=763940
Comment 3 Egor Zaharov 2016-03-21 11:35:07 UTC
(In reply to Sebastian Dröge (slomo) from comment #1)
> This was introduced by bug #758183. Apparently the ffmpeg and libav people
> decided back then that libav will have MICRO>=100 and ffmpeg takes the ones
> before... and now ffmpeg broke that. Great!

Yes. They did'nt really broke that. Just configure drops pkg-config flags, necessary for including 'libavcodec/version.h'.

Thank you for merging my little patch.
Comment 4 Sebastian Dröge (slomo) 2016-03-21 11:38:07 UTC
Yeah I was confused first :) Thanks for your patch (should've also updated the commit message a bit, it's confusing now).