Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2929284
  • 博文数量: 401
  • 博客积分: 12926
  • 博客等级: 上将
  • 技术积分: 4588
  • 用 户 组: 普通用户
  • 注册时间: 2009-02-22 14:51
文章分类

全部博文(401)

文章存档

2015年(16)

2014年(4)

2013年(12)

2012年(82)

2011年(98)

2010年(112)

2009年(77)

分类: 嵌入式

2012-04-16 10:25:50

经过一段漫长而痛苦的过程(几次差点就要放弃)之后,今天qtopia2.2.0pc版本和ARM-LINUX版本都终于编译成功了,下面我和大家分享一下pc机版本的qtopia2.2.0编译过程中的遇到的错误及其解决办法,希望与大家一起进步。(arm-linux版本的编译参照飞凌提供的6410的qt移植视频中的五和六,先编译第三方库,按照视频上来就没有问题,编译完第三方库以后,剩下的就和pc版本的相差无几了)

环境ubuntu10.10   
编译器: gcc version 4.4.5  
主机:奔四   
内存:512+256M    
VMware版本:7.0

注意事项:
     在编译之前先确保你的ubuntu系统中有X11的SDK库,Qtopia编译过程中需要使用X11SDK里面的一些头文件,使用以下命令,即可完成安装:    
     apt-get install libx11-dev libxext-dev libxtst-dev

   另外,在修改完第一处错误,重新编译之前,先修改一下build脚本文件,因为重新执行build命令,该脚本会把刚才编译中的qtopia-free-2.2.0文件夹删除,重新解压,形成新的qtopia-free-2.2.0,开始编译,这样刚才的修改就失去意义了。修改build脚本的方法如下:
      将  rm -fr qtopia-free-2.2.0
          tar xfvz qtopia-free-2.2.0.tar.gz 这两条语句的前面分别加上#  ,注释掉,保存退出,重新执行  ./build


在编译过程中会出现很多的错误,包括飞凌提供的ok6410 QT移植百科全书里面的,但是手册里面罗列的不全,下面我将我在编译过程实际遇到的编译错误及其解决办法写一下(其中的一些错误实际中没有遇到,是从网上搜集的,供朋友们参考):
  
  错误一:
        /usr/bin/ld: cannot find -lXmu
        collect2: ld returned 1 exit status
  错误二:
         Creating pngscale...make[1]: Entering directory `/root/yizhi/qtopia-free-2.2.0/qtopia/util/pngscale'
..make[1]: *** [../../bin/pngscale] Error 1
make[1]: Leaving directory `/root/yizhi/qtopia-free-2.2.0/qtopia/util/pngscale'
Failed to make pngscale
    分析:
         这是因为没有安装uuid和Xmu,因为在编译qtopia2.2.0的过程中需要安装工具uuid(Universally Unique Identifier,)和 xmu库文件。
    解决办法:
            
           apt-get install  uuid-dev 
           apt-get install libxmu-dev libxmu6

错误三:
      external/clearsilver/cgi/cgi.c:22: fatal error: zlib.h: No such file or directory
       compilation terminated.
      make: *** [out/host/linux-x86/obj/SHARED_LIBRARIES/libneo_cgi_intermediates/cgi.o] Error 1

  解决:
        在ubuntu里,zlib叫zlib1g,相应的zlib-devel叫zlib1g.dev

        sudo apt-get install zlib1g-dev

错误四:
      /usr/bin/ld: cannot find -lz
      collect2: ld returned 1 exit status
      make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/aapt] Error 1

   解决方法:
       sudo apt-get install lib32z1-dev

错误五:
     bison -d  -o out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp      frameworks/base/tools/aidl/aidl_language_y.y
     /bin/bash: bison: command not found
     make: *** [out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp] Error 127

    解决方法:
     sudo apt-get install bison

错误六:
      Lex: aidl <= frameworks/base/tools/aidl/aidl_language_l.l
      /bin/bash: flex: command not found
      make: *** [out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_l.cpp] Error 127

    解决方法:
      sudo apt-get install flex
            
