今天用了一天的时间将mplayer移植到arm开发板上,移植过程中遇到各种问题,在此做以记录。
mplayer版本:1.0rc2
Ubuntu版本:12.04 64位
移植过程:
1、su获取root权限;
2、解压mplayer;
3、在解压的目录中mkdir output,作为安装目录;
3、./configure配置。具体如下:
./configure --enable-cross-compile \ --host-cc=gcc \ --cc=/root/external-toolchain/bin/arm-linux-gnueabi-gcc \ --as=/root/external-toolchain/bin/arm-linux-gnueabi-as \ --ar=/root/external-toolchain/bin/arm-linux-gnueabi-ar \ --ranlib=/root/external-toolchain/bin/arm-linux-gnueabi-ranlib \ --target=arm-linux \ --prefix=/root/mplayer/MPlayer-1.0rc2/output \ --enable-alsa \ --enable-static \ --disable-win32dll \ --disable-dvdread \ --enable-fbdev \ --disable-mencoder \ --disable-live \ --disable-ivtv \ --language=zh_CH
4、修改config.mak文件。在这个文件中的OPTFLAGS选项中加入“-Wa,-mimplicit-it=thumb”
5、make
6、修改config.mak文件:把这个文件中的“INSTALLSTRIP = -s” 改成“INSTALLSTRIP =”
7、make install
移植过程中遇到的问题:
1、make时提示:
../libavutil/bswap.h: Assembler messages: ../libavutil/bswap.h:77: Error: no such instruction: `eor %eax,%esi,%esi,ror' ../libavutil/bswap.h:78: Error: no such instruction: `bic %eax,%eax,' ../libavutil/bswap.h:79: Error: number of operands mismatch for `mov' ../libavutil/bswap.h:80: Error: no such instruction: `eor %esi,%esi,%eax,lsr' make[1]: *** [vd_sgi.o] Error 1
这个问题是由于编译前没有配置好交叉编译工具链引起的。由于编译前没有配置交叉编译工具链,出现了这个错误。解决办法就是配置好交叉编译工具链。
2、make时提示:
{standard input}: Assembler messages: {standard input}:61: Error: thumb conditional instruction should be in IT block -- `addgt r2,sl,#0' {standard input}:62: Error: thumb conditional instruction should be in IT block -- `rsblt r2,sl,#0' {standard input}:63: Error: thumb conditional instruction should be in IT block -- `smlatbne r2,r4,fp,r2' {standard input}:65: Error: thumb conditional instruction should be in IT block -- `addgt r0,sl,#0' {standard input}:66: Error: thumb conditional instruction should be in IT block -- `rsblt r0,sl,#0' {standard input}:67: Error: thumb conditional instruction should be in IT block -- `smlatbne r0,r5,fp,r0' {standard input}:69: Error: thumb conditional instruction should be in IT block -- `addgt r3,sl,#0' {standard input}:70: Error: thumb conditional instruction should be in IT block -- `rsblt r3,sl,#0' {standard input}:71: Error: thumb conditional instruction should be in IT block -- `smlabbne r4,r4,fp,r3' {standard input}:73: Error: thumb conditional instruction should be in IT block -- `addgt r3,sl,#0' {standard input}:74: Error: thumb conditional instruction should be in IT block -- `rsblt r3,sl,#0' {standard input}:75: Error: thumb conditional instruction should be in IT block -- `smlabbne r5,r5,fp,r3' {standard input}:81: Error: thumb conditional instruction should be in IT block -- `addgt r2,sl,#0' {standard input}:82: Error: thumb conditional instruction should be in IT block -- `rsblt r2,sl,#0' {standard input}:83: Error: thumb conditional instruction should be in IT block -- `smlatbne r2,r6,fp,r2' {standard input}:85: Error: thumb conditional instruction should be in IT block -- `addgt r0,sl,#0' {standard input}:86: Error: thumb conditional instruction should be in IT block -- `rsblt r0,sl,#0' {standard input}:87: Error: thumb conditional instruction should be in IT block -- `smlatbne r0,r7,fp,r0' {standard input}:89: Error: thumb conditional instruction should be in IT block -- `addgt r3,sl,#0' {standard input}:90: Error: thumb conditional instruction should be in IT block -- `rsblt r3,sl,#0' {standard input}:91: Error: thumb conditional instruction should be in IT block -- `smlabbne r6,r6,fp,r3' {standard input}:93: Error: thumb conditional instruction should be in IT block -- `addgt r3,sl,#0' {standard input}:94: Error: thumb conditional instruction should be in IT block -- `rsblt r3,sl,#0' {standard input}:95: Error: thumb conditional instruction should be in IT block -- `smlabbne r7,r7,fp,r3'
这个问题的解决方法是,在make之前修改config.mak文件,在这个文件中的OPTFLAGS中添加“-Wa,-mimplicit-it=thumb”即可。
3、make install时会提示错误:
install -m 755 -s mplayer /root/mplayer/MPlayer-1.0rc2/output/bin strip: Unable to recognise the format of the input file `/root/mplayer/MPlayer-1.0rc2/output/bin/mplayer' install: strip process terminated abnormally make: *** [install-mplayer] Error 1这个是因为在make install时会调用strip来剔除一些无用的文件,但是此时strip是主机的,而不是目标机的,就出现错误。解决方法是修改config.mak文件,将文件中的“INSTALLSTRIP = -s” 改成“INSTALLSTRIP =”。