QT移植

转载 2013年12月04日 10:47:46

http://zhuhaibobb.blog.163.com/blog/static/27440067201061341131184/

Hardware:

    AT91SAM9263
Software: 
    qt-embedded-linux-opensource-src-4.4.3.tar.gz
    qt-x11-opensource-src-4.4.3.tar.gz
    arm-linux-gcc-3.4.1.tar.bz2
    tslib-1.4.tar.gz

Before we begin the installation, we have to install some tools first:
1. automake
2. autoconf
3. libtool
4. libxtst-dev
5. minicom / cu


1) Install Arm-Linux-GCC-3.4.1:
#mv arm-linux-gcc-3.4.1.tar.bz2 /
#tar jxf arm-linux-gcc-3.4.1.tar.bz2
#export /usr/local/arm/3.4.1/bin

2) Compiling tslib-1.4 (Touch Screen Library):
I installed tslib to /opt/tslib
#tar zxf tslib-1.4.tar.gz
#cd tslib
#vi etc/ts.conf
...
# Uncomment if you wish to use the linux input layer event interface
module_raw input 
/*Uncomment this line*/
...
#./autogen.sh /*this produces './configure' file */
#mkdir /opt/tslib /*path of destination for installing */
#./configure --prefix=/opt/tslib CC=arm-linux-gcc CXX=arm-linux-g++ --host=arm-linux ac_cv_func_malloc_0_nonnull=yes
#make
#make install
If you got an error like this while you were compiling:
configure.ac:25: error: possibly undefined macro: AC_DISABLE_STATIC
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure.ac:26: error: possibly undefined macro: AC_ENABLE_SHARED
configure.ac:27: error: possibly undefined macro: AC_LIBTOOL_DLOPEN
configure.ac:28: error: possibly undefined macro: AC_PROG_LIBTOOL
autoreconf: /usr/bin/autoconf failed with exit status: 1
means that you have not installed 'libtool' yet.

3) Compiling Qt-X11:
#cd qt-x11-opensource-src-4.4.3/
#./configure -qvfb
#make
#make install
A couple hours later...

4) Compiling Qt-Embedded:
See configure options(Qt Embedded) for your requests
A few times I tried then I got errors like this :
...
tslib functionality test failed
You might need to modify the include and library search paths by editing
QMAKE_INCDIR and QMAKE_LIBDIR in
/home/robert/my_work/qt-embedded-linux-opensource-src-4.4.3/mkspecs/qws/linux-arm-g++
I think that would be an environment setting error about arm compiler.
Modifying configure file:
#cd qt-embedded-linux-opensource-src-4.4.3
#vim mkspecs/qws/linux-arm-g++/qmake.conf
...
QMAKE_CC         = arm-linux-gcc
QMAKE_CXX        = arm-linux-g++
QMAKE_LINK       = arm-linux-g++
QMAKE_LINK_SHLIB = arm-linux-g++
QMAKE_AR         = arm-linux-ar cqs
QMAKE_OBJCOPY    = arm-linux-objcopy
QMAKE_RANLIB     = arm-linux-ranlib
QMAKE_STRIP      = arm-linux-strip

...
#./configure -prefix /usr/local/qt \
-fast \
-embedded arm \
-xplatform qws/linux-arm-g++ \
-no-largefile \
-qt-sql-sqlite \
-no-qt3support \
-no-phonon \
-no-svg \
-no-webkit \
-no-assistant-webkit \
-no-mmx \
-no-3dnow \
-no-sse \
-no-sse2 \
-no-opengl \
-qt-zlib \
-qt-gif \
-qt-libtiff \
-qt-libpng \
-qt-libmng \
-qt-libjpeg \
-no-openssl \
-nomake translations \
-nomake docs \
-make libs  \
-make tools \
-no-dbus \
-little-endian \
-feature-THREAD \ 
-feature-CONCURRENT \ 
-qt-gfx-linuxfb \
-qt-gfx-vnc \
-no-gfx-qvfb -no-kbd-qvfb -no-mouse-qvfb \
-qt-kbd-usb \
-qt-mouse-tslib \
-I/opt/tslib/include \  /*include path of tslib*/
-L/opt/tslib/lib \  /*library path of tslib*/
-v
-silent > log_cfg 2>&1 
#make && make install

5) Setup Environment Variables:
2 ways to add the environment parameters.
(1)Modifying ~/.bashrc for current user.
(2)Modifying /etc/profile for All users(include root & users).
e.g.
#vi /etc/profile 
...
export PATH=$PATH:/usr/local/arm/3.4.1/bin:/usr/local/qte/bin
...
#source /etc/profile /*Apply settings immediately*/

