完全な成功-クロスコンパイルmplayer、ストリームメディアlive 555をサポートし、エラーと解決方法をまとめます.

5222 ワード

一、準備作業:
MPlayer-1.0rc1.tar.bz2   #MPlayer  source code  ダウンロード先:MPlayer-1.0 rc 1.tar.bz 2
libmad-0.15.1b.tar.gz      #デコードライブラリ  ダウンロードアドレス:libmad-0.15.1 b.tar.gz
live.2011.12.23.tar.gz      #Liveライブラリのサポート、ストリーミングメディア機能に必要なダウンロードアドレス:live.2011 1.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

これは、他のバージョンlive 555バージョンパッケージを使用した結果です.
二、 インストール作業:
1-libmadの解凍
tar -xvzf libmad-0.15.1b.tar.gz -C /opt/

libmad解凍ディレクトリに入ります:cd libmad-0.15.1 b/
./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.0 rc 1に入ります
スクリプト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への移植(S 5 PV 210開発ボード)