madplay移植

http://hi.baidu.com/firefly007/blog/item/c57bf65719eb48d5b645ae36.html

1、解压源代码包
# cd madplay
# for f in $(ls *.tar.gz); do tar -zxvf $f ; done

2、编译madplay及其所依赖的库文件

(1)设定编译器环境变量
# export CC=arm-linux-gcc

(2)编译zlib,因为libid3tag依赖于这个库文件
# cd  zlib-1.2.3
# ./configure --prefix=/opt/madplay/madplay
# make
# make install
或者:
打开/opt/madplay/zlib-1.2.3
目录下的Makefile文件,按以下内容修改并保存:
CC=arm-linux-gcc
AR=arm-linux-ar rcs
RANLIB=arm-linux-ranlib
prefix=/opt/madplay/target-arm

然后make,make install,编译好之后就可以在上面prefix指定目录下的lib目录下找到libz.a这个库。

(3)编译libid3tag
# cd ../libid3tag-0.15.1b
# ./configure --host=arm-linux --prefix=/opt/madplay/mad --disable-debugging --disable-shared --enable-static CPPFLAGS=-I/opt/madplay/mad/include LDFLAGS=-L/opt/madplay/mad/lib 
 --host=arm-linux 
# make
# make install

(4)编译libmad
# cd ../libmad-0.15.1b
# ./configure --host=arm-linux --prefix=/opt/madplay/mad --disable-debugging --disable-shared --enable-static CPPFLAGS=-I/opt/madplay/mad/include LDFLAGS=-L/opt/madplay/mad/lib 
 --host=arm-linux 
# make
# make install

(5)编译madplay
# cd ../madplay-0.15.2b
# ./configure --host=arm-linux --prefix=/opt/madplay/mad --disable-debugging --disable-shared --enable-static CPPFLAGS=-I/opt/madplay/mad/include LDFLAGS=-L/opt/madplay/mad/lib --host=arm-linux
# make
# make install

但是,这样得到的是动态链接。其中abxtest是附加生成的测试程序,不必理会。

使用file命令检查一下:
# file /opt/madplay/target-arm/bin/madplay
madplay: ELF 32-bit LSB executable, ARM, version 1, for GNU/Linux 2.4.3, dynamically linked (uses shared libs), not stripped

arm-linux-readelf -d madplay
可以知道需要的动态库
Dynamic section at offset 0x3900c contains 25 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [libm.so.6]
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]




你可能感兴趣的:(c,测试,File,library,makefile,编译器)