配置ARM平台的Qt遇到过很多困难,特别是增加phonon支持,更是麻烦,
编译phonon之前,必须先编译必要的依赖包,否则不会成功,
其中设置PKG_CONFIG_PATH很关键,让后面安装的包可以找到包依赖
phonon依赖以下几个包,所以先安装,我把这几个包全部安装在/opt/gst/:
- 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之前应该先安装glib
/home/cody/gst是编译的主目录,如果出现没找到某某包的错误,应先检查PC Linux环境是否已经安装相应的包
cd /home/cody/gst
export PKG_CONFIG_PATH=/opt/gst/lib/pkgconfig
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.gz
解压进入qt主目录然后配置,如果没问题的话,将不会看到phonon不能被支持之类的
./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