文章参考:http://blog.chinaunix.net/uid-23121765-id-197916.html
1.下载qt-embedded-linux-opensource-src-4.5.2.tar.gz代码后,配置:
./configure -prefix /usr/local/an-qte -release -opensource -shared -fast -no-largefile -qt-sql-sqlite -no-exceptions -stl -no-qt3support -webkit -no-mmx -no-3dnow -no-sse -no-sse2 -no-svg -qt-gif -qt-libpng -qt-libjpeg -make libs -nomake examples -nomake docs -nomake demo -no-nis -no-cups -no-iconv -no-dbus -no-openssl -xplatform qws/linux-arm-g++ -embedded arm -little-endian -host-little-endian -qt-freetype -depths 8,16,24 -qt-gfx-linuxfb -no-gfx-vnc -no-gfx-qvfb -no-gfx-transformed -no-gfx-multiscreen -qt-kbd-usb -qt-kbd-tty -qt-mouse-tslib -I/usr/local/tslib/include -L/usr/local/tslib/lib -no-glib
2.gmake ,gmake install
3.将an-qte/lib复制到开发板/opt/qt/下,将编译好tslib复制到开发板的根文件目录下,将主机的/usr/share/fonts下的到wqy(文泉驿)的字体文件并拷贝开发板/opt/qt/lib/fonts目录下
4.修改开发板的profile文件
在文件的export PATH前面加上以下内容
export PATH=$PATH:/tslib-1.4/bin
export LD_LIBRARY_PATH=/tslib-1.4/lib:/opt/qt/lib
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_TSDEVICE=/dev/input/event0
export TSLIB_PLUGINDIR=/tslib-1.4/lib/ts
export TSLIB_CONFFILE=/tslib-1.4/etc/ts.conf
export TSLIB_CALIBFILE=/etc/pointercal
export QWS_KEYBOARD=USB:/dev/input/event1
export QWS_MOUSE_PROTO=Tslib:/dev/input/event0
export QWS_DISPLAY=LinuxFb:mmWidth45:mmHeight60:0
export QWS_SIZE=800*600
export set QT_QWS_FONTDIR=/opt/qt/lib/fonts
5.修改tslib-1.4的配置文件ts.conf
module_raw input
module pthres pmin=1
module variance delta=30
module dejitter delta=100
module linear
6.开发过程
先到~目录,将刚编译好的qte代码的安装目录添加到PATH变量里面。
在.bash_profile内添加:export PATH=$PATH:/an-qte/bin
在.bashrc中添加:alias qte-arm-make='/usr/local/qte452/bin/qmake'
在以后的开发过程中,可以这样使用:
比如写好了一个hello的qt程序,并放在一个文件夹内
qte-arm-make -project
qte-arm-make hello.pro
make
然后将生成的hello放到开发板上,在终端上输入:./hello -qws即可显示。
中间出现的问题:
1.编译qte时会出现各种奇怪的问题, 如果编译不对,还会对后面代码编译产生影响,为了最大限度的减小以上出现的问题。我强烈建议解压代码后,不要复制,改名,移动,如果一次编译一成功,就重新解压,不要在原目录下继续做。
2.把profile内容修改后,发现终端不能使用ls等这些命令
尽量减少写入profile中代码,如果原来定义了变量,建议全部换成变量实际的值
3.运行ts_test发现找不到event0
mknod /dev/input/event0 c 13 64
4.QFontDatabase: Cannot find font directory
在profile内添加:export set QT_QWS_FONTDIR=/opt/qt/lib/fonts
5.cannot create Qt for Embedded Linux data directory: /tmp/qtembedded-0
网上说:mount -t tmpfs -0 size=32m none /tmp
但我的实际情况是我的根文件系统里没有tmp这个目录,直接创建就好了
6.其它问题:比如编译的时候,找不到相应的库文件,或者虽的文件,或者不能识别相应的指令,这些问题我也遇到过。将qte源码重新编译一次就好了。
~