分享

qtopia安装,交叉编译

 昵称14129940 2013-11-12
软件版本:qtopia-free-2.2.0

一、在/root/imx27/下解压qtopia-free-src-2.2.0.tar.gz
tar -xzvf qtopia-free-src-2.2.0.tar.gz
cd /root/imx27/qtopia-free-2.2.0
./configure
make

得到本机运行版本uic工具

在make的时候出现了大量的错误,具体为:
Q1:
backend/event.cpp: In static member function ‘static int Event::dayOfWeek(char)’:
backend/event.cpp:419:
error: ISO C++ says that these are ambiguous, even though the worst
conversion for the first is better than the worst conversion for the
second:
backend/event.cpp:419: note: candidate 1: operator
/home/henryfok/TrollTech/qt-2.3.10/include/qstring.h:312: note: candidate 2: int operator
解决办法:
修改 qtopia-free-2.1.1/src/libraries/qtopia/backend/event.cpp 文件的第419行
将while ( !( i & day ) && i
while ( !static_cast(( i & day ) && i)
Q2:
/root/imx27/qtopia-free-2.2.0/qt2/include/qwindowsystem_qws.h:230: 错误:‘QWSInputMethod’ 未声明
/root/imx27/qtopia-free-2.2.0/qt2/include/qwindowsystem_qws.h:237: 错误:‘QWSGestureMethod’ 未声明
解决办法:
找到文件:qwindowsystem_qws.h
在该文件的前面添加如下两行:
class QWSInputMethod;
class QWSGestureMethod;
Q3:
/root/imx27/qtopia-free-2.2.0/qt2/include/qvaluestack.h:57: 错误:不能从
‘QValueListIterator >’ 转换到 ‘const
char*’,为实参 ‘1’(属于 ‘int remove(const char*)’)
/root/imx27/qtopia-free-2.2.0/qt2/include/qvaluestack.h: In member function ‘T QValueStack::pop() [with T = QString]’:
xml/qxml.cpp:2532:   instantiated from here
/root/imx27/qtopia-free-2.2.0/qt2/include/qvaluestack.h:57:
错误:不能从 ‘QValueListIterator’ 转换到 ‘const char*’,为实参 ‘1’(属于
‘int remove(const char*)’)
解决办法:
更改qt-2.3.2文件夹中src/tools/qvaluestack.h第57行源代码:
remove (this->formLast() );
为:
this->remove (this->formLast() );
Q4:
qdawg.cpp:294: 错误:有多余的限定 ‘QDawgPrivate::’ 在成员 ‘QDawgPrivate’ 上
解决办法:
找到qdawg.cpp文件,把其中的第294行修改为:
    ~QDawgPrivate()
    {
        delete memoryFile;
    }
Q5:
thumbnailview_p.h:81: 错误:有多余的限定 ‘ThumbnailItem::’ 在成员 ‘paintItem’ 上
解决办法:
   void ThumbnailItem::paintItem( QPainter*, const QColorGroup& );
修改为:    void paintItem( QPainter*, const QColorGroup& );
Q6:
abtable_p.h:277: 错误:有多余的限定 ‘PhoneTypeSelector::’ 在成员 ‘addType’ 上
解决办法:
QListViewItem* PhoneTypeSelector::addType(QListViewItem* prevItem,
        QString number, const char* pixmapName, PimContact::ContactFields phoneType);
修改为:
QListViewItem* addType(QListViewItem* prevItem,
        QString number, const char* pixmapName, PimContact::ContactFields phoneType);
Q7:
../../../include/qtopia/pim/private/../../../../src/libraries/qtopiapim/numberentry_p.h:106:
错误:有多余的限定 ‘NumberEntryDialog::’ 在成员 ‘eventFilter’ 上
解决办法:
    bool NumberEntryDialog::eventFilter(QObject *o, QEvent *e);
修改为:
bool eventFilter(QObject *o, QEvent *e);
Q8:
videoviewer.cpp:52: 错误:有多余的限定 ‘SimpleVideoWidget::’ 在成员 ‘SimpleVideoWidget’ 上
解决办法:
    SimpleVideoWidget::SimpleVideoWidget(QWidget *parent);
修改为:
    SimpleVideoWidget(QWidget *parent);
Q9:
ablabel.h:78: 错误:有多余的限定 ‘AbLabel::’ 在成员 ‘decodeHref’ 上
解决办法;
    bool AbLabel::decodeHref(const QString& href, ServiceRequest* req, QString* pm) const;
修改为:
    bool decodeHref(const QString& href, ServiceRequest* req, QString* pm) const;
Q10:
minefield.h:105: 错误:有多余的限定 ‘MineField::’ 在成员 ‘setState’ 上
minefield.h:106: 错误:有多余的限定 ‘MineField::’ 在成员 ‘placeMines’ 上
解决办法:
修改为:
    void setState( State st );
    void placeMines();
Q11:
buttoneditordialog.h:56: 错误:有多余的限定 ‘ButtonEditorDialog::’ 在成员 ‘actionFor’ 上
解决办法:
    ServiceRequest ButtonEditorDialog::actionFor(int cur) const;
修改为:
ServiceRequest actionFor(int cur) const;
Q12:
packagewizard.h:106: 错误:有多余的限定 ‘PackageWizard::’ 在成员 ‘current’ 上
解决办法:
PackageItem* PackageWizard::current() const;
修改为:
PackageItem* current() const;
Q13:
keyboard.h:60: 错误:有多余的限定 ‘KeyboardPicks::’ 在成员 ‘KeyboardPicks’ 上
解决办法:
   KeyboardPicks::~KeyboardPicks();
修改为:
  ~KeyboardPicks();
Q14:
polished.h:58: 错误:有多余的限定 ‘PolishedDecoration::’ 在成员 ‘drawBlend’ 上
解决办法:
void PolishedDecoration::drawBlend( QPainter *, const QRect &r, const QColor &c1, const QColor&c2 ) const;
修改为:
void drawBlend( QPainter *, const QRect &r, const QColor &c1, const QColor&c2 ) const;
Q15:
inputmethods.cpp:86: 错误:有多余的限定 ‘IMToolButton::’ 在成员 ‘IMToolButton’ 上
解决办法:
IMToolButton::IMToolButton( QWidget *parent ) : QToolButton( parent )
修改为:
IMToolButton( QWidget *parent ) : QToolButton( parent )

上面提到的大部分错误都是C++的错误,可能所列的错误在每个人的环境中所显现的错误不一致,大家仔细看看都是可以解决的。

二、交叉编译qtopia-free-2.2.0

2.1创建PDA安装目录
mkdir /root/imx27/qtopia
cd /root/imx27/qtopia-free-2.2.0
修改文件:
vim /root/imx27/qtopia-free-2.2.0/qt2/src/kernel/qwsmouse_qws.cpp
这个文件是修改校准文件存放位置的,如果是可读写的文件系统,可以不需要修改。
修改文件:
vim /root/imx27/qtopia-free-2.2.0/qtopia/mkspecs/qws/linux-arm-g++/qmake.conf
将此行
QMAKE_LIBS_QT = -lqte
修改为:
QMAKE_LIBS_QT = -lqte -lpng -lts -lz -luuid -ljpeg

2.2 创建编译环境
export QTDIR=/root/imx27/qtopia-free-2.2.0/qt2
export QPEDIR=/root/imx27/qtopia-free-2.2.0/qtopia
export LD_LIBRARY_PATH=$QTDIE/lib:$QPEDIR/lib:$LD_LIBRARY_PATH
export TMAKEDIR=/root/imx27/qtopia-free-2.2.0/tmake
export TMAKEPATH=$TMAKEDIR/lib/qws/linux-arm-g++
在/root/imx27/qtopia-free-2.2.0/qtopia/src/qt/qconfig-qpe.h的末尾加上,
#define QT_QWS_IPAQ
#define QT_QWS_IPAQ_RAW
这是使qt自己支持触摸屏。
cp /root/imx27/qtopia-free-2.2.0/qtopia/src/qt/qconfig-qpe.h /root/imx27/qtopia-free-2.2.0/qt2/src/tools

cd $QPEDIR/src/libraries/qtopia
cp custom-linux-ipaq-g++.cpp custom-linux-arm-g++.cpp
cp  custom-linux-ipaq-g++.h custom-linux-arm-g++.h

2.3
configure 配置:
./configure -qte "-embedded -xplatform
linux-arm-g++ -qconfig qpe -no-qvfb -depths 16,24 -system-jpeg
-system-libpng -system-zlib -tslib -gif -thread -no-xft -release
-I/root/imx27/arminclude -L/root/imx27/armlib -lpng -lts -lz -luuid
-ljpeg" -qpe '-xplatform linux-arm-g++ -edition pda -displaysize
800x480 -I/root/imx27/arminclude -L/root/imx27/armlib
-prefix=/root/imx27/qtopia'
make
make install
安装后的文件在/root/imx27/qtopia中。
通过上面产生uic的一些操作,使得产生的错误就比较少了。
不过还可能产生jpeg的一些头文件或者是tslib的一些头文件活着是库文件找不到,这时候只需要把前面编译通过的jipeg的头文件以及库
文件分别放在/root/imx27/arminclude和/root/imx27/armlib中即可,大部分的错误都是可以这样的解决的。
三、测试
3.1 拷贝库和测试程序
mkdir /root/imx27/qtopia/bin/tests
mkdir /root/imx27/qtopia/lib/ts
cp /root/imx27/tslib-1.3/test/.libs/ts_* /root/imx27/qtopia/bin/tests
cp /root/imx27/tslib-1.3/src/.libs/libts_0.0.so.0* /root/imx27/qtopia/lib
cp /root/imx27/tslib-1.3/src/.libs/libts.so /root/imx27/qtopia/lib
cp /root/imx27/tslib-1.3/plugins/.libs/*.so /root/imx27/qtopia/lib/ts
cp /roo    t/imx27/armlib/*.so* /root/imx27/qtopia/lib //所有需要的支持的库文件
将qtopia复制到nfs目录
cp -r /root/imx27/qtopia /home/yuehy/rootfs
注意:把文件/root/imx27/tslib-1.3/etc/ts.conf拷贝到板子的/etc目录下
3.2 环境变量设置
  在开发板上进行环境变量设置
export QTDIR=/qtopia
export QPEDIR=/qtopia
export QWS_MOUSE_PROTO=TPanel:/dev/ts
export LD_LIBRARY_PATH=/qtopia/lib
export TSLIB_TSEVENTTYPE=H3600  //对tslib中的设备结构体定义
export TSLIB_CONSOLEDEVICE=none //tslib运行需要的控制台,这里就是LCD屏幕 ,设定控制台设备为none,否则默认为/dev/tty
export TSLIB_FBDEVICE=/dev/fb0  //指定帧缓冲设备
export TSLIB_TSDEVICE=/dev/ts //指定开发板对应触摸屏设备节点文件
export TSLIB_CALIBFILE=/etc/pointercal //指定触摸屏校准文件pintercal的存放位置,注意目录的读写权限。
export TSLIB_CONFFILE=/etc/ts.conf //指定TSLIB配置文件的位置
export TSLIB_PLUGINDIR=$QTDIR/lib/ts //指定触摸屏插件所在路径
在设置好以上的环境变量后对触摸屏进行校验
cd /qtopia/etc/bin/tests
./ts_calibrate
陆续在LCD的4个角和中点出现光标,点击光标进行校准,生成校准文件
校验文件产生以后,就可以对运行qpe程序了。
cd /qtopia/etc/bin
./qpe.

另:在编译过程可能产生各种各样的错误,其实都是仔细看看都是都是可以解决的,自己做的就是根据网络上的资料,自己重新走了一遍。
自己还遇到了一个不常见的错误:
在包含自 3rdparty/opentype/ftxopentype.c:3 的文件中:
3rdparty/opentype/ftxopen.c:18:40: 错误:freetype/internal/ftstream.h:没有那个文件或目录
3rdparty/opentype/ftxopen.c:19:40: 错误:freetype/internal/ftmemory.h:没有那个文件或目录
3rdparty/opentype/ftxopen.c:20:39: 错误:freetype/internal/tttypes.h:没有那个文件或目录
之所以产生这个问题是由于开发机本身的freetype版本与qtopia所使用的版本不一致所造成的,qtopia-free-2.2.0所需要的freetype的版本为:freetype-2.1.10
解决办法:
解决这个问题有两种方法,一是卸载系统本上的freetype库,重新编译安装版本为:freetype-2.1.10,(我看了下我的版本事2.1.9)如果主机系统本来的版本比2.1.10高的话,那么编译后的freetype-2.1.10放在一个临时目录里面就可以了,在交叉编译qtopia的时候,引用到这个库文件就可以了。
PS:原文:http://blog./u/25572/showart_1334472.html

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多