错误七:
      /usr/bin/ld: cannot find -lncurses
      collect2: ld returned 1 exit status
     make: *** [out/host/linux-x86/obj/EXECUTABLES/adb_intermediates/adb] Error 1

解决方法:
     sudo apt-get install lib32ncurses5-dev

错误八:
    prebuilt/linux-x86/sdl/include/SDL/SDL_syswm.h:55: fatal error: X11/Xlib.h: No such file     or directory
    compilation terminated.
    make: *** [out/host/linux-x86/obj/EXECUTABLES/emulator_intermediates/android/main-common.o] Error 1

解决方法:
    sudo apt-get install libx11-dev 


错误九:
     sh: gperf: not found
     calling gperf failed: 32512 at ./makeprop.pl line 96.
     make: ***  [out/target/product/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates/WebCore/css/CSSPropertyNames.h] Error 25
make: *** Deleting file `out/target/product/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates/WebCore/css/CSSPropertyNames.h'

解决方法:
     sudo apt-get install gperf 

错误十:open函数参数不够  

    /usr/include/bits/fcntl2.h:51: error: call to ‘__open_missing_mode’ declared with attribute error: open   with O_CREAT in second argument needs 3 arguments

  解决办法:
     参见ok6410移植百科全书。

错误十一:使用未定义的类
  
     error: ‘QWSInputMethod’ has not been declared
  解决办法:
       参见ok6410移植百科全书。 (注: 该文件中使用了这两个类,C++允许在文件中这样声明其他地方定义的类,减少头文件的相互包含关系,加快编译速度)


错误十二:缺少头文件
        asm/page.h: No such file or directory
  解决办法:
        参见ok6410移植百科全书。


错误十三:类型转换错误
      home/work/armqt/qtlibsource/qt-x11/include/qvalue stack.h: In member function 'T QValueStack::pop() [with T = QMap]': 
xml/qxml.cpp:513:   instantiated from here 
  /home/work/armqt/qtlibsource/qt-x11/include/qvalue stack.h:57: 错误:不能从'QValueListIterator >'转换到'const char*',为实参'1'(属于'int remove(const char*)') 
/home/work/armqt/qtlibsource/qt-x11/include/qvalue stack.h: In member function 'T QValueStack::pop() [with T = QString]': 
xml/qxml.cpp:2502:   instantiated from here 
  /home/work/armqt/qtlibsource/qt-x11/include/qvalue stack.h:57: 错误:不能从'QValueListIterator'转换到'const char*',为实参'1'(属于'int remove(const char*)')
    解决办法:
         参见ok6410移植百科全书。

错误十四:没有找到uic工具  错误提示:

    make[5]: /root/yizhi/host/qtopia-free-2.2.0/qt2/bin/uic: Command not found
    make[5]: *** [../../../include/qtopia/private/passwordbase_p.h] Error 127
   解决办法:
         cd到你的qtopia-free-2.2.0目录下, find ./  -name uic 会看到其他的目录下已经有了uic,我把qt3/bin 目录下的uic拷贝到 qt2/bin下面,即可 
       (注:我在实际操作过程中,一开始报出这个错误,但是将其他的错误改完之后,这个错误也就自动消失了,我是菜鸟,不知道怎么回事, )


错误十五: 指针类型转换出错:
  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(OFi

解决办法:
  修改 qtopia-free-2.2.0/qtopia/src/libraries/qtopia/backend/vobject.cpp 文件419行
   char *dot = strrchr(g,'.');    修改为 char *dot = (char *)strrchr(g,'.');



在编译过程中还出现了类似的错误
     wavplugin.cpp:435 : error: invalid conversion from 'const char*' to 'char*'
   解决办法
        修改qtopia-free-2.2.0/qtopia/src/plugins/codes/wavplugin/wavplugin.cpp文件的第435行
       修改方法如上


错误十六:编译器找不到QSizePolicy类的五个参数的构造函数

   ui/release-shared/passwordbase_p.cpp:35: error: no matching function for call to ‘QSizePolicy:SizePolicy(QSizePolicy::SizeType, QSizePolicy::SizeType, int, int, bool)’
/root/yizhi/host/qtopia-free-2.2.0/qt2/include/qsizepolicy.h:93: note: candidates are: QSizePolicy:SizePolicy(int)
/root/yizhi/host/qtopia-free-2.2.0/qt2/include/qsizepolicy.h:99: note:                 QSizePolicy:SizePolicy(QSizePolicy::SizeType, QSizePolicy::SizeType, bool)
/root/yizhi/host/qtopia-free-2.2.0/qt2/include/qsizepolicy.h:63: note:                 QSizePolicy:SizePolicy()
/root/yizhi/host/qtopia-free-2.2.0/qt2/include/qsizepolicy.h:46: note:                 QSizePolicy:SizePolicy(const QSizePolicy  & )

   解决办法:

    qtopia-free-2.2.0/qtopia/src/libraries/qtopia/.ui/release-shared/passwordbase_p.cpp 文件中的38行位置
    prompt = new QLabel( this, "prompt" );
    prompt->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)1, 0, 0, prompt->sizePolicy().hasHeightForWidth() ) );

  修改为:

    prompt = new QLabel( this, "prompt" );
    prompt->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)1, prompt->sizePolicy  ().hasHeightForWidth() ) );

  即去掉0,0 两个参数 


错误十七(这是一大类错误,在编译过程中会遇到很多):g++编译器提示 有多余的符号在成员函数前 ,有些编译器规定C++成员函数前不需要再加这个类的名字

    thumbnailview_p.h: At global scope:
thumbnailview_p.h:81: error: extra qualification ‘ThumbnailItem::’ on member ‘paintItem’
make[5]: *** [.obj/release-shared/imageselector.o] Eopia/src

  解决办法 :

      qtopia-free-2.2.0/qtopia/src/libraries/qtopia2/thumbnailview_p.h文件中第81行:

    修改 void ThumbnailItem::paintItem( QPainter*, const QColorGroup& ); 

    修改后  void  paintItem( QPainter*, const QColorGroup& ); 

  ** 继续编译后会出现类似的错误

abtable_p.h:276: error: extra qualification ‘PhoneTypeSelector::’ on member ‘addType’
make[5]: *** [.obj/release-shared/abtable.o] Error 1
make[5]: Leaving directory `/root/yizhi/host/qtopia-free-2.2.0/qtopia/src/libraries/qtopiapim'
make[4]: *** [all] Error 2
    解决办法:去掉 PhoneTypeSelector::

