QT库移植
开发环境
移植QT
QT是开发界面比较流行的一个软件,下面描述怎么编译QT源码生成QT库,怎么配置QT开发环境。
交叉编译
QT
需要
zlib
库,如使用触摸屏需要
tslib
库,二个库已经在附件中给出。将
mytslib.tar
解压在
/opt
目录下。
移植ZLIB
获取源码
修改并配置源码
Host# cd /opt/transplants
Host# tar zxvf zlib-1.2.5.tar.gz
解压后生成目录
zlib-1.2.5
。
Host# CC=arm-none-linux-gnueabi-gcc ./configure -shared --prefix=/zlib-1.2.5
编译并安装源码
Host# make
Host# make install
Host# cp /zlib-1.25/** /opt/Tools/arm-2009q1/arm-none-linux-gnueabi/libc/usr –raf
移植QT
获取源码
Host# cd /opt/transplants
Host# tar zxvf qt-everywhere-opensource-src-4.6.2.tar.gz
解压后生成目录qt-everywhere-opensource-src-4.6.2。
Host# vi qt-everywhere-opensource-src-4.6.2/mkspecs/qws/linux-arm-g++/qmake.conf
QMAKE_CC
= arm-none-linux-gnueabi-gcc
QMAKE_CXX
= arm-none-linux-gnueabi-g++
QMAKE_LINK
= arm-none-linux-gnueabi-g++
QMAKE_LINK_SHLIB
= arm-none-linux-gnueabi-g++
# modifications to linux.conf
QMAKE_AR
= arm-none-linux-gnueabi-ar cqs
QMAKE_OBJCOPY
= arm-none-linux-gnueabi-objcopy
QMAKE_STRIP
= arm-none-linux-gnueabi-strip
load(qt_config)
Host# cd qt-everywhere-opensource-src-4.6.2
Host# ./configure -v -prefix /opt/qt-4.6.2 -platform qws/linux-x86-g++ -xplatform qws/linux-arm-g++ -I/opt/mytslib/include/ -L/opt/mytslib/lib/ -embedded arm -qt-mouse-pc -plugin-mouse-pc -qt-kbd-linuxinput -qt-kbd-tty -qt-gfx-vnc -qt-mouse-tslib -plugin-mouse-tslib
NOTE:-I/opt/mytslib/include/选项指定tslib头文件路径 -L/opt/mytslib/lib/指定tslib库路径。
Type 'c' if you want to use the Commercial Edition.
Type 'o' if you want to use the Open Source Edition
Type '3' to view the GNU General Public License version 3.
Type 'L' to view the Lesser GNU General Public License version 2.1.
Type 'yes' to accept this license offer.
Type 'no' to decline this license offer.
Host# make
NOTE:这一过程较长,一般为3小时左右。编译
Host# make install
移植库到文件系统
export QTEDIR=/opt/qt-4.6.2
export QTDIR=/opt/qt-4.6.2
export LD_LIBRARY_PATH=$QTDIR/lib:/lib/:/usr/local/mytslib/lib
export PATH=$QTDIR/lib:$QTDIR/bin:$PATH
export QT_QWS_FONTDIR=$QTDIR/lib/fonts
export QWS_MOUSE_PROTO='TSLIB:/dev/input/event2'
QTEDIR
和QTDIR为QT库所在目录,保存退出。
Target# source /etc/profile
搭建QT开发环境
在主机上编译QT程序主要使用到交叉工具链以及QT库中的qmake工具。
#ln -s /opt/qt-4.6.2/bin/qmake /usr/bin/qmake
#qmake -v
QMake version 2.01a
Using Qt version 4.6.2 in /opt/qt-4.6.2/