编译环境
CPU:Pentium Dual-Core E5200 2.50GHz
Memory:2GB
OS:VMware 6.5 下 Ubuntu 8.04
Cross-Compile Tools:arm-none-linux-gnueabi 2008q3
安装以下必要的库
sudo apt-get install libx11-dev libfreetype6-dev
libavahi-gobject-dev libSM-dev libXrender-dev libfontconfig-dev
libXext-dev
Qt\Embedded 4.5.2 下载
需要下载 qt-x11-opensource-src-4.5.2.tar.bz2 和
qt-embedded-linux-opensource-src-4.5.2.tar.bz2
两个软件包。
<>
编译安装qt-x11-opensource-src-4.5.2 及
qvfb
编译安装 qt-x11-opensource-src-4.5.2:
----------------------------------------------------------------------------------------------------------------------------
tar xjvf qt-x11-opensource-src-4.5.2.tar.bz2
cd qt-x11-opensource-src-4.5.2
./configure
make
sudo make
install
---------------------------------------------------------------------------------------------------------------------------
编译安装
qvfb:
---------------------------------------------------------------------------------------------------------------------------
cd
/tools/qvfb
sudo apt-get install xorg-dev
修改Makefile中LIBS选项:添加 -LXtst
make
---------------------------------------------------------------------------------------------------------------------------
"../bin"目录下会产生qvfb可执行文件
编译安装qt-embedded-linux-opensource-src-4.5.2
x86版本
编译安装:
---------------------------------------------------------------------------------------------------------------------------
tar
xjvf qt-embedded-linux-opensource-src-4.5.2.tar.bz2
mv qt-embedded-linux-opensource-src-4.5.2
qt-embedded-linux-opensource-src-4.5.2-x86
cd qt-embedded-linux-opensource-src-4.5.0-x86
sudo ./configure -prefix /usr/local/Trolltech/QtEmbedded-4.5.2-x86
-release -static -no-fast -no-largefile -xplatform
qws/linux-x86-g++ -qt-sql-sqlite -no-qt3support -qt-zlib -qt-gif
-qt-libtiff -qt-libpng -qt-libmng -qt-libjpeg -no-rpath -silent
-optimized-qmake -embedded x86 -little-endian -qt-freetype -depths
16,24,32 -no-separate-debug-info -qt-gfx-qvfb -qt-kbd-qvfb
-qt-mouse-qvfb
sudo make
sudo make
install
---------------------------------------------------------------------------------------------------------------------------
文件即被安装到"/usr/local/Trolltech/QtEmbedded-4.5.0-x86"目录中
测试qvfb:
---------------------------------------------------------------------------------------------------------------------------
cd
../qt-x11-opensource-src-4.5.2/bin
./qvfb -width 640 -height 480 &
cd
../qt-embedded-linux-opensource-src-4.5.2-x86/demos/browser
./browser
-qws
---------------------------------------------------------------------------------------------------------------------------
编译安装qt-embedded-linux-opensource-src-4.5.2
armv4版本
---------------------------------------------------------------------------------------------------------------------------
tar
xjvf qt-embedded-linux-opensource-src-4.5.2.tar.bz2
mv qt-embedded-linux-opensource-src-4.5.2
qt-embedded-linux-opensource-src-4.5.2-armv4
cd
qt-embedded-linux-opensource-src-4.5.2-armv4
---------------------------------------------------------------------------------------------------------------------------
使用 gnueabi 编译armv4版本时,需要添加CFLAGS、LFLAGS和CXXFLAGS三个标志,
添加方法:
---------------------------------------------------------------------------------------------------------------------------
cd
mkspecs/qws/linux-arm-g++
vim
qmake.conf
---------------------------------------------------------------------------------------------------------------------------
在其中添加:
---------------------------------------------------------------------------------------------------------------------------
QMAKE_CFLAGS += -march=armv4t
QMAKE_CXXFLAGS += -march=armv4t
QMAKE_LFLAGS += -march=armv4t
---------------------------------------------------------------------------------------------------------------------------
并将qmake.conf文件中的 arm-linux- 替换为 arm-none-linux-gnueabi-
如果使用tslib校正触摸屏,则编译Qt\Embedded 4.5.2需要先编译tslib 1.4
在qt-embedded-linux-opensource-src-4.5.2-armv4目录下,
执行命令:export
CVSROOT=:pserver:anoncvs@cvs.handhelds.org:/cvs
sudo apt-get install cvsnt
sudo apt-get install cvs
cvs
login
输出:Logging in to
:pserver:anoncvs@cvs.handhelds.org:2401/cvs
CVS
password:anoncvs
cvs login: CVS
password file /home/tekkaman/.cvspass does not exist - creating a
new file
执行命令:
cvs co apps/tslib
这样会在$PWS下建立一个apps文件夹,其中的tslib就是我们下载下来的源码。
使用apt安装autoconf、automake1.9和
libtool等软件包。
执行命令:./autogen.sh
echo "ac_cv_func_malloc_0_nonnull=yes"
> arm-linux.cache
./configure
CC=arm-none-linux-gnueabi-gcc CXX=arm-none-linux-gnueabi-g++
--host=arm-s3c2410-linux-gnu --target=arm-s3c2410-linux-gnu
--disable-hp3600 --disable-arctic2 --disable-mk712 --disable-collie
--disable-corgi --disable-ucb1x00 --disable-linear-h2200
--with-gnu-ld --prefix=$PWD/build --cache-file=arm-linux.cache
--enable-inputapi=no CFLAGS=-march=armv4t
由于使用arm-none-linux-gnueabi-工具链编译armv4t版本程序,所以要加上"CFLAGS=-march=armv4t”
make
& make install
编译好的程序安装到:$PWD/build
将中文件其拷贝到根文件系统相应目录,注意etc下的ts.conf文件要改为:
module_raw input
module pthres pmin=1
module variance delta=30
module dejitter delta=100
module linear
etc下profile文件中要添加tslib相应环境变量:
export TSLIB_TSDEVICE=/dev/event0
export TSLIB_CONFFILE=/etc/ts.conf
export TSLIB_CONSOLEDEVICE=none
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_PLUGINDIR=/usr/lib/ts
运行bin下ts_calibrate便可进行校正。
编译好 tslib 1.4
后,用其生成的include和lib的绝对路径替代下面命令中的$INCLUDE和$LIB。
将qt-embedded-linux-opensource-src-4.5.2-armv4/mkspecs/qws/linux-arm-g++/qmake.conf中的所有路径都改为绝对路径,否则配置时出错。
则配置命令如下:
---------------------------------------------------------------------------------------------------------------------------
sudo
./configure -prefix /usr/local/Trolltech/QtEmbedded-4.5.2-armv4
-release -static -no-fast -no-largefile -qt-sql-sqlite
-no-qt3support -nomake examples -nomake demos -qt-zlib -qt-gif
-qt-libtiff -qt-libpng -qt-libmng -qt-libjpeg -no-rpath -silent
-optimized-qmake -xplatform qws/linux-arm-g++ -embedded arm
-little-endian -qt-freetype -depths 16,24,32 -qt-mouse-tslib
-no-separate-debug-info -I $INCLUDE -L $LIB
---------------------------------------------------------------------------------------------------------------------------
安装:
---------------------------------------------------------------------------------------------------------------------------
sudo
make
sudo make
install
---------------------------------------------------------------------------------------------------------------------------
编译安装qt-embedded-linux-opensource-src-4.5.2
armv5版本
---------------------------------------------------------------------------------------------------------------------------
tar
xjvf qt-embedded-linux-opensource-src-4.5.2.tar.bz2
mv qt-embedded-linux-opensource-src-4.5.2
qt-embedded-linux-opensource-src-4.5.2-armv5
cd qt-embedded-linux-opensource-src-4.5.2-armv5
---------------------------------------------------------------------------------------------------------------------------
将qmake.conf文件中的 arm-linux- 替换为 arm-none-linux-gnueabi-
,不需添加CFLAGS等标志。
同样设编译好 tslib 1.4 的 include 目录为 $INCLUDE,lib 目录为 $LIB。
则配置命令如下:
---------------------------------------------------------------------------------------------------------------------------
sudo
./configure -prefix /usr/local/Trolltech/QtEmbedded-4.5.2-armv5
-release -static -no-fast -no-largefile -qt-sql-sqlite
-no-qt3support -nomake examples -nomake demos -qt-zlib -qt-gif
-qt-libtiff -qt-libpng -qt-libmng -qt-libjpeg -no-rpath -silent
-optimized-qmake -xplatform qws/linux-arm-g++ -embedded arm
-little-endian -qt-freetype -depths 16,24,32 -qt-mouse-tslib
-no-separate-debug-info -I $INCLUDE -L $LIB
---------------------------------------------------------------------------------------------------------------------------
安装:
---------------------------------------------------------------------------------------------------------------------------
sudo
make
sudo make install