参考链接:
http://www.wretch.cc.sixxs.org/blog/mywaterweed/22535556
在Ubuntu 9.10下编译了qt-ebedded 4.5.3版本的编译环境。
一 建立给PC的模拟运行开发环境
a)下载
cd
mkdir qt-em
cd qt-em
wget ftp://ftp.qtsoftware.com/qt/source/qt-x11-opensource-src-4.5.3.tar.gz
wget ftp://ftp.qtsoftware.com/qt/source/qt-embedded-linux-opensource-src-4.5.3.tar.gz
b)解包
tar xzvf qt-embedded-linux-opensource-src-4.5.3.tar.gz
tar xzvf qt-x11-opensource-src-4.5.3.tar.gz
c)编译
cd qt-x11-opensource-src-4.5.3
./configure
make
sudo make install
cd tools/qvfb
make
cd -
sudo cp bin/qvfb /usr/local/Trolltech/QtEmbedded-4.5.3/bin
安装后的位置是在:/usr/local/Trolltech/Qt-4.5.3
compiling:
cd qt-embedded-linux-opensource-src-4.5.3
./configure -embedded -prefix /usr/local/Trolltech/QtEmbedded-4.5.3 x86 -qvfb
make
sudo make install
安装后的位置是在:/usr/local/Trolltech/QtEmbedded-4.5.3
cd qt-embedded-linux-opensource-src-4.5.3
cd tools/qvfb
make
cd -
sudo cp bin/qvfb /usr/local/Trolltech/QtEmbedded-4.5.3/bin
Step 3:
create file as named set.env which include lines:
export QTEDIR=/usr/local/Trolltech/QtEmbedded-4.5.3
export PATH=/usr/local/Trolltech/QtEmbedded-4.5.3/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/Trolltech/QtEmbedded-4.5.3/lib:$LD_LIBRARY_PATH
每次编译时候要运行: . set.env 来改变环境
d)测试
1
cd /usr/local/Trolltech/Qt-4.5.3/demos/chip
qvfb &
./chip -qws
2
cd /usr/local/Trolltech/QtEmbedded-4.5.3/demo/books
qvfb -width 640 -height 480 &
./books -qws
二 建立给开发版运行交叉编译程序环境
安装交叉编译gcc/g++
mkdir arm-tool
cd arm-tool
wget
chmod +x arm-2009q3-67-arm-none-linux-gnueabi.bin
./arm-2009q3-67-arm-none-linux-gnueabi.bin
默认安在如下目录
~/CodeSourcery/Sourcery_G++_Lite/bin$
cd ~/CodeSourcery/Sourcery_G++_Lite/bin$
创建文件:vi link.sh
#!/bin/sh
for i in arm-none-linux-gnueabi-*
do
ln -sf $i ./arm-linux-${i##*"arm-none-linux-gnueabi-"}
echo =./arm-linux-${i##*"arm-none-linux-gnueabi-"}=
done
chmod +x link.sh
./link.sh
如果没有交叉编译器系统在如下编译时会提示找不到arm-linux-g++/gcc
cd qt-em
mkdir arm
tar xzvf qt-embedded-linux-opensource-src-4.5.3.tar.gz -C arm
cd arm
vi set.env
add below line in it
export PATH=~/CodeSourcery/Sourcery_G++_Lite/bin:$PATH
. set.env
./configure -prefix /usr/local/Trolltech/QtEmbedded-4.5.3-arm -embedded arm -lrt
如果在上面没有整link.sh就要改下面的文件:
vim mkspecs/qws/linux-arm-g++/qmake.conf
修改文件內的编译器设置,指定为当前的toolchain,
默认內容如下:
# modifications to g++.conf
QMAKE_CC = arm-linux-gcc
QMAKE_CXX = arm-linux-g++
QMAKE_LINK = arm-linux-g++
QMAKE_LINK_SHLIB = arm-linux-g++
# modifications to linux.conf
QMAKE_AR = arm-linux-ar cqs
QMAKE_OBJCOPY = arm-linux-objcopy
QMAKE_STRIP = arm-linux-strip
改为:
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-linux-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
其它可选:
-confirm-license -little-endian -qt-mouse-tslib
-qt-mouse-tslib 是使用触控屏幕(要先用cross compiler build好arm版的tslib并放到target文件系统中)
make
sudo make install
安装到如下位置
/usr/local/Trolltech/QtEmbedded-4.5.3-arm
把这个编译好的QtEmbedded-4.5.0-arm拷贝到板子的root filesystem的/usr/local/Trolltech目录下
执行程序要设好如下环境变量:
$ export QTDIR=/usr/local/Trolltech/QtEmbedded-4.5.0-arm/
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$QPEDIR/lib
设置触控屏幕环境变量:
$ export TSLIB_PLUGINDIR="/usr/lib/ts"
$ export TSLIB_CALIBFILE="/etc/pointercal"
$ export QWS_MOUSE_PROTO="tslib:/dev/input/event0"
$ export POINTERCAL_FILE="/etc/pointercal"
$ export TSLIB_CONFFILE='/etc/ts.conf'
$ export TSLIB_TSDEVICE=/dev/input/event0
执行程序测试:
$ cd /usr/local/Trolltech/QtEmbedded-4.5.0-arm/demos/mainwindow
$ ./mainwindow -qws
阅读(5476) | 评论(0) | 转发(1) |