编译工具:
Arm-none-linux-gnueabi- 4.3.3
修改:
qt-extended-4.4.3/qtopiacore/qt/mkspecs/qws/linux-arm-g++/qmake.conf
将里面arm-linux 换为arm-none-linux-gnueabi
1.)解压源码qt-extended-opensource-src-4.4.3.tar.gz到qtopia4_arm目录中
2)创建目录build_arm 和target-arm
[root@realtimedsp-desktop:/home/realtimedsp/yf/qtopia4_arm]# ls
Build_arm target-arm qt-extended-4.4.3-src-arm
3)设置环境变量
[root@realtimedsp-desktop:/home/realtimedsp/yf/qtopia4_arm]# export QPEDIR=/home/realtimedsp/yf/qtopia4_arm/build_arm
[root@realtimedsp-desktop:/home/realtimedsp/yf/qtopia4_arm]# export QTOPIA_DEPOT_PATH =/home/realtimedsp/yf/qtopia4_arm/qt-extended-4.4.3
[root@realtimedsp-desktop:/home/realtimedsp/yf/qtopia4_arm]# echo $QPEDIR
/home/realtimedsp/yf/qtopia4_arm/build_arm
[root@realtimedsp-desktop:/home/realtimedsp/yf/qtopia4_arm]# echo $QTOPIA_DEPOT_PATH
/home/realtimedsp/yf/qtopia4_arm/qt-extended-4.4.3
4) 编译安装 tslib ( 见另篇文档 )
5)配置与编译,安装
配置:
进入build_arm目录:
../qt-extended-4.4.3/configure -ui-type mobile -xplatform linux-arm-g++ -arch arm -release -clean -prefix /home/realtimedsp/yf/qtopia4_arm/target_arm/ -sound-system oss -build-qt -no-sxe -no-ssl -no-v4l2 -no-vpn -no-phonon -no-libamr -dynamic-rotation -mediaengines cruxus -remove-mediaengine gstreamer,helix -pictureflow -remove-module bluetooth,drm -no-dbus -no-dbusipc -add-displaysize 480x800 -extra-qt-embedded-config "-embedded arm -xplatform qws/linux-arm-g++ -no-cups -nomake examples -nomake demos -qt-libjpeg -qt-libmng -qt-libpng -no-dbus -qt-gfx-linuxfb -qt-gfx-transformed -no-gfx-qvfb -no-gfx-vnc -no-gfx-multiscreen -qt-kbd-tty -no-kbd-usb -no-kbd-sl5000 -no-kbd-yopy -no-kbd-vr41xx -no-kbd-qvfb -qt-mouse-tslib -I/home/realtimedsp/workdir/filesys/opt/tslib/include -L/home/realtimedsp/workdir/filesys/opt/tslib/lib -no-webkit -no-openssl -no-phonon -no-phonon-backend -no-nas-sound -no-exceptions -svg" -extra-qt-config "-no-webkit" 2>&1 | tee ./qtopiaconfig.log
。。。。。。。(2个半小时后)
Qt Extended has been configured. You can build Qt Extended by running
bin/qbuild.
If you run bin/qbuild image, this will setup a runnable image in
/home/realtimedsp/yf/qtopia4_arm/target_arm.
As configured, Qt Extended MUST be run from
/home/realtimedsp/yf/qtopia4_arm/target_arm. If this is not where you intend to run Qt
Extended from you should set the location by running configure -prefix
/opt/Qtopia.
编译:
[root@abilly build-arm]# bin/qbuild
(5个小时后:)
。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
Qt Extended has been built.
You must now install Qt Extended by running 'bin/qbuild image'.
This will put the files required to run Qt Extended into the image:
/home/realtimedsp/yf/qtopia4_arm/target_arm
Before you can use the SDK you must finalize it by running 'bin/qbuild sdk'.
This will put the required files into the SDK:
/home/realtimedsp/yf/qtopia4_arm/build-arm/sdk
安装:
[root@abilly build-arm]# bin/qbuild image
Qt Extended has been installed.
The files required to run Qt Extended are in the image:
/home/realtimedsp/yf/qtopia4_arm/build_arm/image
Please note that Qt Extended cannot be run from the image.
You must move Qt Extended to the prefix first. The prefix is:
/home/realtimedsp/yf/qtopia4_arm/target_arm
[root@abilly build-arm]# bin/qbuild sdk
Finalizing the SDK
/home/abilly/qtopia4_arm/qt-extended-4.4.3-src-arm/src/build/bin/sdkcache /home/abilly/qtopia4_arm/build-arm/sdk
WARNING: Your perl has a bug with output and UTF-8
WARNING: sdkcache will attempt to work around the bug by changing your
LANG variable from zh_CN.UTF-8 to zh_CN.
The SDK has been finalized.
It can now be deployed to another computer.
Note that you should run configure before building again.
关于某些配置修改:
1、显示鼠标光标(此修改建议不要修改,修改之后出现光标,严重不适合触摸屏使用,如果你不是触摸屏,建议修改!)
# vi qtopiacore/qconfig-qpe.h
首先注释掉关于鼠标光标的宏定义,让程序运行时,触摸屏中央有光标出现:
// Qtopia Core
/*
#ifndef QT_NO_QWS_CURSOR
#define QT_NO_QWS_CURSOR
#endif
*/
/*
#ifndef QT_NO_QWS_MOUSE
#define QT_NO_QWS_MOUSE
#endif
#ifndef QT_NO_QWS_MOUSE_AUTO
#define QT_NO_QWS_MOUSE_AUTO
#endif
*/
其它宏定义根据需要进行注释。
保存后将qconfig-qpe.h拷贝到global目录。
# cp qtopiacore/qconfig-qpe.h qtopiacore/qt/src/corelib/global/qconfig-qpe.h
注释掉其他文件里的QT_NO_QWS_CURSOR的定义
# vi qtopiacore/qt/src/corelib/global/qfeatures.h
注释掉如下内容:
/*
#if !defined(QT_NO_QWS_CURSOR) && (defined(QT_NO_CURSOR))
#define QT_NO_QWS_CURSOR
#endif
*/
保存退出。
# vi qtopiacore/qt/src/corelib/global/qglobal.h
注释掉以下内容:
//# define QT_NO_QWS_CURSOR
保存退出。
2、修改时区信息
# vi src/libraries/qtopia/qtimezone.cpp
将其中的/usr/share/zoneinfo 改为/home/share/zoneinfo(此文件夹自行设置),保存退出。
修改之后,在配置失去信息的时候记得要把zoneinfo文件夹放到指定位置!
时区信息可复制主机上的/usr/share/zoneinfo文件,没有这个文件,qtopia4是运行不起来的!!! 这个是我第一个没有考虑到的地方!
3、关于tslib
在编译这之前,最好是先移植编译tslib,并且使用相同交叉编译器!
二、环境变量的配置
启动脚本(/bin/qtopia4)
#!/bin/sh
export TSLIB_ROOT=/opt/tslib
export TSLIB_TSDEVICE=/dev/input/event0
export TSLIB_CALIBFILE=$TSLIB_ROOT/etc/pointercal
export TSLIB_CONFFILE=$TSLIB_ROOT/etc/ts.conf
export TSLIB_PLUGINDIR=$TSLIB_ROOT/lib/ts
export TSLIB_CONSOLEDEVICE=/dev/tty
export TSLIB_FBDEVICE=/dev/fb0
export LANG="en_US"
export QWS_MOUSE_PROTO=tslib:/dev/input/event0
export QT_QWS_FONTDIR=/opt/qt-embedded/lib/fonts
export QTDIR=/opt/qt-embedded
export QWS_DISPLAY=LinuxFb:/dev/fb0
export QPEDIR=/home/realtimedsp/yf/qtopia4_arm/target_arm
export PATH=$QPEDIR/bin:$PATH
export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib:/opt/qt-embedded/lib:/opt/tslib/lib:$QPEDIR/lib:/usr/local/lib:$LD_LIBRARY_PATH
export QWS_SIZE=480x800
export HOME=/home/realtimedsp/yf/qtopia4_arm
export QTOPIA_PHONE_DUMMY=1
export QWS_DISPLAY="LinuxFB:/dev/fb0"
#export QWS_DISPLAY="LinuxFB:mmWidth130:mmHeight100:0"
export QWS_DISPLAY="Transformed:Rot180:LinuxFb:mmWidth91:mmHeight53"
export QWS_KEYBOARD=TTY:/dev/tty1
export QWS_MOUSE_PROTO="TSLIB:/dev/input/event0"
export QT_PLUGIN_PATH=$QPEDIR/plugins/
export QT_QWS_FONTDIR=$QPEDIR/lib/fonts/
exec $QPEDIR/bin/qpe 1>/dev/null 2>/dev/null
若启动不正常:
将
qtopia4_arm/target_arm/etc/default/Trolltech/qpe.conf
复制到
qtopia4_arm/Settings/Trolltech/qpe.conf
出现的问题及解决办法:
1.解决/usr/bin/ld: cannot find -lxxx 问题
apt-get install libxtst-dev
Solution: $sudo apt-get install libwxgtk2.8-0 libwxgtk2.8-dev wx2.8-headers wx-common
2. Need libsmbclient.h for compiling on Unix.
Solution: $sudo apt-get install libsmbclient-dev
3. Need cups.h for compiling on Unix.
Solution: $sudo apt-get install libcupsys2-dev
4. error: Need opensc/opensc.h.
Solution: $sudo apt-get install libopensc2-dev
5. exec: g++: not found.
Solution: $sudo apt-get install build-essential
6. error: X11/Xlib.h: no such file or directory.
Solution: $sudo apt-get install libx11-dev
7. error: X11/Xmu/WinUtil.h: no such file or directory.
Solution: $sudo apt-get install libxmu-dev
8. error: jpeglib.h: no such file or directory.
Solution: $sudo apt-get install libjpeg-dev
9. error: png.h: no such file or directory.
Solution: $sudo apt-get install libpng-dev