tq2440实验手册qt编译问题
生活随笔
收集整理的這篇文章主要介紹了
tq2440实验手册qt编译问题
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
轉載:http://blog.sina.com.cn/s/blog_6182b82201015ym1.html
?
編譯qtopia最好使用的是低版本的gcc和g++. 舉個簡單的例子在qtopia的源代碼中有個函數的使用
? 在qmemoryfile_unix.cpp中int open(const char*, int, ...),這個函數的使用就有問題了。因為open函數需要三個參數,而這里只有兩個,新版本的gcc必須要求傳入三個參數。所以這個會有錯誤。需要修個源碼。。 ? 還有在另外的一個文件中使用strrchr函數時,函數的第一個參數是const型的,新版本g++不支持報錯了。而g++4.1編譯則沒有問題。所以這里我重新安裝了g++4.1版本。 ? 編譯qtopia時候可能還會遇到問題 ? make[1]: Entering directory `/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/src' echo '#include "kernel/qt.h"' >allmoc.cpp g++ ?-c -I/usr/X11R6/include -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/include -I/usr/X11R6/include -pipe -O2 -Wall -W -DNO_DEBUG -fPIC -DQT_BUILTIN_GIF_READER=0 -DQT_NO_IMAGEIO_JPEG -DQT_NO_IMAGEIO_MNG -DQT_NO_SM_SUPPORT -DQT_NO_XKB ?-I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/src/3rdparty/zlib -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/src/3rdparty/libpng ?-I3rdparty/kernel -I3rdparty/tools -o tmp/release-shared-linux-g++/tools/qmemoryfile_unix.o tools/qmemoryfile_unix.cpp tools/qmemoryfile_unix.cpp: In member function ‘QMemoryFileData* QMemoryFile::openData(const QString&, int, uint)’: tools/qmemoryfile_unix.cpp:149: warning: format not a string literal and no format arguments tools/qmemoryfile_unix.cpp:152: warning: format not a string literal and no format arguments tools/qmemoryfile_unix.cpp:181: warning: format not a string literal and no format arguments tools/qmemoryfile_unix.cpp:190: warning: format not a string literal and no format arguments tools/qmemoryfile_unix.cpp:235: warning: format not a string literal and no format arguments In file included from /usr/include/fcntl.h:217, ?????????????????from tools/qmemoryfile_unix.cpp:50: In function ‘int open(const char*, int, ...)’, ????inlined from ‘QMemoryFileData* QMemoryFile::openData(const QString&, int, uint)’ at tools/qmemoryfile_unix.cpp:143: /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 make[1]: *** [tmp/release-shared-linux-g++/tools/qmemoryfile_unix.o] Error 1 make[1]: Leaving directory `/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/src' 解決辦法: 在Ubuntu 9.10上, gcc會嚴格檢查open()的參數傳遞,如果第二個參數為O_CREAT的話(就像qtopia-2.2.0-FriendlyARM/qt2/src /tools/qmemoryfile_unix.cpp的143行這樣),必須傳入第三個參數mode。因此,手動修改x86-qtopia- 2.2.0/qt2/src/tools/qmemoryfile_unix.cpp 143行 將 ????if (!f) ????????f = ::open(tmpFile.latin1(), O_CREAT | O_WRONLY); ?? 修改為 ????if (!f) ????????f = ::open(tmpFile.latin1(), O_CREAT | O_WRONLY, 0666); ? make[1]: Entering directory `/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/src' g++ ?-c -I/usr/X11R6/include -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/include -I/usr/X11R6/include -pipe -O2 -Wall -W -DNO_DEBUG -fPIC -DQT_BUILTIN_GIF_READER=0 -DQT_NO_IMAGEIO_JPEG -DQT_NO_IMAGEIO_MNG -DQT_NO_SM_SUPPORT -DQT_NO_XKB ?-I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/src/3rdparty/zlib -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/src/3rdparty/libpng ?-I3rdparty/kernel -I3rdparty/tools -o tmp/release-shared-linux-g++/3rdparty/kernel/qmotifdnd_x11.o 3rdparty/kernel/qmotifdnd_x11.cpp 3rdparty/kernel/qmotifdnd_x11.cpp:80:22: error: X11/Xlib.h: No such file or directory ............ 3rdparty/kernel/qmotifdnd_x11.cpp:902: error: ‘struct DndData’ has no member named ‘time’ make[1]: *** [tmp/release-shared-linux-g++/3rdparty/kernel/qmotifdnd_x11.o] Error 1 make[1]: Leaving directory `/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/src' 解決方法: 缺少x11/xlib.h,安裝libx11-dev即可解決: # sudo apt-get install libx11-dev ? make[1]: Entering directory `/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/src' g++ ?-c -I/usr/X11R6/include -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/include -I/usr/X11R6/include -pipe -O2 -Wall -W -DNO_DEBUG -fPIC -DQT_BUILTIN_GIF_READER=0 -DQT_NO_IMAGEIO_JPEG -DQT_NO_IMAGEIO_MNG -DQT_NO_SM_SUPPORT -DQT_NO_XKB ?-I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/src/3rdparty/zlib -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/src/3rdparty/libpng ?-I3rdparty/kernel -I3rdparty/tools -o tmp/release-shared-linux-g++/kernel/qpsprinter.o kernel/qpsprinter.cpp In file included from kernel/qpsprinter.cpp:97: kernel/qt_x11.h:83:34: error: X11/extensions/shape.h: No such file or directory In file included from kernel/qpsprinter.cpp:75: kernel/qimage.h: In member function ‘int QImageTextKeyLang::operator<(const QImageTextKeyLang&) const’: kernel/qimage.h:58: warning: suggest parentheses around ‘&&’ within ‘||’ make[1]: *** [tmp/release-shared-linux-g++/kernel/qpsprinter.o] Error 1 make[1]: Leaving directory `/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/src' 解決方法: 缺少X11/extensions/shape.h,安裝x11proto-xext-dev即可解決: # sudo apt-get install x11proto-xext-dev ? make[1]: Entering directory `/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/tools/designer/uic' g++ -L/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/lib -Wl,-rpath,/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/lib ??-o /opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/bin/uic uic.o ../shared/widgetdatabase.o ../shared/domtool.o ../integration/kdevelop/kdewidgets.o ??-lqt ? /usr/bin/ld: cannot find -lqt collect2: ld returned 1 exit status make[1]: *** [/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/bin/uic] Error 1 make[1]: Leaving directory `/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/tools/designer/uic' 解決方法: 缺少lqt,安裝libqt3-mt-dev即可解決: # sudo apt-get install libqt3-mt-dev carterlam 發表于 2010-3-1 17:21 ? 接上: ? *********************************** ********* Build Qtopia ************ *********************************** 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/qmemoryfile_unix.o qmemoryfile_unix.cpp qmemoryfile_unix.cpp: In member function ‘QMemoryFileData* QMemoryFile::openData(const QString&, int, uint)’: qmemoryfile_unix.cpp:149: warning: format not a string literal and no format arguments qmemoryfile_unix.cpp:187: warning: format not a string literal and no format arguments qmemoryfile_unix.cpp:232: warning: format not a string literal and no format arguments In file included from /usr/include/fcntl.h:217, ?????????????????from qmemoryfile_unix.cpp:48: In function ‘int open(const char*, int, ...)’, ????inlined from ‘QMemoryFileData* QMemoryFile::openData(const QString&, int, uint)’ at qmemoryfile_unix.cpp:141: /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 make[5]: *** [.obj/release-shared/qmemoryfile_unix.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/qmemoryfile_unix.cpp 141行 將 ????if (!f) ????????f = ::open(tmpFile.latin1(), O_CREAT | O_WRONLY); ?? 修改為 ????if (!f) ????????f = ::open(tmpFile.latin1(), O_CREAT | O_WRONLY, 0666); ? ? ? 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,'.'); ? make[5]: Entering directory `/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/src/libraries/qtopia' test -d ../../../lib/ || mkdir -p ../../../lib/ rm -f libqpe.so.1.5.3 libqpe.so libqpe.so.1 libqpe.so.1.5 g++ -shared -Wl,-soname,libqpe.so.1 -o libqpe.so.1.5.3 .obj/release-shared/qmemoryfile.o .obj/release-shared/calendar.o .obj/release-shared/global.o .obj/release-shared/localtr.o .obj/release-shared/mimetype.o .obj/release-shared/menubutton.o .obj/release-shared/filemanager.o .obj/release-shared/fileselector.o .obj/release-shared/resource.o .obj/release-shared/qpeapplication.o .obj/release-shared/qpestyle.o .obj/release-shared/qpedialog.o .obj/release-shared/config.o .obj/release-shared/applnk.o .obj/release-shared/sound.o .obj/release-shared/tzselect.o .obj/release-shared/qmath.o .obj/release-shared/alarmserver.o .obj/release-shared/password.o .obj/release-shared/timestring.o .obj/release-shared/storage.o .obj/release-shared/qpemessagebox.o .obj/release-shared/qpedebug.o .obj/release-shared/qpemenubar.o .obj/release-shared/qpetoolbar.o .obj/release-shared/categorymenu.o .obj/release-shared/categoryedit_p.o .obj/release-shared/categoryselect.o .obj/release-shared/categorywidget.o .obj/release-shared/mediarecorderplugininterface.o .obj/release-shared/mediaplayerplugininterface.o .obj/release-shared/qdawg.o .obj/release-shared/datebookdb.o .obj/release-shared/xmlreader.o .obj/release-shared/imageedit.o .obj/release-shared/datebookmonth.o .obj/release-shared/qmemoryfile_unix.o .obj/release-shared/custom-qtopia.o .obj/release-shared/fontmanager.o .obj/release-shared/fontdatabase.o .obj/release-shared/qpedecoration_qws.o .obj/release-shared/network.o .obj/release-shared/networkinterface.o .obj/release-shared/qcopenvelope_qws.o .obj/release-shared/power.o .obj/release-shared/ir.o .obj/release-shared/pluginloader_p.o .obj/release-shared/bgexport.o .obj/release-shared/quuid.o .obj/release-shared/qlibrary.o .obj/release-shared/process.o .obj/release-shared/process_unix.o .obj/release-shared/qlibrary_unix.o .obj/release-shared/categories.o .obj/release-shared/stringutil.o .obj/release-shared/vcc_yacc.o .obj/release-shared/vobject.o .obj/release-shared/cp1252textcodec.o .obj/release-shared/contact.o .obj/release-shared/event.o .obj/release-shared/timeconversion.o .obj/release-shared/palmtoprecord.o .obj/release-shared/task.o .obj/release-shared/passwordbase_p.o .obj/release-shared/categoryeditbase_p.o .obj/release-shared/moc_menubutton.o .obj/release-shared/moc_fileselector.o .obj/release-shared/moc_qpeapplication.o .obj/release-shared/moc_qpedialog.o .obj/release-shared/moc_tzselect.o .obj/release-shared/moc_storage.o .obj/release-shared/moc_qpemenubar.o .obj/release-shared/moc_qpetoolbar.o .obj/release-shared/moc_categories.o .obj/release-shared/moc_categorymenu.o .obj/release-shared/moc_categoryselect.o .obj/release-shared/moc_imageedit.o .obj/release-shared/moc_datebookmonth.o .obj/release-shared/moc_ir.o .obj/release-shared/moc_process.o .obj/release-shared/moc_fileselector_p.o .obj/release-shared/moc_categoryedit_p.o .obj/release-shared/moc_qpedecoration_p.o .obj/release-shared/moc_bgexport_p.o .obj/release-shared/moc_qlibrary_p.o .obj/release-shared/moc_passwordbase_p.o .obj/release-shared/moc_categoryeditbase_p.o ??-lcrypt -luuid -lm -ldl -ldl -L/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/lib -L/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/lib -lqte? /usr/bin/ld: cannot find -luuid collect2: ld returned 1 exit status make[5]: *** [../../../lib/libqpe.so.1.5.3] Error 1 make[5]: Leaving directory `/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/src/libraries/qtopia' 解決方法: 缺少luuid,安裝uuid-dev即可解決: # sudo apt-get install uuid-dev ? make[6]: Entering directory `/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/src/plugins/codecs/wavplugin' g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -Os -fPIC ?-DQTOPIA_DATA_LINKING -DQCONFIG="qconfig-qpe.h" -DQTOPIA_TARGET="wavplugin" -DQTOPIA_TRTARGET="libwavplugin" -DQT_NO_DEBUG -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/mkspecs/qws/linux-generic-g++ -I. -I../../../3rdparty/libraries/gsm -I../../../../include -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/include -I.ui/release-shared/ -I.moc/release-shared/ -o .obj/release-shared/wavplugin.o wavplugin.cpp wavplugin.cpp: In member function ‘virtual bool WavPlugin::isFileSupported(const QString&)’: wavplugin.cpp:435: error: invalid conversion from ‘const char*’ to ‘char*’ make[6]: *** [.obj/release-shared/wavplugin.o] Error 1 make[6]: Leaving directory `/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/src/plugins/codecs/wavplugin' 解決方法: 修正/x86-qtopia-2.2.0/qtopia/src/plugins/codecs/wavplugin/wavplugin.cpp:435行 ????char *ext = strrchr( path.latin1(), '.' ); 改為 ????char *ext = (char*)strrchr( path.latin1(), '.' );總結
以上是生活随笔為你收集整理的tq2440实验手册qt编译问题的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 考前多熟记的知识点(1)~(3)《系统集
- 下一篇: 如何提高在家办公的效率?