Note that there are some explanatory texts on larger screens.

plurals
  1. POSegfault in a simple program using Qt on ARM
    primarykey
    data
    text
    <p>I'm trying to use Qt 4.7.4 on an ARM system, in order to display a graphic application on a touchscreen.</p> <p>My ARM card embeds a Linux system; we use the Linux framebuffer to send information to the screen, and tslib+usbtouchscreen drivers to get the touch information.</p> <p>I'm able to cross-compile Qt and put the library on my system. But when I launch my test program, I get a segfault every time at the same moment (without logical reason).</p> <p>To begin with, here is my test program (you can see it's very basic, no reason to segfault) : </p> <pre><code>#include &lt;QMessageBox&gt; #include &lt;QApplication&gt; int main( int argc, char *argv[] ) { QApplication app( argc, argv ); QMessageBox msgBox; msgBox.setText( "Hello world !" ); msgBox.show(); return app.exec(); } </code></pre> <p>The segfault appends during the <code>show()</code> call, in fact (thanks to some debugging), I realized it appends during the loading of font cache. Moreover, adding a <code>printf()</code> just after the call to <code>localData()</code> makes the segfault disappear... for a moment! However, when I close the application, I get the segfault anyway. </p> <p>In <code>Qt/gui/text/qfont.cpp</code> line 2615, adding a <code>printf()</code> after <code>theFontCache()-&gt;loadData()</code> temporarily resolves the problem:</p> <pre><code>QFontCache *QFontCache::instance() { QFontCache *&amp;fontCache = theFontCache()-&gt;localData(); if (!fontCache) { fontCache = new QFontCache; } return fontCache; } </code></pre> <p>Here is my <code>./configure</code> command line :</p> <p><code>./configure -release -shared -fast -no-largefile -exceptions -no-accessibility -no-stl -no-qt3support -no-xmlpatterns -no-phonon -no-phonon-backend -no-svg -no-webkit -no-declarative -no-declarative-debug -no-glib -no-cups -no-scripttools -no-script -no-audio-backend -no-multimedia -no-nis -embedded arm -xplatform qws/linux-arm-str-g++ -little-endian -no-gfx-multiscreen -prefix /usr -qconfig mbxconfig -nomake examples -nomake demos -depths 16 -qt-mouse-tslib -confirm-license -opensource</code></p> <p>I tried to configure with <code>-no-freetype</code>; nothing changed. I also tried to force the font, but no success neither. I also tried <code>echo 3 &gt; /proc/cpu/alignment</code> but I didn't find any alignment problem that way. One solution that I would try: compile without the compiler optimization - but I apparently didn't change the right options, since it still compiles with <code>-O2</code>. My GCC version is 4.2.3.</p> <p>Last, my strace before the segfault : </p> <pre><code>open("/dev/psaux", O_RDWR|O_NONBLOCK) = -1 ENOENT (No such file or directory) open("/dev/input/mice", O_RDWR|O_NONBLOCK) = -1 ENOENT (No such file or directory) open("/dev/tty0", O_RDWR) = 8 fcntl(8, F_SETFD, FD_CLOEXEC) = 0 ioctl(8, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0 ioctl(8, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0 ioctl(8, KDGKBMODE, 0x1a21c) = 0 ioctl(8, KDSKBMODE, 0x2) = 0 ioctl(8, SNDCTL_TMR_START or TCSETS, {B0 -opost -isig -icanon -echo ...}) = 0 ioctl(8, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 -opost -isig -icanon -echo ...}) = 0 rt_sigaction(SIGUSR1, {0x40bb3d68, [], 0x4000000 /* SA_??? */}, NULL, 8) = 0 rt_sigaction(SIGUSR2, {0x40bb3d68, [], 0x4000000 /* SA_??? */}, NULL, 8) = 0 ioctl(8, VIDIOC_RESERVED or VT_GETMODE, 0xbedbb598) = 0 ioctl(8, VIDIOC_ENUM_FMT or VT_SETMODE, 0xbedbb598) = 0 ioctl(8, VT_GETSTATE, 0xbedbb588) = 0 gettimeofday({1321521340, 447374}, NULL) = 0 brk(0x1d000) = 0x1d000 open("/proc/self/auxv", O_RDONLY) = 9 fcntl(9, F_SETFD, FD_CLOEXEC) = 0 read(9, "\20\0\0\0\3\0\0\0\6\0\0\0\0\20\0\0\21\0\0\0d\0\0\0\3\0\0\0004\200\0\0\4"..., 256) = 128 read(9, ""..., 256) = 0 close(9) = 0 write(4, "\0"..., 1) = 1 --- SIGSEGV (Segmentation fault) @ 0 (0) --- rt_sigaction(SIGSEGV, {SIG_DFL, [SEGV], SA_RESTART|0x4000000}, {0x40142d48, [SEGV], SA_RESTART|0x4000000}, 8) = 0 ioctl(8, KDSKBMODE, 0x3) = 0 ioctl(8, SNDCTL_TMR_START or TCSETS, {B38400 opost isig icanon echo ...}) = 0 ioctl(8, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0 close(8) = 0 ioctl(7, KDSETMODE, 0) = 0 write(7, "\33[9;15]\33[?33h\33[?25h\33[?0c\0"..., 25) = 25 close(7) = 0 kill(29810, SIGSEGV) = 0 sigreturn() = ? (mask now []) --- SIGSEGV (Segmentation fault) @ 0 (0) --- +++ killed by SIGSEGV +++ </code></pre> <p>On the ARM system, I don't have enough space to compile with debug so that's why it's directly in release.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload