编译qtopia时出错解决方案

1:安装g++。这个必须有,你懂的。yum install gcc-c
2:先贴一些常见的错误出来.我也是网上找的。
在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 的错误,可能所列的错误在每个人的环境中所显现的错误不一致,大家仔细看看都是可以解决的。
Q16:
make[5]: Entering directory `/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/src/libraries/qtopia'
g -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -Os -fPIC  -DQTOPIA_DATA_LINKING -DQCONFIG=\"qconfig-qpe.h\" -DQTOPIA_TARGET=\"qpe\" -DQTOPIA_TRTARGET=\"libqpe\" -DQT_NO_DEBUG -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/mkspecs/qws/ linux-generic-g -I. -I../../../include/qtopia/private -I../../../pics/qpe -I../../../include -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/include -I../../../include/qtopia/private/ -I.moc/release-shared/ -o .obj/release-shared/vobject.o backend/vobject.cpp
backend/vobject.cpp: In function ‘VObject* addGroup(VObject*, const char*)’:
backend/vobject.cpp:419: error: invalid conversion from ‘const char*’ to ‘char*’
backend/vobject.cpp: In function ‘void writeEncString(OFile*, const char*, bool)’:
backend/vobject.cpp:1111: warning: suggest parentheses around ‘&&’ within ‘||’
backend/vobject.cpp: In function ‘bool includesUnprintable(VObject*, bool)’:
backend/vobject.cpp:1168: warning: suggest parentheses around ‘&&’ within ‘||’
backend/vobject.cpp:1169: warning: suggest parentheses around ‘&&’ within ‘||’
make[5]: *** [.obj/release-shared/vobject.o] Error 1
make[5]: Leaving directory `/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/src/libraries/qtopia'
解决方法:
修改/x86-qtopia-2.2.0/qtopia/src/libraries/qtopia/backend/vobject.cpp:419行
char *dot = strrchr(g,'.');

char *dot = (char*)strrchr(g,'.');
Q17:

/usr/bin/ld: cannot find -luuid
collect2: ld returned 1 exit status
make[5]: *** [../../../lib/libqpe.so.1.5.3] Error 1
make[4]: *** [all] Error 2
make[3]: *** [sub-libraries-qtopia] Error 2
make[2]: *** [all] Error 2
make[1]: *** [all] Error 2

只好去编译e2fsprogs-1.39.tar.gz

#tar -zxvf  e2fsprogs-1.39.tar.gz

#cd e2fsprogs-1.39

#./configure

#make

以上我都正常完成,现在拷贝/e2fsprogs-1.39/lib/libuuid.a到/usr/lib

再回到qtopia-free-src-2.2.0

#cd qtopia-free-src-2.2.0

#make

新的问题出现:

/home/arm/qtopia-free-2.2.0/qtopia/lib/libqtopia.so: undefined reference to `uuid_generate'
collect2: ld returned 1 exit status
make[6]: *** [fifteen] Error 1
make[5]: *** [all] Error 2
make[4]: *** [sub-games-fifteen] Error 2
make[3]: *** [sub-src-components_pro] Error 2
make[2]: *** [all] Error 2
make[1]: *** [all] Error 2

这个问题错误我在http://www.qtcn.org/bbs/read.php?tid=4857找到了答案:

#cd e2fsprogs-1.39

#./configure --enable-elf-shlibs

#make

#cp -rf lib/libuuid.so* /usr/lib

 Q18:

make[4]: *** [.obj/release-shared/global1.o] Error 1

make[4]: Leaving directory `/home/zlx/qtopia/src/libraries/qtopia1'

make[3]: *** [all] Error 2

make[3]: Leaving directory `/home/zlx/qtopia/src/libraries/qtopia1'

make[2]: *** [sub-libraries-qtopia1] Error 2

make[2]: Leaving directory `/home/zlx/qtopia/src'

make[1]: *** [all] Error 2