6) Porting QT-Embedded:
I copied library & plugins to /opt/qt.
#cp -R /usr/local/qte/lib/libQt*.so.4.4.3 /opt/qt
#cp -R /usr/local/qte/plugins/imageformats /opt/qt/plugins 
#cp -R /usr/local/qte/lib/fonts /opt/qt/lib
Create Links:
#cd /opt/qt/lib
#ln -s libQtCore.so.4.4.3 libQtCore.so.4
#ln -s libQtGui.so.4.4.3 libQtGui.so.4
#ln -s libQtNetwork.so.4.4.3 libQtNetwork.so.4
#ln -s libQtSql.so.4.4.3 libQtSql.so.4
#ln -s libQtScript.so.4.4.3 libQtScript.so.4
#ln -s libQtXml.so.4.4.3 libQtXml.so.4
#ln -s libQtTest.so.4.4.3 libQtTest.so.4
#tar zcf /opt/qt.tar.gz /opt/qt
#tar zcf /opt/tslib.tar.gz /opt/tslib

I used Minicom & TFTP to burn files into the board. Just like...
#minicom -s
...
+-----[configuration]-----+
Filenames and paths
File transfer protocols
Serial port setup <-- Choose this to configure serial port
Modem and dialing
Screen and keyboard
Save setup as df1 <-- Choose this to save settings
Save setup as ..
Exit <-- Choose this to back to minicom screen
Exit from Minicom
...
=====Modify settings like this ===
A- Serial Device         : /dev/ttyS0
B- Lockfile Location     : /var/lock
C- Callin Program        :
D- Callout Program       :
E- Bps/Par/Bits          : 115200 8N1
F- Hardware Flow Control : No
G- Software Flow Control : No
...
Another way to log in.
#cu -l /dev/ttyS0 -s 115200 --nostop
If got error like this while using cu.
cu: open (/dev/ttyS0): Permission denied
cu: /dev/ttyS0: Line in use
Fix it :
#chgrp dialout /dev/ttyS0
or
#chmod 666 /dev/ttyS0

After we'd been logging in embedded system.
#ifconfig eth0 192.168.1.33 /*Source IP*/
#tftp -g -l qt.tar.gz 192.168.1.34 /*Destination IP*/
#mv qt.tar.gz /opt
#tar zxf qt.tar.gz
#tftp -g -l tslib.tar.gz 192.168.1.34
#mv tslib.tar.gz /opt
#tar zxf tslib.tar.gz
#vi /etc/profile
...
export QTDIR=/opt/qt
export TSDIR=/opt/tslib
export PATH=$QTDIR:$QTDIR/plugins:$TSDIR/bin:$PATH 
export LD_LIBRARY_PATH=$QTDIR/lib:$QTDIR/plugins/imageformats:$TSDIR/lib:$LD_LIBRARY_PATH 
export QT_PLUGIN_PATH=$QTDIR/plugins/ 
export QT_QWS_FONTDIR=$QTDIR/lib/fonts 
export QWS_DISPLAY="LinuxFb:/dev/fb0"
#export QWS_DISPLAY="LinuxFb:mmWidth100:mmHeight130:0"  /*Optional*/
export QWS_SIZE=240x320
export QWS_MOUSE_PROTO="tslib:/dev/event0"
export TSLIB_CALIBFILE="/etc/pointercal" /*this file would be created by executing ts_calibrate*/
export TSLIB_CONFFILE="/opt/tslib/etc/ts.conf"
export TSLIB_CONSOLEDEVICE="none"
export TSLIB_FBDEVICE="/dev/fb0"
export TSLIB_PLUGINDIR=$TSDIR/lib/ts
export TSLIB_TSDEVICE="/dev/event1"

...
#source /etc/profile

7) Hello World:
Snippet Code:
  1.  #include <QApplication>  
  2.  #include <QPushButton>  
  3.   
  4.  int main(int argc, char *argv[])  
  5.  {  
  6.      QApplication app(argc, argv);  
  7.   
  8.      QPushButton hello("Hello world!");  
  9.   
  10.      hello.show();  
  11.      return app.exec();  
  12.  }  
#include <QApplication> #include <QPushButton> int main(int argc, char *argv[]) {      QApplication app(argc, argv);      QPushButton hello("Hello world!");      hello.show();      return app.exec(); }Run on ARM.
#./hello -qws

