QT移植中的一些问题

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  and TSLIB_TSDEVICE
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值