一、准备工作:
MPlayer-1.0rc1.tar.bz2 #MPlayer source code 下载地址:MPlayer-1.0rc1.tar.bz2
libmad-0.15.1b.tar.gz #解码库 下载地址:libmad-0.15.1b.tar.gz
live.2011.12.23.tar.gz #live库的支持,流媒体功能必要 下载地址:live.2011.12.23.tar.gz
PS:好像只能使用这个版本的流媒体包,其他版本会导致,在编译mplayer时出现如下
demux_rtp_codec.cpp:(.text+0x61b): undefined reference to `operator new[](unsigned int)'
demux_rtp_codec.cpp:(.text+0x6f9): undefined reference to `operator delete[](void*)'
.......
.......
demux_rtp_codec.cpp:(.text+0xec0): undefined reference to `parseGeneralConfigStr(char const*, unsigned int&)'
collect2: ld returned 1 exit status
make: *** [mplayer] 错误 1
这是使用其他版本live555 版本包导致的
二、 安装工作:
1-解压libmad
tar -xvzf libmad-0.15.1b.tar.gz -C /opt/
进入libmad解压目录:cd libmad-0.15.1b/
./configure --enable-fpm=arm --host=arm-none-linux-gnueabi --disable-shared --disable-debugging --prefix=/opt/libmad-arm
make
make install
如果make的时候出现错误:
cc1: error: unrecognized command line option "-fforce-mem"
修改 Makefile 第129行 将 -fforce-mem 删除
vim Makefile
再执行make && make install
2-解压live库
tar -xvzf live.2011.12.23.tar.gz -C /usr/local/lib/
进入live解压目录 cd /usr/local/lib/live
vim config.armlinux
只修改其中部分如下:
CROSS_COMPILE= arm-linux-
LIBRARY_LINK = $(CROSS_COMPILE)ld -o
LIBRARY_LINK_OPTS = $(LINK_OPTS) -r -Bstatic
保存后退出
执行
./genMakefiles armlinux
make
好了接下来就是交叉编译mplayer了
3-解压mplayer库
tar -xvzf MPlayer-1.0rc1.tar.bz2 -C /opt/
进入mplayer解压目录 cd /opt/MPlayer-1.0rc1
创建一个脚本build.sh
mkdir build.sh
添加如下内容:
#!/bin/bash
./configure \
--prefix=/opt/mplayer-arm \
--cc=arm-linux-gcc \
--host-cc=gcc \
--enable-cross-compile \
--target=arm-linux \
--enable-linux-devfs \
--disable-win32 \
--disable-dvdread \
--enable-fbdev \
--disable-mencoder \
--enable-libavcodec \
--disable-liba52 \
--disable-mp3lib \
--enable-static \
--disable-armv5te \
--disable-iconv \
--charset=noconv \
--enable-mad \
--enable-ossaudio \
--enable-live \
--with-livelibdir=/usr/local/lib/live \
--with-extraincdir=/usr/local/arm/arm-2009q3/arm-none-linux-gnueabi/include:/opt/libmad/include \
--with-extralibdir=/usr/local/arm/arm-2009q3/arm-none-linux-gnueabi/lib:/usr/local/arm/arm-2009q3/lib/:/opt/libmad/lib
注意链接路径的问题,修改为你自己的。
修改build.sh权限,再执行脚本:
chmod 777 build.sh
./build.sh
然后执行:
make
make install
如果在执行make编译的过程中,会出现如下警告和错误
./version.sh `arm-linux-gcc -dumpversion`
arm-linux-gcc -c -Wdeclaration-after-statement -O4 -pipe -ffast-math -fomit-frame-pointer -D_REENTRANT -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/local/arm/arm-2009q3/arm-none-linux-gnueabi/include -I/opt/libmad/include -I/usr/include -I/usr/local/lib/live/liveMedia/include -I/usr/local/lib/live/UsageEnvironment/include -I/usr/local/lib/live/BasicUsageEnvironment/include -I/usr/local/lib/live/groupsock/include -I. -I./libavutil -I./libavcodec -o mplayer.o mplayer.c
cc1: warning: include location "/usr/include" is unsafe for cross-compilation
In file included from /usr/include/stdlib.h:55,
from mplayer.c:6:
/usr/include/bits/floatn.h:75: error: unknown machine mode 'TC'
/usr/include/bits/floatn.h:87: error: expected '=', ',', ';', 'asm' or '__attribute__' before '_Float128'
In file included from /usr/include/sys/types.h:205,
from /usr/include/stdlib.h:394,
from mplayer.c:6:
/usr/include/sys/sysmacros.h: In function 'gnu_dev_major':
/usr/include/sys/sysmacros.h:79: warning: integer constant is too large for 'unsigned long' type
/usr/include/sys/sysmacros.h: In function 'gnu_dev_minor':
/usr/include/sys/sysmacros.h:80: warning: integer constant is too large for 'unsigned long' type
Makefile:277: recipe for target 'mplayer.o' failed
make: *** [mplayer.o] Error 1
则修改config.mak文件
vim config.mak
将第22行中的 -I/usr/include 删除,保存退出。再执行make和make install。
如果在执行make install安装的过程中,出现如下提示
install -m 755 -s mplayer /home/hxy/MPlayer/
MPlayer-1.0rc2/../output/arm_linux/bin
strip: Unable to recognise the format of the input file
`/home/hxy/MPlayer/MPlayer-1.0rc2/../output/arm_linux/bin/mplayer'
这个时候修改Makefile文件,将第24行INSTALLSTRIP = -s 中的-s注释掉,如下
vim Makefile
# Do not strip the binaries at installation
ifeq ($(STRIPBINARIES),yes)
INSTALLSTRIP = #-s
endif
再make install ,得到mplayer可执行文件,结束。
参考文章:
交叉编译mplayer
MPlayer在ARM开发板的移植
关于MPlayer对RTSP支持的疑问
MPlayer在ARM开发板的移植
MPlayer在ARM上的移植(S5PV210开发板)