Tuesday, February 13, 2007

mpg123 install troubles in Debian Sarge

Today when installing mpg123 on a Debian/Sarge Linux machine, I encountered a complaint from aptitude that a dependency "oss-compat" was UNAVAILABLE and hence the package was broken.

To overcome this, I discovered that I had to alter a line in my /etc/apt/sources.list file:
deb http://security.debian.org/ stable/updates main contrib non-free


Instructions for adding this line come from the mpg123 page and the Debian errata.

After changing sources.list, I ran apt-get update. Good, this fixed the first problem, but then I ran into another one.

aptitude install mpg123=0.59r-20sarge1
...
Writing extended state information... 0%
Writing extended state information... Done
Setting up libxml-sax-perl (0.12-5) ...
Can't locate object method "save_parsers_debian" via package "XML::SAX" at /usr/bin/update-perl-sax-parsers line 90.
dpkg: error processing libxml-sax-perl (--configure):
subprocess post-installation script returned error exit status 255
dpkg: dependency problems prevent configuration of libxml-libxml-perl:
libxml-libxml-perl depends on libxml-sax-perl (>= 0.11); however:
Package libxml-sax-perl is not configured yet.
dpkg: error processing libxml-libxml-perl (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libxml-simple-perl:
libxml-simple-perl depends on libxml-sax-perl; however:
Package libxml-sax-perl is not configured yet.
libxml-simple-perl depends on libxml-libxml-perl | libxml-sax-expat-perl; however:
Package libxml-libxml-perl is not configured yet.
Package libxml-sax-expat-perl is not installed.
dpkg: error processing libxml-simple-perl (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
libxml-sax-perl
libxml-libxml-perl
libxml-simple-perl
E: Sub-process /usr/bin/dpkg returned an error code (1)
Ack! Something bad happened while installing packages...


To get more info:

aptitude search libxml|grep perl
...
u A libxml-libxml-perl - Perl module for using the GNOME libxml2 li
...
C A libxml-sax-perl - Perl module for using and building Perl SA
...
u libxml-simple-perl - Perl module for reading and writing XML

The "u" means "unpacked but not configured". The "C" means "half-configured: the package's configuration was interrupted". The "A" means "automatically installed". This turned out to be a red herring though. The problem was that there are several versions of XML::SAX only one of which has the required save_parsers_debian method:

find / -name SAX.pm -exec grep -H 'save_parsers_debian' {} \;
/usr/share/perl5/XML/SAX.pm:sub save_parsers_debian {


So clearly the perl path, determined by @INC, does not point to the version of SAX.pm which we need. Let's see what it is. Create a file sniff.pl which contains an error:

#!/usr/bin/perl
use sniff; # a non-existent package, so that perl will print @INC

and run it

perl sniff.pl
Can't locate sniff.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.8.4 /usr/local/share/perl/5.8.4 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at sniff.pl line 2.

Ah, /usr/share/perl5 is in the list but it is preceded by other directories, some of which contain a different version of XML::SAX. Let's promote it to the top of the path:

export PERL5LIB=/usr/share/perl5/
perl sniff.pl
Can't locate sniff.pm in @INC (@INC contains: /usr/share/perl5/ /etc/perl /usr/local/lib/perl/5.8.4 /usr/local/share/perl/5.8.4 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at sniff.pl line 2.

Notice how the path has changed. Now we try the install again:

aptitude install mpg123=0.59r-20sarge1
...
mpg123

High Performance MPEG 1.0/2.0/2.5 Audio Player for Layer 1, 2 and 3.
Version 0.59r (1999/Jun/15). Written and copyrights by Michael Hipp.
Uses code from various people. See 'README' for more!
THIS SOFTWARE COMES WITH ABSOLUTELY NO WARRANTY! USE AT YOUR OWN RISK!

Great, it works!

0 Comments:

Post a Comment

<< Home