配置ARM平臺的Qt遇到過不少困難,特別是增長phonon支持,更是麻煩,linux
編譯phonon以前,必須先編譯必要的依賴包,不然不會成功,git
其中設置PKG_CONFIG_PATH很關鍵,讓後面安裝的包能夠找到包依賴app
phonon依賴如下幾個包,因此先安裝,我把這幾個包所有安裝在/opt/gst/:ui
- libxml2 v2.7.7 or later
- libcheck v0.9.8 or later
- liboil v0.3.2 or later
- gstreamer v0.10.0 or later
- gst-plugins-base v0.10.0 or later
其中liboil又依賴glib,因此安裝liboil以前應該先安裝glibthis
/home/cody/gst是編譯的主目錄,若是出現沒找到某某包的錯誤,應先檢查PC Linux環境是否已經安裝相應的包spa
cd /home/cody/gst.net
export PKG_CONFIG_PATH=/opt/gst/lib/pkgconfigcode
libxml2
wget ftp://xmlsoft.org/libxml2/libxml2-2.7.2.tar.gz
tar xvf libxml2-2.7.2.tar.gz
cd libxml2-2.7.2
./configure CROSS_COMPILE=arm-linux- --host=arm-linux --prefix=/opt/gst
make
make install
glib
git clone git://git.gnome.org/glib
cd glib
git checkout -b stable 2.22.3
./autogen.sh –noconfigure
touch arm.cache gedit arm.cache
複製下面內容到arm.cache:
glib_cv_long_long_format=yes
glib_cv_stack_grows=no
glib_cv_working_bcopy=no
glib_cv_uscore=no
ac_cv_func_posix_getpwuid_r=yes
ac_cv_func_nonposix_getpwuid_r=no
ac_cv_func_posix_getgrgid_r=no
./configure --cache-file=arm.cache --host=arm-linux --prefix=/opt/gst
make
出錯一個錯誤: libgio-2.0.so, not found
解決: make LDFLAGS="-rpath $PWD/gmodule/.libs"
make install
liboil
git clone git://anongit.freedesktop.org/liboil
cd liboil
git checkout -b stable liboil-0.3.15
./autogen.sh ./configure --prefix=/opt/gst/ --host=arm-linux
make
make install
libcheck
下載:http://sourceforge.net/projects/check/ 目前爲止最新版本是 check-0.9.11.tar_2.gz
解壓,進入源代碼目錄 配置:
./configure --prefix=/opt/gst --host=arm-linux
make
make install
gstreamer
git clone git://anongit.freedesktop.org/gstreamer/gstreamer
cd gstreamer
git checkout -b stable RELEASE-0.10.25
./autogen.sh --noconfigure
./configure --build=i686-linux --host=arm-linux \
--prefix=/opt/gst/ --enable-playbin2 --disable-loadsave --disable-gtk-doc \
ac_cv_func_register_printf_function=no --disable-tests --disable-valgrind
錯誤:
../arm-none-linux-gnueabi/bin/ld: cannot find -lgobject-2.0
解決: 切換到普通用戶再重頭來一次
make
make install
gst-plugins-base
先安裝liboil-dev: sudo aptitude install liboil-dev
git clone git://anongit.freedesktop.org/gstreamer/gst-plugins-base
cd gst-plugins-base
git checkout -b stable RELEASE-0.10.25
./autogen.sh –noconfigure
./configure --build=i686-linux --host=arm-linux \
--prefix=/opt/gst --disable-valgrind --disable-x --disable-gnome_vfs --disable-alsa \
--disable-ogg --disable-pango --disable-theora --disable-vorbis --disable-examples
make
make install
qt-4.8.5
下載qt-everywhere-opensource-src-4.8.5.tar.gz, PC端和ARM端都是同一個文件,下載地址:http://download.qt-project.org/official_releases/qt/4.8/4.8.5/qt-everywhere-opensource-src-4.8.5.tar.gzorm
解壓進入qt主目錄而後配置,若是沒問題的話,將不會看到phonon不能被支持之類的xml
./configure \
-embedded arm \
-prefix /opt/qt-4.8.5-arm \
-confirm-license \
-opensource \
-xplatform qws/linux-arm-g++ \
-v \
-no-largefile \
-opensource \
-confirm-license \
-no-xmlpatterns \
-no-qt3support \
-multimedia \
-audio-backend \
-glib \
-phonon \
-phonon-backend \
-declarative \
-qt-mouse-tslib \
-I/opt/tslib/include \
-L/opt/tslib/lib \
-I/opt/gst/include \
-L/opt/gst/lib \
-I/opt/gst/include/glib-2.0 \
-I/opt/gst/lib/glib-2.0/include \
-I/opt/gst/include/gstreamer-0.10/gst \
-L/opt/gst/lib/gstreamer-0.10 \
-force-pkg-config
我這裏配置完成以後提示以下:
Qt is now configured for building. Just run 'make'.
Once everything is built, you must run 'make install'.
Qt will be installed into /opt/qt-4.8.5-arm
To reconfigure, run 'make confclean' and 'configure'.
檢查configure沒問題以後
make
到這裏,好像都沒什麼問題了,make也進行了一二個小時吧,本覺得能夠經過, 事實是沒那麼順利…
出現好多這樣的錯誤:
/opt/FriendlyARM/toolschain/4.5.1/lib/gcc/arm-none-linux-gnueabi/4.5.1/../../../../arm-none-linux-gnueabi/bin/ld: warning: libgstapp-0.10.so.0, needed by /home/cody/gst/qt-4.8.5-arm/lib/libQtWebKit.so, not found (try using -rpath or -rpath-link)
/opt/FriendlyARM/toolschain/4.5.1/lib/gcc/arm-none-linux-gnueabi/4.5.1/../../../../arm-none-linux-gnueabi/bin/ld: warning: libgstinterfaces-0.10.so.0, needed by /home/cody/gst/qt-4.8.5-arm/lib/libQtWebKit.so, not found (try using -rpath or -rpath-link)
/opt/FriendlyARM/toolschain/4.5.1/lib/gcc/arm-none-linux-gnueabi/4.5.1/../../../../arm-none-linux-gnueabi/bin/ld: warning: libgstpbutils-0.10.so.0, needed by /home/cody/gst/qt-4.8.5-arm/lib/libQtWebKit.so, not found (try using -rpath or -rpath-link)
ls /opt/gst/lib 能夠看到所須要的庫都有,爲何就是找不到呢,確定跟編譯器有關, 應該就是編譯器找不到這些共享庫,查了很久不知道如何添加路徑到編譯器的搜索路徑裏, 可是能夠查到編譯器會去搜索哪些路徑:
$ arm-none-linux-gnueabi-gcc -print-search-dirs | grep libraries | sed 's/:/\n/g'
libraries
=/opt/FriendlyARM/toolschain/4.5.1/lib/gcc/arm-none-linux-gnueabi/4.5.1/
/opt/FriendlyARM/toolschain/4.5.1/lib/gcc/arm-none-linux-gnueabi/4.5.1/../../../../arm-none-linux-gnueabi/lib/arm-none-linux-gnueabi/4.5.1/
/opt/FriendlyARM/toolschain/4.5.1/lib/gcc/arm-none-linux-gnueabi/4.5.1/../../../../arm-none-linux-gnueabi/lib/
/opt/FriendlyARM/toolschain/4.5.1/arm-none-linux-gnueabi/sys-root/lib/arm-none-linux-gnueabi/4.5.1/
/opt/FriendlyARM/toolschain/4.5.1/arm-none-linux-gnueabi/sys-root/lib/
/opt/FriendlyARM/toolschain/4.5.1/arm-none-linux-gnueabi/sys-root/usr/lib/arm-none-linux-gnueabi/4.5.1/
/opt/FriendlyARM/toolschain/4.5.1/arm-none-linux-gnueabi/sys-root/usr/lib/
最笨的辦法,只好把/opt/gst/lib所有複製到
/opt/FriendlyARM/toolschain/4.5.1/arm-none-linux-gnueabi/sys-root/usr/lib/
再make,此次終於能夠經過了
make install