软件:VMware 7.0 ubuntu 10.10 eclipse QTE 版权所有:http://blog.csdn.net/sea918
虚拟机安装,与ubuntu 操作系统安装略
1,基础组件安装
1.1,安装GCC 开发环境
sudo apt-get install build-essential
1.2,安装基础组件libxtst-dev
sudo apt-get install libxtst-dev
1.3,安装QT 编译工具包
sudo apt-get install qt4-make
1.4,安装Qtdevelop,Qt设计器,Qt助手
sudo apt-get install qt4-dev-tools qt4-doc qt4-qtconfig qt4-demos qt4-designer
1.5, 安装qt开发的一个IDE环境,开发人员可以在这个IDE里面创建qt工程,编辑、编译、调试qt程序
sudo apt-get install qdevelop
1.6, 安装qcreator
sudo chmod +x qtcreator-linux-x86-opensource-1.3.83-201004300113-setup.bin
sudo ./qtcreator-linux-x86-opensource-1.3.83-201004300113-setup.bin
2,搭建开发环境
2.1,x86 QT安装
a,下载并解压源代码qt-everywhere-opensource-src-4.7.2.tar.gz 编译
tar -xvf qt-everywhere-opensource-src-4.7.2.tar.gz
cd qt-everywhere-opensource-src-4.7.2
./configure -prefix /usr/local/qt-x86 -qvfb
make
make install
b,编译模拟器并将目录文件拷贝到/usr/local/bin
cd tools/qvfb/
make
make install
2.2,x86 QTE安装
a,编译
./configure -prefix /usr/local/qte-x86 -embedded x86 -qt-gfx-qvfb -qt-kbd-qvfb -qt-mouse-qvfb
make
make install
b,导出环境变量
export QT4DIR=/usr/local/qt-x86
export QTEDIR=/usr/local/qte-x86
export PATH=$QTEDIR/bin:$QT4DIR/bin:$PATH
export LD_LIBRARY_PATH=$QT4DIR/lib:$QTEDIR/lib:$LD_LIBRARY_PATH
2.3,ARM QTE安装
a,下载并安装arm-linux-gcc编译器
tar xvzf ./arm-linux-gcc.4.1.1.tgz -C /
编辑/etc/environment
sudo gedit /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/arm/4.1.1/bin"
b,编译
./configure -prefix /usr/local/qte-arm -debug-and-release -qt3support -qt-zlib -qt-libtiff -qt-libpng -qt-libmng -qt-libjpeg -make libs -nomake examples -nomake demos -nomake docs -no-cups -iconv -xplatform qws/linux-arm-g++ -embedded arm -little-endian -qt-freetype -depths 8,16,24,32 -qt-gfx-linuxfb -no-gfx-transformed -no-gfx-qvfb -no-gfx-vnc -no-gfx-multiscreen -no-dbus -qt-sql-sqlite -qt-kbd-qvfb -qt-kbd-tty -qt-mouse-pc -no-glib -qt-mouse-tslib
make
sudo make install
2.4,设置IDE eclipse
a,安装JRE
sudo apt-get install java-sdk6-jre
合并这两个解压目录,并设置QT的库文件目录
c,编写程序并调试(x86模拟器)
首先用eclipse创建QT程序,然后启动命令行程序并键入qvfb & 来启动x86模拟器。 运行测试程序 效果图如下
d,编写程序并远程调试(arm 真机)
<1> 设置eclipse环境变量
设置QTE arm 版本 库的include 与 lib 目录
设置调试参数
Run -> debug configurations ->c/c++application->Debugger
debugger: 选择gdbserver
main:
Gdb debuger:选择 /usr/local/arm-gdb/bin/arm-linux-gdb
connection:
type: tcp
Host name or Ip address: 192.168.2.111 (目标板的IP地址)
prot:10000
下载并安装arm for eclipse 插件
<2>下载并编译arm-gdb远程调试器
编译arm gdb client
./configure --target=arm-linux --prefix=/usr/local/arm-gdb
make
make install
编译 gdbserver
cd gdb/gdbserver
./configure --target=arm-linux --host=arm-linux
make CC=/usr/local/arm-gdb
make install
将生成 的gdbserver 可执行程序拷贝到目标板/usr/bin/ 目录
<3>开发机设置NFS共享
安装 NFS 服务
sudo apt-get install nfs-kernel-server
sudo apt-get install nfs-common
编辑/etc/exports 写入要共享的目录
sudo gedit /etc/exports
/home/ocean/workspace 192.168.*.* (rw,sync,no_root_squash)
启动服务
$sudo /etc/init.d/portmap restart
$sudo /etc/init.d/nfs-kernel-server restart
检查 是否正确导出了共享 目录
showmount -e
<4>目标板加载开发机的共享目录
mount 192.168.2.101:home/ocean/workspace /mnt/NFS (开发主机的IP 地址)
<5>启动目标板上的gdbserver 进行远程调试
gdbserver 192.168.2.101:10000 qttest (开发主机的IP 地址)
点击eclipse 上debug 按键进行调试。