继续编译:
     ../../../include/qtopia/pim/private/../../../../src/libraries/qtopiapim/numberentry_p.h: At global scope:
../../../include/qtopia/pim/private/../../../../src/libraries/qtopiapim/numberentry_p.h:106: error: extra qualification ‘NumberEntryDialog::’ on member ‘eventFilter’
make[5]: *** [.obj/release-shared/numberentry.o] Error 1
make[5]: Leaving directory `/root/yizhi/host/qtopia-free-2.2.0/qtopia/src/libraries/qtopiapim'
make[4]: *** [all] Error 2

解决办法:去掉NumberEntryDialog::’

继续编译
  In file included from addressbook.cpp:40:
ablabel.h: At global scope:
ablabel.h:78: error: extra qualification ‘AbLabel::’ on member ‘decodeHref"

解决办法:去掉‘AbLabel::’

 

继续编译
  In file include from minefiled.cpp:35
  minefiled.h:105: error: extra qualification 'MineFiled::' on member
  'setState'
  minefiled.h:106: error: extra qualification 'MineFiled::' on member
  'placeMines'

解决办法:
      编辑 qtopia-free-2.2.0/qtopia/src/games/minesweep/minefiled.h
     修改106行和105行:  删除'MineFiled::'即可


继续编译
     buttoneditordialog.h:56 error:extra qualification 'ButtonEditorDialog::' on member
    'actionFor'
   解决办法:
       编辑qtopia-free-2.2.0/qtopia/src/settings/buttoneditor/buttoneditordialog.h
     将'ButtonEditorDialog::' 删除即可



继续编译
     出现packagewizard.h:106:error: extra qualification 'PackageWizard::' on member
    'current'
    解决办法
       编辑qtopia-free-2.2.0/qtopia/src/settings/qipkg/packagewizard.h
       将'PackageWizard::'删除即可

继续编译
    出现  keboard.h:60 error:extra qualification 'KeboardPicks::' on member
    'KeboardPicks'
    解决办法
       编辑qtopia-free-2.2.0/qtopia/src/plugins/inputmethods/keyboard/keyboard.h
       将第60行的'KeboardPicks::'删除即可

继续编译
      还会出现类似的错误,如extra qualification 'PolishedDecoration::' 、'IMToolButton::'



错误十八:未经定义的构造函数错误提示

.ui/release-shared/emaildlg.cpp: In constructor ‘EmailDialogBase::EmailDialogBase(QWidget*, const char*, bool, uint)’:
.ui/release-shared/emaildlg.cpp:65: error: no matching function for call to ‘QSizePolicy:SizePolicy(QSizePolicy::SizeType, QSizePolicy::SizeType, int, int, bool)’
/root/yizhi/host/qtopia-free-2.2.0/qt2/include/qsizepolicy.h:93: note: candidates are: QSizePolicy:SizePolizePolicj4

     修改  qtopia-free-2.2.0/qtopia/src/applications/addressbook/.ui/release-shared/emaildlg.cpp  文件第65行
   
    okButton = new QPushButton( this, "okButton" );
    okButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, 0, 0, okButton->sizePolicy().hasHeightForWidth() ) );
    Layout2->addWidget( okButton );

    cancelButton = new QPushButton( this, "cancelButton" );
    cancelButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, 0, 0, cancelButton->sizePolicy().hasHeightForWidth() ) );
    Layout2->addWidget( cancelButton );

  修改为


okButton = new QPushButton( this, "okButton" );
    okButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0,okButton->sizePolicy().hasHeightForWidth() ) );
    Layout2->addWidget( okButton );

    cancelButton = new QPushButton( this, "cancelButton" );
    cancelButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0,cancelButton->sizePolicy().hasHeightForWidth() ) );
    Layout2->addWidget( cancelButton );

继续编译:

    错误提示:.ui/release-shared/camerabase.cpp:41: error: no matching function for call to ‘QSizePolicy:SizePolicy(QSizePolicy::SizeType, QSizePolicy::SizeType, int, int, bool)’
/root/yizhi/host/qtopia-free-2.2.0/qt2/include/qsizepolicy.h:93: note: candidates are: QSizePolicy:SizePolicy(int)

   解决办法: 

     编辑  qtopia-free-2.2.0/qtopia/src/applications/camera/.ui/release-shared/camerabase.cpp 文件的第41行

videocaptureview->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, videocaptureview->sizePolicy().hasHeightForWidth() ) );

修改为:

videocaptureview->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, videocaptureview->sizePolicy().hasHeightForWidth() ) );




下面将网上搜集的另外一点资料贴上:

1. Could not find wxWidgets library. 

Solution: $sudo apt-get install libwxgtk2.8-0 libwxgtk2.8-dev wx2.8-headers wx-common 

2. Need libsmbclient.h for compiling on Unix. 

Solution: $sudo apt-get install libsmbclient-dev 

3. Need cups.h for compiling on Unix. 

Solution: $sudo apt-get install libcupsys2-dev 

4. error: Need opensc/opensc.h. 

Solution: $sudo apt-get install libopensc2-dev 

5. exec: g++: not found. 

Solution: $sudo apt-get install build-essential 

6. error: X11/Xlib.h: no such file or directory. 

Solution: $sudo apt-get install libx11-dev 

7. error: X11/Xmu/WinUtil.h: no such file or directory. 

Solution: $sudo apt-get install libxmu-dev 

8. error: jpeglib.h: no such file or directory. 

Solution: $sudo apt-get install libjpeg-dev 

9. error: png.h: no such file or directory. 

Solution: $sudo apt-get install libpng-dev

   大体上能够遇到的错误差不多就这几种类型,关键是哪里出错去哪里找,然后进入那个路径,修改相应的错误,希望类似我这样的初学者朋友戒浮忌躁,相信大家都会成功的。

阅读(4451) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~