adplayer移植【转】

本文转载自:https://blog.csdn.net/qq361294382/article/details/50525412

这两天做madplayer移植,由于是刚装的ubuntu14.04,所以有好多库没装,还有其它未配置起来的地方,搞起来有几个问题,不过组后按着教程一步一步都解决了。

首先需要准备的安装包如下:

madplay-0.15.2b.tar.gz

libmad-0.15.1b.tar.gz
libid3tag-0.15.1b.tar.gz 

zlib-1.1.4.tar.gz

前三个包地址:http://sourceforge.net/project/showfiles.php?group_id=12349

第四个包zlib地址:http://www.gzip.org/zlib/zlib-1.1.4.tar.gz中找到。

我的所有库和头文件都安装在目录:/work/drivers_and_test/21th_sound/app/tmp里面,用到的4个包都解压在/work/drivers_and_test/21th_sound/app/目录下,可以自己根据自己需要建立自己的安装目录。

1.安装zlib

tar xvzf zlib-1.2.5.tar.gz 
cd zlib-1.2.3.tar.gz

./configure --host=arm-linux --prefix=/work/drivers_and_test/21th_sound/app/tmp,生成Makefile文件,

再修改makefile文件,添加自己系统中gcc所在的目录,有的不需要修改:
CC=/work/tools/gcc-3.4.5-glibc-2.3.6/bin/arm-linux-gcc
AR=/work/tools/gcc-3.4.5-glibc-2.3.6/bin/arm-linux-ar rcs
RANLIB=/work/tools/gcc-3.4.5-glibc-2.3.6/bin/arm-linux-ranlib

注:如果之前编译过,则先要把上次编译的结果清除:make distclean

接着 make
然后make install
编译好之后就可以在上面prefix指定的目录/work/drivers_and_test/21th_sound/app/tmp下的lib目录下找到libz.a这个库。

2.编译libid3tag

在libid3tag目录下执行以下操作就可以安装libid3tag库

./configure --host=arm-linux --prefix=/work/drivers_and_test/21th_sound/app/tmp CPPFLAGS=-I/work/drivers_and_test/21th_sound/app/tmp/include LDFLAGS=-L/work/drivers_and_test/21th_sound/app/tmp/lib
make 
make install

解释:CC后 的参数为交叉编译器的绝对路径,--prefix后指定的是安装目录,CPPFLAGS、LDFLAGS
后的-I、-L为固定形式,之后的路径为安装libid3tag的路径下的子目录。我一开始没有加CPPFLAGS、LDFLAGS,

有错误提示:

configure: error: zlib.h was not found
*** You must first install zlib (libz) before you can build this package.
*** If zlib is already installed, you may need to use the CPPFLAGS
*** environment variable to specify its installed location, e.g. -I<dir>.

可能是没有在tmp目录下生成所需的库,加上-I、-L后就没这问题了。

3.编译libmad

在libmad目录下执行以下操作就可以安装libid3tag库

./configure --host=arm-linux --prefix=/work/drivers_and_test/21th_sound/app/tmp CPPFLAGS=-I/work/drivers_and_test/21th_sound/app/tmp/include LDFLAGS=-L/work/drivers_and_test/21th_sound/app/tmp/lib
make 
make install

如果有提示:"-fforce-mem"参数不能识别,打开当前目录下的Makefile文件,去掉里面出现的"-fforce-mem",然后再make,make install就OK了。

4.编译madplay
./configure --host=arm-linux --prefix=/work/drivers_and_test/21th_sound/app/tmp CPPFLAGS=-
I/work/drivers_and_test/21th_sound/app/tmp/include LDFLAGS=-L/work/drivers_and_test/21th_sound/app/tmp/lib
然后,make
这样就生成了madplay可执行文件,下载到板子上去就可以使用了。

原文地址:https://www.cnblogs.com/zzb-Dream-90Time/p/9570939.html