Results 1 to 4 of 4

Thread: ARM Platform: Segfaults with "-release" Qt but works great with "-debug" Qt?!

  1. #1
    Join Date
    Aug 2009
    Posts
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Red face ARM Platform: Segfaults with "-release" Qt but works great with "-debug" Qt?!

    Hi there,

    I am working to get Qt Embedded 4.5.2 working on an ARM (Samsung s3c2440) dev-kit.

    Qt compiled fine with my current toolchain (the "spring" 2009 sourcery) and everything is going spiffy. EXCEPT when I try to run a GUI program (ANY GUI program, even the dead simple "Hello World" button "program") doesn't work...

    To be exact: It gives a segmentation fault while loading a GUI program.

    (NOTE: I did try an console program by using qDebug() to print "Hello world" and this DOES work with "-release" Qt)

    The strange thing is, when I configure Qt with the -debug option, it DOES work! Doesn't give a segmentation fault and everything works perfectly, even ts-lib!

    Does anyone know the reason why the "-release" qt doesnt't work but it DOES work in debug mode?

    My configuration (NOTE: I replace "-release" with "-debug" when compiling for debug mode):

    Qt Code:
    1. ./configure -v \
    2. -embedded arm -xplatform qws/linux-arm-g++ -prefix /usr/qt \
    3. -nomake examples -nomake demos -opensource \
    4. -no-accessibility -no-sql-sqlite -no-phonon -no-phonon-backend -no-qt3support \
    5. -no-scripttools -no-mmx -no-3dnow -no-sse -no-sse2 -no-cups -no-dbus -no-glib \
    6. -qt-libtiff -qt-libpng -qt-libmng -qt-libjpeg -qt-gfx-linuxfb -qt-mouse-tslib -qt-gfx-qvfb \
    7. -shared -release
    To copy to clipboard, switch view to plain text mode 

    Is there anything I'm doing wrong? If there is more information needed, I am happy to supply

    Thanks a lot!

  2. #2
    Join Date
    Aug 2009
    Posts
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: ARM Platform: Segfaults with "-release" Qt but works great with "-debug" Qt?!

    Note:
    I used the same hello world program from: http://doc.trolltech.com/4.1/tutorial-t1.html

    I found out (by inserting qDebug()'s) that the program doesn't get any further than the QApplication Line:

    Qt Code:
    1. ...
    2. qDebug() << "Making QApplication";
    3. QApplication app(argc, argv);
    4. ...
    To copy to clipboard, switch view to plain text mode 

    Program output:
    Qt Code:
    1. $./helloworld
    2. Segmentation Fault
    To copy to clipboard, switch view to plain text mode 

    I hope this helps some more.

  3. #3
    Join Date
    Sep 2008
    Posts
    58
    Thanks
    11
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: ARM Platform: Segfaults with "-release" Qt but works great with "-debug" Qt?!

    hi thajan,

    I have found the similar problem..
    Did you find the solution??

    If yes, please let me know??

  4. #4
    Join Date
    Aug 2009
    Posts
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: ARM Platform: Segfaults with "-release" Qt but works great with "-debug" Qt?!

    Quote Originally Posted by nrabara View Post
    hi thajan,

    I have found the similar problem..
    Did you find the solution??

    If yes, please let me know??
    Hi there,

    I contacted the people at Qt and it is a common error caused by compiler optimizations present in G++ 4.2.x and higher. This also explains why it DOES work in debug mode, because it excludes several optimization options.

    They had several solutions to get rid of the optimization issue:

    (i) Use a 4.1 compiler
    (ii) Drop the "-O2" value of the QMAKE_CFLAGS_RELEASE in "mkspecs/common/g++.conf" to "-O1".
    (iii) Edit "mkspecs/qws/linux-arm-g++/qmake.conf" and turn off some compiler optimizations that seem to give some problems like so:
    Qt Code:
    1. QMAKE_CFLAGS_RELEASE += -fomit-frame-pointer -finline-functions -funroll-loops -falign-functions=2 -falign-loops=2 -falign-jumps=2
    To copy to clipboard, switch view to plain text mode 

    NOTE: Fill in the right values for "-falign-functions -falign-loops -falign-jumps" that fit with your CPU.

    Don't forget to run "make confclean" after you edit the file.

    All options (changing compiler was not an option), however, did not work properly for me. I had to drop the compilerflag to "-O0", which had an, to me, unacceptable slow performance.
    In staid I had to change the following line in "src/gui/embedded/qscreenlinuxfb.cpp":

    From:
    Qt Code:
    1. canaccel = useOffscreen();
    To copy to clipboard, switch view to plain text mode 
    To:
    Qt Code:
    1. canaccel = false;
    To copy to clipboard, switch view to plain text mode 

    I found this out by filling the file with qDebug()'s and see where it went wrong.

    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.
    Last edited by thajan; 29th August 2009 at 23:29.

Similar Threads

  1. Crash handler on Win32
    By niko in forum Qt Programming
    Replies: 3
    Last Post: 12th November 2007, 20:41

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.