make[1]: Leaving directory `/home/zlx/qtopia/src'

make: *** [all] Error 2

解决方法:(下面路径为你安装e2fsprogs,不明白见问题17)

cp -r /home/zlx/e2fs/lib/uuid  ./src/libraries/qtopia1

Q19

make[4]: *** [.obj/release-shared/pimrecord.o] Error 1

make[4]: Leaving directory `/home/zlx/qtopia/src/libraries/qtopiapim'

make[3]: *** [all] Error 2

make[3]: Leaving directory `/home/zlx/qtopia/src/libraries/qtopiapim'

make[2]: *** [sub-libraries-qtopiapim] Error 2

make[2]: Leaving directory `/home/zlx/qtopia/src'

make[1]: *** [all] Error 2

make[1]: Leaving directory `/home/zlx/qtopia/src'

make: *** [all] Error 2

执行以下命令

cp -r /home/zlx/e2fs/lib/uuid  ./src/libraries/qtopiapim

Q20

videoviewer.cpp:52: 错误:有多余的限定 ‘SimpleVideoWidget::’ 在成员 ‘SimpleVideoWidget’ 上
解决办法:
    SimpleVideoWidget::SimpleVideoWidget(QWidget *parent);
==> SimpleVideoWidget(QWidget *parent);

Q21:
wavplugin.cpp: 在成员函数‘virtual bool WavPlugin::isFileSupported(const QString&)’中:
      wavplugin.cpp:435:45: 错误:从类型‘const char*’到类型‘char*’的转换无效
修正/x86-qtopia-2.2.0/qtopia/src /plugins/codecs/wavplugin/wavplugin.cpp:435行
       char *ext = strrchr( path.latin1(), '.' );
为    char *ext = (char*)strrchr( path.latin1(), '.' );
Q21

make[5]: *** [.obj/release-shared/transferserver.o] Error 1

make[5]: Leaving directory `/home/zlx/qtopia/src/server'

make[4]: *** [all] Error 2

make[4]: Leaving directory `/home/zlx/qtopia/src/server'

make[3]: *** [sub-server] Error 2

make[3]: Leaving directory `/home/zlx/qtopia/src'

make[2]: *** [sub-src-components_pro] Error 2

make[2]: Leaving directory `/home/zlx/qtopia/src'

make[1]: *** [all] Error 2

make[1]: Leaving directory `/home/zlx/qtopia/src'

make: *** [all] Error 2

执行以下命令

cp -r /home/zlx/e2fs/lib/uuid  /home/zlx/qtopia/src/server

Q22

       /usr/bin/ld: .obj/release-shared/transferserver.o: undefined reference to symbol 'crypt@@GLIBC_2.0'
       /usr/bin/ld: note: 'crypt@@GLIBC_2.0' is defined in DSO /lib/libcrypt.so.1 so try adding it to the linker command line

       这个找了好久发现用了crypt函数 而没使用-lcrypt,   qtopia-2.2.0-FriendlyARM/qtopia/configure  1373行加入

       print CONFIG_PRI "LIBS =-lcrypt\n";

如下:

    print CONFIG_PRI "QTOPIA_FONT_SIZES=$opt_fontsizes\n";
    print CONFIG_PRI "QTOPIA_FONT_FAMILIES=$opt_fontfamilies\n";
    print CONFIG_PRI "LIBS =-lcrypt\n";

注意修改每次build时都会从qtopia-2.2.0.tar.gz解压出来,需要修改 qtopia-2.2.0.tar.gz里的文件,要不每次build都会被覆盖
  最后把lib目录下的文件拷到/lib目录下.

参考地址:http://zhulixin1976.blog.sohu.com/63698490.html

              :http://hi.baidu.com/qqylh/blog/item/8357ce26fb7bba53ac34de27.html

              :http://herbertbt.blog.163.com/blog/static/572665822010183456547/

              :http://blog.ednchina.com/lieal/2008/6/20.aspx

你可能感兴趣的:(编译qtopia时出错解决方案)