mp3播放器madplay移植过程发生错误
在配置libid3tag-0.15.1b,错误信息(一):
checking zlib.h usability... no
checking zlib.h presence... no
checking for zlib.h... no
configure: error: zlib.h 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 CPPFLAGS
*** environment variable to specify its installed location, e.g. -I<dir>.
从上面的错误信息提示,可以知道要安装zlib库。
解决办法:
1、下载zlib-1.2.3.tar.gz,然后解压:tar xjf zlib-1.2.3.tar.gz
2、在zlib-1.2.3目录下执行:./configure --prefix=/work/drivers/21th_sound/app/tmp
3、make && make install
4、zlib安装成功
5、然后在libid3tag-0.15.1b执行:./configure --host=arm-linux --prefix=/work/drivers/21th_sound/app/tmp
6、如果使用上面的命令还显示错误,则执行:./configure --host=arm-linux --prefix=/work/drivers/21th_sound/app/tmp CPPFLAGS=-I/work/drivers/21th_sound/app/tmp/include LDFLAGS=-L/work/drivers/21th_sound/app/tmp/lib
在配置madplay-0.15.2b,错误信息(二)
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>.
从上面的错误信息,可以知道缺少头文件mad.h。
解决办法:
1、缺少mad.c文件,加上之,注意加上CPPFLAGS标志-I
执行:./configure --host=arm-linux --prefix=/work/drivers/21th_sound/app/tmp CPPFLAGS=-I/work/drivers/21th_sound/app/tmp/include LDFLAGS=-L/work/drivers/21th_sound/app/tmp/lib
在make编译madplay-0.15.2b,错误信息(三)
arm-linux-gcc -Wall -g -O2 /work/drivers/21th_sound/app/tmp/lib -o madplay madplay.o getopt.o getopt1.o version.o resample.o filter.o tag.o crc.o rgain.o player.o audio.o audio_aiff.o audio_cdda.o audio_hex.o audio_null.o audio_raw.o audio_snd.o audio_wave.o audio_oss.o -L/work/drivers/21th_sound/app/madplay-0.15.2b -lmad -lid3tag -lm
/work/drivers/21th_sound/app/tmp/lib: file not recognized: Is a directory
collect2: ld returned 1 exit status
Makefile:433: recipe for target 'madplay' failed
make[2]: *** [madplay] Error 1
make[2]: Leaving directory '/work/drivers/21th_sound/app/madplay-0.15.2b'
Makefile:589: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/work/drivers/21th_sound/app/madplay-0.15.2b'
Makefile:340: recipe for target 'all' failed
make: *** [all] Error 2
解决办法:
1、./configure --help(配置文件的帮助信息)
2、make distclean
3、执行以下命令:(从上图可以知道,LDFLAGS -L要顶格来写,不要留空格)
./configure --host=arm-linux --prefix=/work/drivers/21th_sound/app/tmp CPPFLAGS="-I /work/drivers/21th_sound/app/tmp/include" LDFLAGS="-L/work/drivers/21th_sound/app/tmp/lib"