主题 : Qt-embedded 4.xx 运行出现 Segmentation Fault 段错误的解决办法 复制链接 | 浏览器收藏 | 打印
级别: 侠客
UID: 4162
精华: 2
发帖: 41
金钱: 320 两
威望: 122 点
贡献值: 11 点
综合积分: 122 分
注册时间: 2009-03-01
最后登录: 2015-09-12
楼主  发表于: 2009-09-11 22:50

 Qt-embedded 4.xx 运行出现 Segmentation Fault 段错误的解决办法

管理提醒: 本帖被 kasim 执行加亮操作(2009-10-15)
很多朋友在移植Qt-embedded 4.xx的时候都使用了友善之臂公司提供的交叉编译器,

虽然Qt与Qt应用程序都编译成功,但运行Qt应用程序时却经常会出现段错误(Segmentation Fault),

可以尝试使用openmoko(一个开源手机项目)提供的编译器,同样是EABI,版本为4.1.2

http://www.qtopia.net/modules/mydownloads/singlefile.php?lid=38

经测试,运行Qt应用程序时不会出现段错误(Segmentation Fault)

详细的移植步骤见本人的博客:
移植Qt-embedded 4.5.2 for mini2440

good luck!
[ 此帖被风城少主在2010-05-26 11:50重新编辑 ]
级别: 新手上路
UID: 5828
精华: 0
发帖: 34
金钱: 250 两
威望: 158 点
贡献值: 0 点
综合积分: 68 分
注册时间: 2009-05-10
最后登录: 2013-06-28
1楼  发表于: 2009-10-18 07:38
不错,试一试!Thanks
级别: 新手上路
UID: 5828
精华: 0
发帖: 34
金钱: 250 两
威望: 158 点
贡献值: 0 点
综合积分: 68 分
注册时间: 2009-05-10
最后登录: 2013-06-28
2楼  发表于: 2009-10-18 21:34

 (未解决)移植QT4.5出现错误"Segmentation fault",请问是什么原因?

../../include/QtCore/../../src/corelib/tools/qlist.h:54:15: error: new: 没有那个文件或目录
../../include/QtCore/../../src/corelib/tools/qlist.h: In member function ‘void QList<T>::node_construct(QList<T>::Node*, const T&) [with T = QString]’:
../../include/QtCore/../../src/corelib/tools/qlist.h:426:   instantiated from ‘void QList<T>::append(const T&) [with T = QString]’
../../include/QtCore/../../src/corelib/tools/qstringlist.h:70:   instantiated from here
../../include/QtCore/../../src/corelib/tools/qlist.h:341: error: no matching function for call to ‘operator new(unsigned int, QList<QString>::Node*&)’
<built-in>:0: note: candidates are: void* operator new(unsigned int)
../../include/QtCore/../../src/corelib/tools/qlist.h: In member function ‘void QList<T>::node_copy(QList<T>::Node*, QList<T>::Node*, QList<T>::Node*) [with T = QString]’:
../../include/QtCore/../../src/corelib/tools/qlist.h:618:   instantiated from ‘QList<T>& QList<T>::operator+=(const QList<T>&) [with T = QString]’
../../include/QtCore/../../src/corelib/tools/qstringlist.h:85:   instantiated from here
../../include/QtCore/../../src/corelib/tools/qlist.h:360: error: no matching function for call to ‘operator new(unsigned int, QList<QString>::Node*)’
<built-in>:0: note: candidates are: void* operator new(unsigned int)
make[1]: *** [.pch/release-shared-emb-arm/QtCore.gch/c++] 错误 1
make[1]: Leaving directory `/root/work/qt-embedded-linux-opensource-src-4.5.2-arm/src/corelib'
make: *** [sub-corelib-make_default-ordered] 错误 2
级别: 新手上路
UID: 5828
精华: 0
发帖: 34
金钱: 250 两
威望: 158 点
贡献值: 0 点
综合积分: 68 分
注册时间: 2009-05-10
最后登录: 2013-06-28
3楼  发表于: 2010-03-23 10:42

 屡败屡战

避免为其它网站做广告,此处省略200句
[ 此帖被lpc2292在2010-03-24 14:33重新编辑 ]
级别: 新手上路
UID: 5828
精华: 0
发帖: 34
金钱: 250 两
威望: 158 点
贡献值: 0 点
综合积分: 68 分
注册时间: 2009-05-10
最后登录: 2013-06-28
4楼  发表于: 2010-03-23 10:47

 屡败屡战

此处省略......
[ 此帖被lpc2292在2010-03-24 14:30重新编辑 ]
级别: 新手上路
UID: 5828
精华: 0
发帖: 34
金钱: 250 两
威望: 158 点
贡献值: 0 点
综合积分: 68 分
注册时间: 2009-05-10
最后登录: 2013-06-28
5楼  发表于: 2010-03-23 21:29
程序 qt-embedded-linux-opensource-src-4.5.0/src/gui/embedded/qscreenlinuxfb_qws.cpp
作如下修改:

410行:
/*            //EmbedSky_del start 20091208
    canaccel = useOffscreen();
    if(canaccel)
        setupOffScreen();
*/            //EmbedSky_del end 20091208
    canaccel = false;

706行:
/*                //EmbedSky_del start 20091208
    if (canaccel) {
        *entryp=0;
        *lowest = mapsize;
        insert_entry(*entryp, *lowest, *lowest);  // dummy entry to mark start
    }
*/                //EmbedSky_del end 20091208
    canaccel = false;

可能解决segmentation fault问题,请大家测试
[ 此帖被lpc2292在2010-03-24 14:37重新编辑 ]
级别: 新手上路
UID: 5828
精华: 0
发帖: 34
金钱: 250 两
威望: 158 点
贡献值: 0 点
综合积分: 68 分
注册时间: 2009-05-10
最后登录: 2013-06-28
6楼  发表于: 2010-03-24 14:22
修改了qscreenlinuxfb_qws.h,用友善之臂提供的arm-linux-gcc-4.3.2.tgz重新编译QT4.5.0-arm(release方式),试了2个程序可以正常运行。
级别: 新手上路
UID: 5828
精华: 0
发帖: 34
金钱: 250 两
威望: 158 点
贡献值: 0 点
综合积分: 68 分
注册时间: 2009-05-10
最后登录: 2013-06-28
7楼  发表于: 2010-03-24 20:38
NOTE: This is a HACK, and not a pretty one either. It makes sure that it hardcoded doesn't use off-chip graphic memory. I don't use off-chip graphic memory, but if you do, this hack is useless.