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
  • 709

QT程序在HI3531板上运行丢失字体

# ./gui_test -qws Initializing QFontEngineQPF failed for /mnt/qt4.8.6/lib/fonts/DejaVuSans.ttf Ini...
  • USB_ABC
  • USB_ABC
  • 2016年06月11日 22:14
  • 776

qt移植必看

  • 2014年11月06日 10:46
  • 2KB
  • 下载

Qt 4.8.4 交叉编译移植

  • 2014年12月25日 08:49
  • 80KB
  • 下载

Qt开发:UDP、TCP发送文字消息、检测U盘插拔、SYSZUXpinyin软键盘输入法移植------[源码奉送]

开发环境为Linux+Qt, 功能是实现tcp 、udp发送消息,检测U盘插拔、同时在arm端移植syszuxpinyin软键盘出入法。下面是我当时的工作总结。下面是效果图:关于tcp、udp: 工作...

qt4.5.1移植2440

  • 2010年04月14日 19:32
  • 265KB
  • 下载

QT4.8.2在hi3531上的移植

1.准备工作 (1)源代码:qt-embedded-linux-opensource-src-4.8.2 下载地址:ftp://ftp.qt.nokia.com/qt/source/。 参考资料...

qt4.8.4移植到linux3.4.2

  • 2017年05月09日 12:30
  • 29KB
  • 下载

QT4.8+opencv2.0移植到arm6410

  • 2012年04月30日 23:00
  • 102KB
  • 下载
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:QT移植
举报原因:
原因补充:

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