20121107——移植madplay到arm开发板

来源:互联网 发布:sae网络的边界网关 编辑:程序博客网 时间:2024/06/06 18:49

转自:移植madplay到arm开发板


<--! 强烈建议不要在虚拟机挂接Windows共享目录下进行编译 -->

1.配置编译环境
 
  首先,将要使用的交叉编译器设为默认交叉编译器
  然后,在libid3tag-0.15.1b、libmad-0.15.1b、madplay-0.15.2b、zlib-1.2.3这四个文件夹的同一目录建一个文件夹(例如libz),作为存放所生成文件的地方。

  以下用目录/root/madplayer/libz 作为例子,

2.编译zlib-1.2.3

   ./configure --prefix=/root/madplayer/libz
 
   打开生成的Makefile, (没有CC等options...)

   修改CC(例如cc=arm-linux-gcc)
   修改AR(例如AR=arm-linux-ar rcs)
   修改RANLIB (例如RANLIB=arm-linux-ranlib)
  
   如果之前编译过,先 make distclean 把上次的编译结果清除
  
   make
   make install

3.编译libid3tag-0.15.1b
  
  首先,zlib-1.2.3编译完成后,才能进行此编译
 
  ./configure --prefix=/root/madplayer/libz --host=arm-linux --disable-shared CC=arm-linux-gcc
  CPPFLAGS=-I/root/madplayer/libz/include LDFLAGS=-L/root/madplayer/libz/lib

  (欲知上述options详情 请./configure --help)

   make
   make install

4.编译libmad-0.15.1b
 
  ./configure --prefix=/root/madplayer/libz CC=arm-linux-gcc --host=arm-linux --disable-shared
  
  make
  make install

5.编译madplay-0.15.2b

  ./configure --prefix=/root/madplayer/libz CC=arm-linux-gcc --host=arm-linux --disable-shared --enable-static
  CPPFLAGS=-I/root/madplayer/libz/include LDFLAGS=-L/root/madplayer/libz/lib

  make 在madplay-0.15.2b目录下面生成madplay的可执行文件

7.编译中,可能遇到的问题:
 
  error: libz 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 LDFLAGS

  *** environment variable to specify its installed location, e.g. -L

.

  没有正确配置编译好zlib,参考步骤2。(如仍未通过,请查看是否使用Windows共享的目录,若是,换到其他本地目录再试)

  最后编译出来的mdaplay 在开发板上运行时出现如下所示的提示:

  madplay: error while loading shared libraries: cannot open shared object file: cannot load sharedobject file: No such file or directory

  则是因为在编译时没有设置好静态链接和共享库,正确的配置就是在编译libid3tag、libmad 和madplay 时,加上disable-shared 选项,同时(只)在madplay 的配置语句上加上enable-static设置为静态。

原创粉丝点击