MOC crashes opening FLAC files

Forums:

Hi, I noticed the behavior this week.
When I open a FLAC file then MOC crashes with the message:
------------
$> mocp
FATAL_ERROR: Can't receive value from the server!
$> echo $?
2
------------

In the syslog appears this:
------------
kernel: [ 8826.777981] traps: mocp[9286] general protection ip:7fa202480f3e sp:7fa1f91939b0 error:0 in libavutil.so.52.66.100[7fa202470000+3e000]
------------

With gdb nothing interesting:
------------
[Inferior 1 (process 6408) exited with code 02]
------------

Obviusly the problem is with the libavutil package. I've Debian testing but with the deb-multimedia repos then libav really is a simlink to the ffmpeg package (which I prefer).

Something with the same problem or it is a mess with the libraries in my computer?

You're going to have to work a little harder to convince me this is a problem within MOC. As a first step I'd suggest trying to play a file using ffplay. If it also crashes then we can close off the problem and refer it to the FFmpeg folk.

First of all, sorry for the long delay in my response. Last weeks were very busy to me.

I already figured that the fault wasn't in MOC but I was wandering if someone was suffering the same behavior in Debian and fixed it.

Today I faced the problem (I missed MOC so much) and find that have installed 2 versions of the package libavutil:

  • libavutil52, provided by the repository deb-multimedia and linked to ffmpeg
  • libavutil53, provided by the official debian repository, linked to libav and required by moc-ffmpeg-plugin

With lsof I found the libraries involved in /usr/lib/x86_64-linux-gnu/:
----------------------
$> ls -l libavutil*
lrwxrwxrwx 1 root root 22 Xuñ 23 20:00 libavutil.so.52 -> libavutil.so.52.66.100
-rw-r--r-- 1 root root 277448 Xuñ 23 20:00 libavutil.so.52.66.100
lrwxrwxrwx 1 root root 19 Xuñ 28 15:51 libavutil.so.53 -> libavutil.so.53.3.0
-rw-r--r-- 1 root root 152312 Xuñ 28 15:51 libavutil.so.53.3.0
----------------------

MOC uses libavutil.so.53 and, in my computer, then crashes with FLAC files.
If I linked libavutil.so.53 to libavutil.so.52.66.100 (ffmpeg library) then MOC works well so I did this dirty hack.

But it's strange that MOC doesn't work now with the debian libav package, maybe it's an inconsistency with the libraries in my computer...

I can now see what I think you've done and which is probably the cause of your grief.

You have both FFmpeg (libavutil.so.52) and LibAV (libavutil.so.53) installed. MOC is linked to libavutil.so.53 (LibAV). All that you already know.

I'm not quite sure of the exact details, but what's probably happening is that you're getting a mismatch of LibAV and FFmpeg libraries being loaded. Linking libavutil.so.53 to libavutil.so.52.66.100 is resolving that mismatch. (Read the section "7.2 Libtool's Versioning System" in the libtool info documentation for further information.)

You could check the exact situation by running MOC with strace(1) or using ldd(1) on MOC's FFmpeg decoder plug-in and those will show you the specific libraries being loaded.

Certainly I regularly build and run MOC against both FFmpeg and LibAV (at various versions) and the Debian's MOC package maintainer also tests against LibAV, so I believe the problem does lie with library inconsistancy on your system. By design different versions of libraries can co-exist on Linux systems, but when two different packages use the same library names then the version resolution mechanisms can't be expected to apply. My advice is to use one or the other but not both.

> By design different versions of libraries can co-exist on Linux systems, but when two different packages use the same library names then the version resolution mechanisms can't be expected to apply. My advice is to use one or the other but not both.

Sure, I think the same but months ago MOC and blender started to require libavutil53 and that package isn't at the deb-multimedia repo which is the only I try to manage to media libraries.

So I will have to live with this inconsistancy until versions equal in both repositories, a minor issue compared to the possibility of enjoying the awesome MOC ;-)

jcf, thanks for your time and your work.

One approach that might work for you is to preload all the FFmpeg libraries before executing MOC, so it would look something like this:

<br /> LD_PRELOAD="/path/to/ffmpeg/libs/libav*.so" mocp<br />

Of course, you will want to wrap that up in a script for ease of use. It assumes that the ABI for FFmpeg libraries is compatible with that of LibAV.

See the ld.so(8) manpage for additional information.

Thanks for the advice, I'll test it.
It would be useful for sure when the library will upgrade and problems will come ;-)