您的位置:首页 > Web前端

在Fedora12上安装madplayer过程以及产生问题的解决

2011-06-02 21:36 627 查看
 

在Fedora12上安装madplayer过程以及产生问题的解决

 

1. 安装libid3tag

2. 安装libmad

3. 安装madplay

 

************************************************************************

1.安装libid3tag (libid3tag-0.15.1b.tar.gz)

1.1 解压 tar xvzf libid3tag-0.15.1b.tar.gz (解压到当前的目录)

1.2 配置 ./configure (采用默认的配置) 产生Makefile文件

1.3 编译 make 

1.4 安装 make install

1.5 安装后库文件在/usr/local/lib

 

2.安装libmad音频解码库 (libmad-0.15.1b.tar.gz)

2.1 解压 tar xvzf libmad-0.15.1b.tar.gz (解压到当前的目录)

2.2 配置 ./configure (采用默认的配置,动态链接库) 产生Makefile文件

2.3 检测 make check, 发现-fforce -mem 错误

打开Makefile文件,找到-fforce -mem 删除,保存。(这个步骤很重要,如果不删除-fforce -mem的话,则无法安装成功)

原因: gcc 3.4 或者更高版本,已经将其去除了,所以会出现上面的错误!

(Compiling libmad with gcc 3.4 or higher will produce the following error: cc1: error: unrecognized command line

option “-fforce-mem”. The build option “-fforce-mem” has been kicked out of gcc, so you need to alter the 

makefile (just vi Makefile after you have configured, hit “/” to search for the entry and delete it))

 

2.4 编译 make

2.5 安装 make install

2.6 安装后库文件在/usr/local/lib

 

注意:如果要重新安装libmad的话,则要先卸载libmad. 

方法:进入libmad源目录(libmad-0.15.1b),执行make uninstall,然后make clean。最后按照2.1到2.5的步骤重新安装。

 

3.安装madplay

3.1 解压 tar xvzf madplay-0.15.2b.tar.gz (解压到当前目录)

3.2 配置 ./configure

3.3 编译 make

3.4 安装 make install

3.5 安装后可执行文件在/usr/local/bin (用which命令可以知道)

 

*******************************************************************************************

安装成功后,运行madplay,这个时候出现问题了。

 

问题1: 

madplay: error while loading shared libraries: libmad.so.0: cannot open shared object file: No such file or directory

运行madplay后,提示找不到动态链接库libmad.so.0

 

解决方法:(from: http://www.linuxquestions.org/questions/linux-newbie-8/problem-in-using-madplay-713341/)
After make install you have to configure the dynamic linker to find the newly install libraries at run-time. Look under /etc/ld.so.conf.d/, there are all kind of *.conf files there which contain lists of directories where the dynamic linker looks for libraries. Your libraries are probably in /usr/local/lib (check it) so you have to create a *.conf file or add a line to one of the existing files if your directory isn't already listed anywhere. Then you have to run the command 'sudo /sbin/ldconfig' to update the dynamic linker's cache and your app should work.

 

原因是刚刚生成的动态链接库没有被链接到。所以要配置动态链接器来找到刚刚安装好的动态链接库。

在/etc/ld.so.conf.d/目录下,有*.conf的文件,里面包含了动态链接库的列表,所以我们也要在这里添加libmad.so.0的路径。

方法一:在其中一个文件添加libmad.so.0的路径。

方法二:创建一个.conf文件,然后在里面添加libmad.so.0的路径。

我这里采用方法二,创建libmad.conf,里面添加/usr/local/lib。

最后,执行sbin/ldconfig来更新动态链接器的动态链接库表。

这样,问题一就成功解决了。

 

问题2:

运行madplay后,提示找不到/dev/dsp

 

解决方法:(from: http://1.1.14.blog.163.com/blog/static/7290142200881712012728/)
我们要知道/dev/dsp的major和minor和类型。安装Linux的源代码(以我的内核为例):

# apt-get install kernel-source-2.6.7

然后在/usr/src里面把内核源代码解开。

在/usr/src/kernel-source-2.6.7/Documentation/devices.txt找到/dev/dsp的相关信息:

 14 char        Open Sound System (OSS)

                                       ......

                  3 = /dev/dsp          Digital audio

那么

# mknod /dev/dsp c 14 3

如果普通用户对/dev/dsp没有足够权限,增加就可以了,例如

# chmod 666 /dev/dsp

这样/dev/dsp就回来了。

 

我的解决方法:

由于我没有源码树,所以我就没有查看devices.txt的类型。

直接进入/dev目录,执行mknod dsp c 14 3,然后查看一下,dsp就有了。

问题解决。

 

最后,运行madplay hello.mp3,就可以播放音乐了!O Yeah.

 

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息