Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1336782
  • 博文数量: 198
  • 博客积分: 1629
  • 博客等级: 上尉
  • 技术积分: 2743
  • 用 户 组: 普通用户
  • 注册时间: 2011-08-01 15:41
文章分类
文章存档

2023年(6)

2022年(20)

2021年(8)

2020年(3)

2018年(17)

2017年(3)

2016年(3)

2015年(9)

2014年(13)

2013年(17)

2012年(77)

2011年(22)

分类:

2012-12-26 09:58:44

原文地址:madplay 移植 作者:chockly

*********************************************************************
良 好的习惯是成功的开始。
EMail:cblock@126.com
QQ:57004294
*********************************************************************
))))*****madplay 的移植*******2009/09/23*******Fegus Zeng*********((((
*********************************************************************
tool version:
   arm-linux-gcc 4.4.3
   redhat9.0
   TQ2440 ARM9开发板

software version:
   libid3tag-0.15.1b.tar.gz
   libmad-0.15.1b.tar.gz
   zlib-1.2.3.tar.gz
   madplay-0.15.2b.tar.gz
*********************************************************************
1. 首先建立移植目录树
  一般结构如下:
   ---madplay
          |------libs     (存放库源码目录)
          |------output   (存放对应平台移植后的程序)
          |        |---arm-linux
   |    |---X86  
          |------docs   (存放移植文档)
          |------project  (存放其他工程文件,如source insight工程)
*********************************************************************
2. 解压库源码包到libs下,解压主程序源码包到madplay下即可。
   #tar zxvf libid3tag-0.15.1b.tar.gz
   #tar zxvf libmad-0.15.1b.tar.gz
   #tar zxvf zlib-1.2.3.tar.gz
   #cd ..
   #tar zxvf madplay-0.15.2b.tar.gz
*********************************************************************
3. 开始编译库
注意:每次configure之前请运行./configure --help
****************************************
a.) 移植zlib库
   # cd libs/zlib-1.2.3/
   #./configure --prefix=/arm/madplay/output/ --shared
   生成Makefile,修改Makefile如下变量:
   CROSS=arm-linux-
   CC=${CROSS}gcc
   LDSHARED=${CROSS}gcc -shared -Wl,-soname,libz.so.1
   CPP=${CROSS}gcc -E
   AR=${CROSS}ar rc
   RANLIB=${CROSS}ranlib
   保存退出,
   #make
   #make install
   若发现目录设置有误,可使用make uninstall撤销安装,make distclean,make clean撤销编译
****************************************
b.)移植libid3tag
    ./configure --prefix=/arm/madplay/output/ --host=arm-linux --enable-shared --enable-static
****************************************
c.) 移植libmad
****************************
第一次尝试--->失败:
    ./configure --prefix=/arm/madplay/output/ --host=arm-linux --enable-shared --enable-static
   make后出现以下错误:
   cc1: error: unrecognized command line option "-fforce-mem"
   make[2]: *** [version.lo] Error 1
   make[2]: Leaving directory `/arm/madplay/libs/libmad-0.15.1b''
   make[1]: *** [all-recursive] Error 1
   make[1]: Leaving directory `/arm/madplay/libs/libmad-0.15.1b''
   make: *** [all] Error 2
****************************
第 二次尝试-->成功
分析原因:编译器不支持该选项-fforce-mem
对策:查找Makefile中"fforce-mem", 将其删除,再试:
CFLAGS = -Wall -g -O -fforce-mem -fforce-addr -fthread-jumps -fcse-follow-jumps -fcse-skip-blocks -fexpensive-optimizations -fregmove -fschedule-insns2 -fstrength-reduce
在Makefile 129行,删除"-fforce-mem".
  #make
  #makeinstall

*********************************************************************
4. 开始编译madplay
****************************************
 第一次尝试---> 失败:
./configure --prefix=/arm/madplay/output/ --host=arm-linux
configure 出错:
configure: error: mad.h was not found
*** You must first install libmad before you can build this package.
*** If libmad is already installed, you may need to use the CPPFLAGS
*** environment variable to specify its installed location, e.g. -I

.
****************************************
第 二次尝试--->失败:
分析原因:没有找到头文件
对策:加入头文件目录,修改CPPFLAGS参数,再试:
./configure --prefix=/arm/madplay/output/ --host=arm-linux CPPFLAGS=-I/arm/madplay/output/include
configure出错:
configure: error: libmad was not found
*** You must first install libmad before you can build this package.
*** If libmad is already installed, you may need to use the LDFLAGS
*** environment variable to specify its installed location, e.g. -L.
****************************************
第 三次尝试--->成功:
分析原因:没有找到库文件
对策:加入库文件目录,修改LDFLAGS参数,再试:
./configure --prefix=/arm/madplay/output --host=arm-linux --disable-shared CPPFLAGS=-I/arm/madplay/output/include LDFLAGS=-L/arm/madplay/output/lib
 成 功生成Makefile
 #make
 #makefile
*********************************************************************
5. 测试:
  ./madplay test.mp3
 
  如果不能运行,请检查:
  a.)是否缺少动态链接库,并指定正确路径.
     export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:(*.so路径)
  b.)arm-linux-gcc 版本是否与你的系统兼容.
  c.)可执行文件是否损坏,如strip工具是否不是用的arm-linux-strip.
  d.)编译器用错成X86平台的,可用#file madplay 确认一下.
*********************************************************************


阅读(1803) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~