刚刚开始,下决心学习linux,所以找出大学时候就购买的mini2440 拿出来折腾。按照手册一路模仿学习,其中出现不少问题,也都一个一个解决了。可惜那时候没有想来,记录这个过程。这次在学习到手册的第六章6.5嵌入式程序移植实例的时候出现了问题。看如下图:target-x86 里面,我一直都没得到 原来的库文件。这篇《友善之臂 madplayer 移植过程补充 》也出现过类似的或者说一模一样的问题,把问题解决了,更重要的是分析出来。问题一:仔细一看,出现的错误:configure: error: zlib.h was not found *** You must first install zlibz(libz) 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<dir>.然后我网上查找之后 得知 是缺少了zlib这个库,所以网上找到 zlib-1.2.3.tar.gz 放在Ubuntu里面安装,然后编译libid3tag 这个文件,ok顺利通过了。问题二:接下来libmad文件出现问题报错是:cc1: error: unrecognized command line option "-fforce-mem" make[2]: *** [version.lo] Error 1 make[2]: Leaving directory `/opt/FriendlyARM/mini2440/madplay/src-x86/libmad-0.15.1b" make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/opt/FriendlyARM/mini2440/madplay/src-x86/libmad-0.15.1b" make: *** [all] Error 2 百度了一下,原因是GCC3.4以上已经没有-fforce-mem选项,找到相应的makefile,将该选项删除就OK了!具体是:CFLAGS = -Wall -march=i486 -g -O -fforce-mem -fforce-addr -fthread-jumps -fcse-follow-jumps -fcse-skip-blocks -fexpensive-optimizations -fregmove -fschedule-insns2 -fstrength-reduce修改为CFLAGS = -Wall -march=i486 -g -O问题三:编译安装madplay 出现如下问题:checking for sys/soundcard.h... yes checking machine/soundcard.h usability... no checking machine/soundcard.h presence... no checking for machine/soundcard.h... no checking mad.h usability... no checking mad.h presence... no checking for mad.h... no 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<dir>. 根据手册 得知这是一个环境变量的问题还有要输进去的“--CPPFLAGS” “--LDFLAGS” 把前面的“--”去掉就好了。到这里应该就没有什么问题了。root@ubuntu:/opt/FriendlyARM/mini2440/madplay# cd target-x86/ root@ubuntu:/opt/FriendlyARM/mini2440/madplay/target-x86# ls bin include lib man share root@ubuntu:/opt/FriendlyARM/mini2440/madplay/target-x86# ls bin abxtest madplay root@ubuntu:/opt/FriendlyARM/mini2440/madplay/target-x86#