ARM移植步骤
1. 安装交叉编译器
a) 解压
b) 环境变量设置
i. #gedit /root/.bashrc
ii. export PATH=路径/bin:$PATH
iii. # source /root/.bashrc
2. 安装embeded库
a) 配置
echo yes | ./configure -prefix /opt/Qt4.8 -opensource-embedded arm -xplatform qws/linux-arm-g++ -webkit -qt-libtiff -qt-libmng-qt-mouse-tslib -qt-mouse-pc -no-mouse-linuxtp -no-neon -no-qt3support -exceptions -declarative -script -xmlpatterns -qt-libpng -qt-libjpeg -qt-sql-sqllite -no-opengl -nomake examples -nomake demos -make tools-nomake docs-importdir /opt/Qt4.8/qml
b) make && make install
c) 交叉编译
i. 环境变量设置
类似于这种
ii. source setenv.sh
iii. # cd /opt/Qt4.8/hello
iv. # make clean
v. # qmake –project 重新生成.pro文件,有时候不需要这一步(有了反而不行)
vi. # qmake 生成交叉编译的Makefile
vii. # make
3. ARM板库移植
a) 把qt的embeded库复制到ARM板
b) 配置环境变量
[root@FriendlyARM /bin]# vi setqt4env
#!/bin/sh
if [ -e /etc/friendlyarm-ts-input.conf ] ; then
./etc/friendlyarm-ts-input.conf
fi
true ${TSLIB_TSDEVICE:=/dev/touchscreen}
TSLIB_CONFFILE=/etc/ts.conf
exportTSLIB_TSDEVICE
exportTSLIB_CONFFILE
exportTSLIB_PLUGINDIR=/usr/lib/ts
exportTSLIB_CALIBFILE=/etc/pointercal
#exportQWS_DISPLAY=:1
exportQWS_DISPLAY="LinuxFb:mmWidth100:mmHeight130:0"
exportLD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
exportPATH=/bin:/sbin:/usr/bin/:/usr/sbin:/usr/local/bin
exportQT_QWS_FONTDIR=/opt/Qt4.8/lib/fonts
if [ -c /dev/touchscreen ]; then
export QWS_MOUSE_PROTO="Tslib MouseMan:/dev/input/mice"
if [ ! -s /etc/pointercal ] ; then
rm /etc/pointercal
/usr/bin/ts_calibrate
fi
chmod +x/bin/setqt4env
. setqt4env
cd /sdcard
./ home -qws
注意,setqt4env命令前面的“.”与setqt4env之间要有一个空格隔开
最后移植之后发现提示main.qml: File not found
解决办法:把所有qml文件和图片加载到qrc资源文件
然后修改view.setSource(QUrl("qrc:/main.qml"));只有这样交叉编译的时候才能编译进去生成二进制文件,不然无法编译进去qml文件只有白白的窗口,所有的qml文件,所有的图片都要在qrc资源文件中