您的位置:首页 > 其它

移植madplay到arm开发板

2014-01-14 11:24 417 查看
这篇文章写的很全,没什么好改的了。

按照上面做肯定能成功的,但是要注意目录的问题,记得自已的目录别搞错了。

 

转自:http://blog.163.com/kang_6530/blog/static/7219155720090525649537/

 

<--! 强烈建议不要在虚拟机挂接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设置为静态。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: