转载: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. Qt编译Oracle OCI驱动

    最近使用qt开发了一个访问数据库的工具, 默认使用ODBC驱动注入的方式,后来发现Oracle中ODBC驱动注入经常失败. 后来就想直接使用OCI方式访问,而默认情况下Qt只有Sqlite和ODBC驱 ...

  2. 成都国嵌-嵌入式linux必修实验手册…

    emouse收集整理,转载请注明: emouse的技术专栏 博客园:http://www.cnblogs.com/emouse/ CSDN:http://blog.csdn.net/haozi_198 ...

  3. Qt编译工程提示qt creator no rule to make target opencv2/core/hal/interface.h need by debug解决方法

    总是提示 qt creator no rule to make target opencv2/core/hal/interface.h need by debug解决方法: 也算是花了整整两个小时踩坑 ...

  4. osg,qt编译的一些问题

    osg编译例子的时候,打开文件就出问题,可能是一些不兼容的问题 qt编译的是时候要添加qt和vs2010的整合工具,这样才能把 vs2010里面的QTDIR变量和环境变量QTDIR关联起来 同是右击文 ...

  5. Solaris 10下Qt编译Oracle 10g驱动

    上回书讲到<Oracle 10g在Solaris 10中安装详解>,现在开始用Qt来编译下Oracle 10g驱动吧!这样就可以通过Qt程序联入Oracle数据库了! Oracle的环境变 ...

  6. Qt编译安装后中文无法显示问题

    闲的蛋疼,把Ubuntu删了,再装10.04的时候,QT编译后运行自己的程序已经不能显示中文了,只能显示英文,字体贼丑... 想了各种办法,都没解决.. 最后:终于搞定: apt-get instal ...

  7. 让QT编译快一点(增加基础头文件)

    姚冬,中老年程序员 进藤光.杨个毛.欧阳修 等人赞同 我是来反对楼上某些答案的.我曾经用MFC写了金山词霸(大约20多万行),又用Qt写了YY语音(大约100多万行),算是对两种框架都比较有经验.纠正 ...

  8. Qt编译慢吗?

    1. “用Qt写的程序编译比MFC慢”的说法是错误的绝对错误,单位代码行数编译Qt远比MFC快得多,因为Qt库的头文件设计非常好,尽量都使用了前置声明,避免了头文件嵌套,几乎所有类都使用了公有类和私有 ...

  9. Qt编译时MinGW去掉对gcc动态库的依赖(去掉对libgcc_s_dw2-1.dll,libstdc++-6.dll的依赖)

    用Qt写点东西,我一般是下载官方的MinGW编译工具包,它有个不好的地方,经常还会多一些除了Qt库以外的其它的依赖动态链接库,比如:libgcc_s_dw2-1.dll,libstdc++-6.dll ...

随机推荐

  1. urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed解决办法

    描述 今天学习写一篇用python(我的是Python 3.6)登录知乎网(https://www.zhihu.com) 的爬虫,测试时报错:urlopen error [SSL: CERTIFICA ...

  2. PHP可变变量的简单使用

    知识点: 可变变量:简单说就是将一个变量的值用作另外一个变量的命名上,例如$a = 'b';$$a就是$b HTML代码: <!doctype html> <html> < ...

  3. Scala 基础(5)—— 构建函数式对象

    有了 Scala 基础(4)—— 类和对象 的前提,现在就可以来构建一个基于 Scala 的函数式对象. 下面开始构造一个有理数对象 Rational. 1. 主构造方法和辅助构造方法 对于每一个类的 ...

  4. BZOJ 4326 NOIP2015 运输计划(树上差分+LCA+二分答案)

    4326: NOIP2015 运输计划 Time Limit: 30 Sec  Memory Limit: 128 MB Submit: 1388  Solved: 860 [Submit][Stat ...

  5. 洛谷 P3573 [POI2014]RAJ-Rally 解题报告

    P3573 [POI2014]RAJ-Rally 题意: 给定一个\(N\)个点\(M\)条边的有向无环图,每条边长度都是\(1\). 请找到一个点,使得删掉这个点后剩余的图中的最长路径最短. 输入输 ...

  6. 【CZY选讲·一道图论好题】

    题目描述 LYK有一张无向图G={V,E},这张无向图有n个点m条边组成.并且这是一张带权图,不仅有边权还有点权.LYK给出了一个子图的定义,一张图G'={V',E'}被称作G的子图,当且仅当: · ...

  7. 论文笔记《Hand Gesture Recognition with 3D Convolutional Neural Networks》

    一.概述 Nvidia提出的一种基于3DCNN的动态手势识别的方法,主要亮点是提出了一个novel的data augmentation的方法,以及LRN和HRn两个CNN网络结合的方式. 3D的CNN ...

  8. Codeforces 932.A Palindromic Supersequence

    A. Palindromic Supersequence time limit per test 2 seconds memory limit per test 256 megabytes input ...

  9. OnCommand® Unified Manager

    OnCommand Unified Manager Solution Components   The following components are downloaded and installe ...

  10. [03]使用阿里RAP搭建前端Mock Server

    MockServer可以减少前端开发对后端的依赖,提高前端开发的效率,同时也利于团队的协作. 什么是RAP? RAP是阿里团队出的一款WEB接口管理工具,帮助开发人员更高效的管理接口文档,同时通过分析 ...