Results 1 to 8 of 8

Thread: Segmentation Fault when Program Starts

  1. #1
    Join Date
    Feb 2006
    Location
    Jarrell, Texas, USA
    Posts
    70
    Thanks
    7
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Segmentation Fault when Program Starts

    I am attempting to develop QT console APP for RHEL 5 using QT 4.5.2.
    I can build and run a simple app one system, but when I attempt to run the same app on a different RHEL 5 machine the program produces a Segmentation Fault.

    I eventually created two small programs to demonstrate the error. The first program runs with no problems. The second creates the segmentation fault.
    Here is the code for program one (which works):

    Qt Code:
    1. #include <stdio.h>
    2. int main()
    3. {
    4. fprintf(stderr, "Program running.\n");
    5. return 0;
    6. }
    To copy to clipboard, switch view to plain text mode 

    Here is the code from program two (produces segmentation fault):

    Qt Code:
    1. #include <QDebug>
    2. int main()
    3. {
    4. qDebug("Program running.");
    5. return 0;
    6. }
    To copy to clipboard, switch view to plain text mode 

    Here is the programs running on the non-development machine:
    # ./QTTest
    Program running.
    # ./QTTest2
    Segmentation fault
    I configured QT 4.5.2 with -static -release options.

    I would appreciate any advice or help.

    Karl

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Segmentation Fault when Program Starts

    Run the application under a debugger and paste here the backtrace after the crash.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Feb 2006
    Location
    Jarrell, Texas, USA
    Posts
    70
    Thanks
    7
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Segmentation Fault when Program Starts

    The system where the program will not run is on another continent, therefore I must rely on someone else to perform experiments. I was able to recompile the QT program with the -g FLAG set and send a new version. The end user returned the following:

    # ldd -r QTTest2
    ldd: exited with unknown exit code (139)
    # gdb QTTest3
    GNU gdb Red Hat Linux (6.5-16.el5rh)
    Copyright (C) 2006 Free Software Foundation, Inc.
    GDB is free software, covered by the GNU General Public License, and you are
    welcome to change it and/or distribute copies of it under certain conditions.
    Type "show copying" to see the conditions.
    There is absolutely no warranty for GDB. Type "show warranty" for details.
    This GDB was configured as "i386-redhat-linux-gnu"..."/usr/local/tmp/QTTest3": not in executable format: File format not recognized
    NOTE: QTTest3 is the same source as QTTest2. The only change is that the -g CFLAG was set in the Makefile and the target name was changed.

    I have attempted sending the executable that works on the local system several times and with several methods (email, FTP, Skype).

    Karl

  4. #4
    Join Date
    Feb 2008
    Posts
    98
    Thanks
    2
    Thanked 24 Times in 24 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Segmentation Fault when Program Starts

    Do not set the -g flag manually in the makefile, since the makefile is automatically generated by qmake and it will be overwritten the next time you run qmake. Add "CONFIG += debug" in the project file instead or run qmake with the -debug parameter.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Segmentation Fault when Program Starts

    Are you sure the application is compiled for the right architecture? Where was the application compiled and how?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #6
    Join Date
    Feb 2006
    Location
    Jarrell, Texas, USA
    Posts
    70
    Thanks
    7
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Segmentation Fault when Program Starts

    Both applications are compiled on an i686 machine running RHEL 5.
    The target system is also an i686 machine running RHEL5.

    Here is the output of uname -a for both systems:

    Development system:
    Linux <hostname removed> 2.6.18-8.el5 #1 SMP Fri Jan 26 14:15:21 EST 2007 i686 i686 i386 GNU/Linux
    Target system:
    Linux <hostname removed> 2.6.18-8.el5 #1 SMP Fri Jan 26 14:15:21 EST 2007 i686 i686 i386 GNU/Linux
    Karl

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Segmentation Fault when Program Starts

    What does "file QTTest3" return and what does "file /bin/bash" return?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. #8
    Join Date
    May 2008
    Location
    Kyiv, Ukraine
    Posts
    418
    Thanks
    1
    Thanked 29 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Segmentation Fault when Program Starts

    1. What version of Qt is on you r target machine?
    2. Turn the core dumping on using ulimit or limit(depending on your shell). When your program fails investigate that core dump.
    I'm a rebel in the S.D.G.

Similar Threads

  1. Replies: 2
    Last Post: 16th June 2010, 23:58
  2. Segmentation fault
    By Schimanski in forum Qt Programming
    Replies: 20
    Last Post: 31st August 2009, 16:26
  3. Segmentation fault running any QT4 executables
    By jellis in forum Installation and Deployment
    Replies: 7
    Last Post: 19th May 2007, 16:35
  4. why does qt program meet segmentation fault?
    By wquanw in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 15th May 2006, 16:52
  5. Icons missing => segmentation fault
    By antonio.r.tome in forum Qt Programming
    Replies: 4
    Last Post: 8th March 2006, 16:30

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.