qt移植

1
   1.1 下载qt-embedded-linux-opensource-src-4.5.3.tar.gz源码
   下载地址 http://get.qt.nokia.com/qt/source/qt-embedded-linux-opensource-src-4.5.3.tar.gz
  
   1.2 解压文件
   下载的压缩文件位于/home/zhoumin/open-source/目录下,
   #cd /home/zhoumin/open-source      //进入源码包所在的目录
   #tar -xvzf qt-embedded-linux-opensource-src-4.5.3.tar.gz  //解压源码在当前的目录。
  
   解压成功,最后会生成qt-embedded-linux-opensource-src-4.5.3目录。

 2 编绎源码
   2.1 指定编绎器类型
   #cd qt-embedded-linux-opensource-src-4.5.3
   #vim mkspecs/qws/linux-arm-g++/qmake.conf
   把所有的arm-linux-**改为arm-hismall-linux-**
  
   2.2 配置configure
   指定编绎哪些模块,哪些模块不编绎。 编译最好将压缩包拷到linux系统再解压,编译。 否则编译的时候qt会生成一个头文件,如果在源文件在wndows下,可能生成该文件失败,导致不能编译。 

     ./configure -release -arch arm -xplatform qws/linux-arm-g++ -opensource -confirm-license -static -fast -no-largefile -no-exceptions -no-accessibility -stl -no-qt3support -no-xmlpatterns -no-phonon -no-phonon-backend -no-svg -no-webkit -no-scripttools -no-mmx -no-3dnow -no-sse -no-sse2 -qt-zlib -no-gif -no-libpng -no-libtiff -no-libmng -no-libjpeg -no-openssl -no-rpath -no-optimized-qmake -no-nis -no-cups -no-pch -no-dbus -no-armfpa -no-freetype -no-opengl -qt-gfx-linuxfb -no-gfx-transformed -no-gfx-qvfb -no-gfx-vnc -no-gfx-multiscreen -no-kbd-tty -no-kbd-qvfb -no-glib -nomake examples -nomake docs -nomake demos -nomake tools -prefix /home/neworange/qt-test/qt-453-hismall
     注: --prefix=/home/zhoumin/usr/qt/hismall 指定qt的库文件,demo程序等的安装目录为/home/zhoumin/usr/qt/hismall
/mnt/hgfs/3515/LIB/qt

2.2.1 有在qmake头文件的时候可能会出现一个问题。 就是编译qmake的命令出现两个编译器,这个问题第一次编译的时候基本没有出现,  若你使用过qt,自己设置一个环境变量  QMAKESPEC会导致这个问题,在configure的时候将该环境变量值设置为空。

   2.3 指定编绎时不编绎浏览器, 屏蔽webkit和browser,
   vim examples/examples.pro,屏蔽以下行(行首添加#)
   contains(QT_CONFIG, webkit): SUBDIRS += webkit

   vim demos/demos.pro,屏蔽以下两行(行首添加#)
   contains(QT_CONFIG, webkit):contains(QT_CONFIG, svg):SUBDIRS += demos_browser
   demos_browser.subdir = browser

  #/mnt/hgfs/3515/qt-everywhere-opensource-src-4.8.2/bin:
  #export PATH="/opt/hisi-linux/x86-arm/gcc-3.4.3-uClibc-0.9.28/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
  *编译时,你会发现他总是连接了g++,此时,修改mkspecs\common\g++.conf和linux.conf即可,将g++和gcc对应的修改为his平台的编译器
          2.4 gmake & gmake install

///这里可能会出错。 如出现以下情况:

painting/qprintengine_pdf.cpp: In member function `int QPdfEnginePrivate::writeCompressed(QIODevice*)':
painting/qprintengine_pdf.cpp:757: error: `::z_stream' has not been declared
painting/qprintengine_pdf.cpp:757: error: expected `;' before "zStruct"
painting/qprintengine_pdf.cpp:758: error: `zStruct' undeclared (first use this function)
painting/qprintengine_pdf.cpp:758: error: (Each undeclared identifier is reported only once for each function it appears in.)
painting/qprintengine_pdf.cpp:758: error: `Z_NULL' undeclared (first use this function)
painting/qprintengine_pdf.cpp:761: error: `::deflateInit' has not been declared
painting/qprintengine_pdf.cpp:761: error: `Z_DEFAULT_COMPRESSION' undeclared (first use this function)
painting/qprintengine_pdf.cpp:761: error: `Z_OK' undeclared (first use this function)
painting/qprintengine_pdf.cpp:775: error: `::deflateEnd' has not been declared
painting/qprintengine_pdf.cpp:781: error: `::deflate' has not been declared
painting/qprintengine_pdf.cpp:783: error: `::deflateEnd' has not been declared
painting/qprintengine_pdf.cpp:795: error: `::deflate' has not been declared
painting/qprintengine_pdf.cpp:795: error: `Z_FINISH' undeclared (first use this function)

就加上 -qt-zlib  。这个库不能放在最后,否则还是会有错,最好放在所有库的前面。这个问题有时候换下qt-zlib位置可以解决,有时候不能,则可以直接修改src/gui/Makefile 文件手动加入头文件 如-I../3rdparty/zlib/

   最终会在/home/zhoumin/usr/qt/hismall下看到如下目录。
    bin demos examples include lib mkspecs plugins

       3 开发板nfs运行qt程序。
   3.1 开发板mount 服务器下的/home/zhoumin 目录到 开发板的 /mnt 目录下。
       mount -t nfs -o nolock 192.168.*。*:/home/zhoumin /mnt
   3.2设定qt程序运行的环境变量 /mnt/usr/qt/hismall 为下载编绎qte 后生成的库所在的目录。
  export QTDIR=/mnt/usr/qt/hismall
  export PATH=$QTDIR/bin:$PATH
  export TSLIB_CONSOLEDEVICE=none
  export LD_LIBRARY_PATH=$T_ROOT/lib:$QTDIR/lib

 4 运行qt程序
   4.1 运行qt demo 程序前应先打开framebuffer设备文件,可以先运行海思提供的framebuffer演示demo程序。
    ./api_sample_hifb &  //程序后台执行
    我们的目的是打开framebuffer设备文件 ,自行写个小程序也行。

   4.2 运行qt程序。
    #cd /mnt/open-source/qt-embedded-linux-opensource-src-4.5.3/demos/affine
    #./affine -qws

    注:什么是QWS Client和QWS Server?
    QT Embedded也是一种C/S结构,需要有一个QT application做QWS Server,程序启动时带有-qws参数的就是QWS Server,不带这个参数就是QWS Client。
    因此任何一个基于QT的application都可以做QWS Server。当然QWS Server一定先于QWS Client启动,否则QWS Client将启动失败。在实际应用中,
    会指定某个特殊的application做QWS Server,这个application一般还会管理一些其它的系统资源。

 


 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值