1. 程式人生 > >qtopia編譯錯誤

qtopia編譯錯誤

clu string calling value med tor sha direct sudo

在編譯過程中會出現很多的錯誤,包括飛淩提供的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]: *** [http://www.cnblogs.com/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<T>::pop() [with T = QMap<QString, QString>]‘:
xml/qxml.cpp:513: instantiated from here
   /home/work/armqt/qtlibsource/qt-x11/include/qvalue stack.h:57: 錯誤:不能從‘QValueListIterator<QMap<QString, QString> >‘轉換到‘const char*‘,為實參‘1‘(屬於‘int remove(const char*)‘)
/home/work/armqt/qtlibsource/qt-x11/include/qvalue stack.h: In member function ‘T QValueStack<T>::pop() [with T = QString]‘:
xml/qxml.cpp:2502: instantiated from here
  /home /work/armqt/qtlibsource/qt-x11/include/qvalue stack.h:57: 錯誤:不能從‘QValueListIterator<QString>‘轉換到‘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]: *** [http://www.cnblogs.com/../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::

繼續編譯:
http://www.cnblogs.com/../include/qtopia/pim/private/http://www.cnblogs.com/http://www.cnblogs.com/src/libraries/qtopiapim/numberentry_p.h: At global scope:
http://www.cnblogs.com/../include/qtopia/pim/private/http://www.cnblogs.com/http://www.cnblogs.com/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

qtopia編譯錯誤