Some errors I collected from internet & sorted out here.

1.
error while loading shared libraries: librt.so.1: cannot open shared object file: No such file or directory
This means that you need to copy librt.so.1 library into your board.

2.
blit_setup(): Screen depth 15 not supported! / solidFill_setup(): Screen depth 15 not supported!
You properbly need to re-configure your qt-embedded. 
Try to remove "-depths" option from configure options.

3.
Initializing QFontEngineQPF failed for /usr/local/qt/lib/fonts/DejaVuSans.ttf
See this page:Qt/E 4.x
Try to add "-fn DejaVuSans" option. E.g.
./hello -qws -fn DejaVuSans

4.
QWSSocket::connectToLocalFile could not connect:: Connection refused / Segmentation fault
This would be needed to reset tslib environment variables. 

5.
selected device is not a touchscreen I understand
This means that you have to change environment varaibles about QWS_MOUSE_PROTO andTSLIB_TSDEVICE

QT移植中的一些问题

http://zhuhaibobb.blog.163.com/blog/static/27440067201061341131184/ Hardware:     AT91SAM9263 S...
  • USB_ABC
  • USB_ABC
  • 2016年06月10日 09:33
  • 822

ubuntu下嵌入式开发环境的搭建

ubuntu下基于linux嵌入式开发环境的搭建
  • sudy103810
  • sudy103810
  • 2016年08月24日 15:41
  • 815

Qt 程序使用自带 ttf 字体示例

TTF简介  TTF(TrueTypeFont)是 Apple 公司和 Microsoft 公司共同推出的字体文件格式,随着二十多年来 windows 的流行,目前 TTF 已经变成最常用的一种字体文...
  • luckydarcy
  • luckydarcy
  • 2017年12月08日 17:24
  • 286

Qt之字体文件(TTF)

简述TTF(TrueTypeFont)是Apple公司和Microsoft公司共同推出的字体文件格式,随着windows的流行,已经变成最常用的一种字体文件表示方式。在一些特殊的场合,系统字符集不包含...
  • u011012932
  • u011012932
  • 2016年06月15日 13:35
  • 6432

从零开始移植QT4.8.5之三--linux下交叉编译QT运行库

这篇文章要实现的目标是在linux下交叉编译QT在嵌入式设备OK6410的运行库,最终在OK6410上运行QT演示程序。 1、触摸屏库文件安装tslib 首先如果嵌入式设备上有触摸屏,需要先移植t...
  • andylauren
  • andylauren
  • 2016年07月22日 23:22
  • 3584

移植Qt4.8.5到mini2440开发板

之前移植过6410的,本来想直接用以前的库,发现不行,好像是编译器的问题,...
  • u010842812
  • u010842812
  • 2014年11月20日 07:26
  • 1117

天嵌开发版 imx6 移植qt

1.环境说明 QT 移植 - 系统: ubuntu 14.04 x64 - 编译器: arm-none-linux-gnueabi-gcc 4.8.3 - QT 5.5.1 2.下载源码 ...
  • imhml1987
  • imhml1987
  • 2015年11月05日 18:43
  • 2698

移植QT5.6到嵌入式开发板(史上最详细的QT移植教程)

目前网上的大多数 QT 移植教程还都停留在 qt4.8 版本,或者还有更老的 Qtopia ,但是目前 Qt 已经发展到最新的 5.7 版本了,我个人也已经使用了很长一段时间的 qt5.6 for w...
  • lizuobin2
  • lizuobin2
  • 2016年09月28日 08:54
  • 24657

ARM QT移植详细步骤教程

米尔SAM9X5和A5D3X上默认的Qt版本是4.5.3,当这个版本的Qt库不能满足实际开发需求时,可通过此方法制定Qt开发、运行环境。 移植的步骤如下: 1、下载新版qt; 2、编译tsl...
  • imxiangzi
  • imxiangzi
  • 2015年08月07日 11:28
  • 1540

使嵌入式Qt支持中文字体变换的方法(makeqpf)

QT4.7.0在移植到开发板上的时候,中文支持是必不可少的,如何让QT支持中文,如何制作QT支持的字体文件,如何使QT UI编辑器中的字号与开发板中的字号一致。作者通过实验进行了一一验证。 介绍: ...
  • zgrjkflmkyc
  • zgrjkflmkyc
  • 2013年06月10日 13:15
  • 10128
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:QT移植
举报原因:
原因补充:

(最多只允许输入30个字)