x42 / silan

audio file [silence] analyzer
GNU General Public License v2.0
39 stars 8 forks source link

Segmentation fault on Debian Squeeze when analyzing m4a file #2

Closed mkonecny closed 11 years ago

mkonecny commented 11 years ago

Step 1: Ensure your environment is Debian Squeeze

Step 2: Download any m4a file:

wget http://www.morrisontrio.com/resources/Morrison%20Trio%20Sample%20-%20Air%20by%20J.S.%20Bach.m4a

Step 3: analyze with -b and -f json parameters.

Output: Segmentation fault

x42 commented 11 years ago

Could you create a backtrace?

gdb --args  silan -b -f json ....

(gdb) run
   [.. crash...]
(gdb)  thread apply all bt

Chances are that it's an issue w/ libav* that comes with debian in particular the 'aac' decoder of it. I highly recommend to use ffmpeg-1.2 from ffmpeg.org

mkonecny commented 11 years ago
Reading symbols from /usr/bin/silan...(no debugging symbols found)...done.
(gdb) run
Starting program: /usr/bin/silan -b -f json Morrison\ Trio\ Sample\ -\ Air\ by\ J.S.\ Bach.m4a
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0xb7a58a85 in ?? () from /usr/lib/i686/cmov/libavcodec.so.52
(gdb) thread apply all bt

Thread 1 (Thread 0xb6f116d0 (LWP 20055)):
#0  0xb7a58a85 in ?? () from /usr/lib/i686/cmov/libavcodec.so.52
#1  0x0804b8b4 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
(gdb) 
x42 commented 11 years ago

right. ffmpeg/libav problem.

I'm about to prepare a statically linked binary (using ffmpeg-1.2) instead of distribution provided libavcodec.

mkonecny commented 11 years ago

This may be a Debian package issue as well.

Before

$ sudo dpkg -l | grep libav
ii  libavcodec52                       4:0.5.10-1                        ffmpeg codec library
rc  libavdevice52                      4:0.5.10-1                        ffmpeg device handling library
rc  libavfilter0                       4:0.5.10-1                        ffmpeg video filtering library
ii  libavformat52                      4:0.5.10-1                        ffmpeg file format library
ii  libavutil49                        4:0.5.10-1                        ffmpeg utility library
rc  libpostproc51                      4:0.5.10-1                        ffmpeg video postprocessing library
rc  libswscale0                        4:0.5.10-1                        ffmpeg video scaling library

using debian squeeze backports

$ sudo dpkg -l | grep libav
ii  libav-tools                        6:0.8.5-1~bpo60+1                 Multimedia player, server, encoder and transcoder
ii  libavcodec53                       6:0.8.5-1~bpo60+1                 Libav codec library
ii  libavdevice53                      6:0.8.5-1~bpo60+1                 Libav device handling library
ii  libavfilter2                       6:0.8.5-1~bpo60+1                 Libav video filtering library
ii  libavformat53                      6:0.8.5-1~bpo60+1                 Libav file format library
ii  libavutil51                        6:0.8.5-1~bpo60+1                 Libav utility library

I had to remove all the old libav packages manually since they were allowed to co-exist alongside the new backports. However this also uninstalled silan. So i go to install silan again:

sudo apt-get install silan
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libavcodec52 libavformat52 libavutil49
The following NEW packages will be installed:
  libavcodec52 libavformat52 libavutil49 silan
0 upgraded, 4 newly installed, 0 to remove and 8 not upgraded.
Need to get 0 B/4,833 kB of archives.
After this operation, 12.9 MB of additional disk space will be used.
Do you want to continue [Y/n]? 

It insists on using the old packages.

x42 commented 11 years ago

In that case you (or the packager) will need to re-build silan against the new libav*. ffmpeg/libav is not ABI compatible. An application will only work with the version of ffmpeg/libav that it was built with.

Anyway, give http://robin.linuxaudio.org/tmp/silan-i386-linux-gnu-v0.3.1-9-g817ff4c.tgz http://robin.linuxaudio.org/tmp/silan-x86_64-linux-gnu-v0.3.1-9-g817ff4c.tgz a try. it only requires libm.so.6, libdl.so.2, libpthread.so.0 and libc.so.6 -- IOW it will run on any reasonable GNU/Linux system since 2006.

mkonecny commented 11 years ago

Pardon my ignorance, since I haven't worked with Debian packages yet. I'm guessing the problem is libavcodec52 was the one available when the debian package was generated and so that's why 52 was hardcoded as a dependency.

Is it possible to make a Debian package more flexible in this regard?

mkonecny commented 11 years ago

OK, I will your new binaries a try, thx :)

x42 commented 11 years ago

libavcodec52 was used to link silan (when the package was created). The dependency of the packages comes from the binary itself.
Run ldd /some/binary (here ldd /usr/bin/silan) to get a list of libraries it requires.

The maintainer of the package will need to compile a new package...

mkonecny commented 11 years ago

Hey we wrote our messages at the same time so ignore that :).

I'm using your statically linked binary and it works perfectly. Is this a temporary link, or can I start sharing it?

x42 commented 11 years ago

They're temporary but will likely be around for a while..

I suggest to have Daniel (or whoever builds the debian packages of airtime these days) look into https://github.com/x42/silan/blob/master/x-pbuildstatic.sh -- this script creates those binaries.

The proper solution however is to file a bug report for debian/squeeze and have them sort out the issue.

mkonecny commented 11 years ago

When running silan against the libav packages from squeeze backports the issue is fixed. Closing this issue since it's not a silan bug.

Slightly off-topic: If Debian package maintainers knew that a package in the main apt repo segfaulted, would they move the entire package from backports into main? Or would they just backport the changeset which fixed the problem into main.