作者:孙晓明,华清远见嵌入式学院讲师。
【实验环境】
1、主 机:Fedora9 DVD 发行版
2、目标机:虚拟机
3、源码包:
ftp://ftp.qtsoftware.com/qt/source/qt-x11-opensource-src-4.5.2.tar.gz
ftp://ftp.qtsoftware.com/qt/source/qt-embedded-linux-opensource-src-4.5.2.tar.gz
4、编译器 Fedora9 自带gcc version 4.3.0
1、解压源码:
[root@localhost ~]#mkdIR -p /opt/Qt_X_E
[root@localhost]# cd /opt/Qt_X_E
把的源码复制到这个目录
[root@localhost Qt_X_E]#cp /root/share/ qt-x11-opensource-src-4.5.2.tar.gz ./
[root@localhost Qt_X_E]#cp /root/share/ qt-embedded-linux-opensource-src-4.5.2.tar.gz ./
解压源码:
[root@localhost Qt_X_E] # tar xzvf qt-x11-opensource-src-4.5.2.tar.gz
[root@localhost Qt_X_E]# tar xzvf qt-embedded-linux-opensource-src-4.5.2.tar.gz
2、配置编译Qt源码:
[root@localhost Qt_X_E]# cd qt-x11-opensource-src-4.5.2
[root@localhost qt-x11-opensource-src-4.5.2]# ./configure
选择o确定开源版本,选择yes接受版权;
[root@localhost qt-x11-opensource-src-4.5.2]# make
[root@localhost qt-x11-opensource-src-4.5.2]# make install
[root@localhost qt-x11-opensource-src-4.5.2]# cd tools/qvfb
[root@localhost qvfb]# make
[root@localhost qvfb]# make install
[root@localhost qvfb]# cd ../../../
[root@localhost Qt_X_E] # file qt-x11-opensource-src-4.5.2/bin/qvfb
会看到如下信息,已经生成qvfb(接下来会用到):
/opt/Qt_X_E/qt-x11-opensource-src-4.5.2/bin/qvfb: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
3、配置编译QtE源码X86版本:
[root@localhost Qt_X_E] # mv qt-embedded-linux-opensource-src-4.5.2 qt-embedded-linux-opensource-src-4.5.2-x86
[root@localhost Qt_X_E] # cd qt-embedded-linux-opensource-src-4.5.2-x86
[root@localhost qt-embedded-linux-opensource-src-4.5.2-x86] # ./configure -prefix /usr/local/Trolltech/QtEmbedded-4.5.2-x86 -embedded x86 -qvfb
选择o确定开源版本,选择yes接受版权;
[root@localhost qt-embedded-linux-opensource-src-4.5.2-x86]# make
[root@localhost qt-embedded-linux-opensource-src-4.5.2-x86]# make install
[root@localhost qt-embedded-linux-opensource-src-4.5.2-x86]# cd ..
[root@localhost Qt_X_E] # file /usr/local/Trolltech/QtEmbedded-4.5.2-x86/examples/widgets/analogclock/analogclock
看到如下信息:
/usr/local/Trolltech/QtEmbedded-4.5.2-x86/examples/widgets/analogclock/analogclock: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped
[root@localhost Qt_X_E] # cp qt-x11-opensource-src-4.5.2/bin/qvfb /usr/local/Trolltech/QtEmbedded-4.5.2-x86/bin
4、在qvfb上运行example代码
建立配置脚本
[root@localhost Qt_X_E] # cd /usr/local/Trolltech/QtEmbedded-4.5.2-x86
[root@localhost QtEmbedded-4.5.2-x86]# vim setenv-x86.sh
添加如下内容:
QTEDIR=/usr/local/Trolltech/QtEmbedded-4.5.2-x86
PATH= $QTEDIR/bin:$PATH
LD_LIBRARY_PATH=$QTEDIR/lib:$LD_LIBRARY_PATH
保存退出.
[root@localhost QtEmbedded-4.5.2-x86]# source setenv-x86.sh
[root@localhost QtEmbedded-4.5.2-x86]# cd /examples/widgets/analogclock
[root@localhost analogclock]# qvfb -width 640 -height 480 &
[root@localhost analogclock]# ./analogclock –qws
看到如下界面:
免责声明: 凡注明来源本网的所有作品,均为本网合法拥有版权或有权使用的作品,欢迎转载,注明出处。非本网作品均来自互联网,转载目的在于传递更多信息,并不代表本网赞同其观点和对其真实性负责。