Results 1 to 6 of 6

Thread: linux "Segmentation fault"

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2010
    Posts
    6
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default linux "Segmentation fault"

    i built my program on ubuntu with qt creator successfully, and then i ran it failed by given the output "Segmentation fault".

    now i can do nothing, anybody can be nice to tell me why?

  2. #2
    Join Date
    Oct 2009
    Posts
    151
    Thanks
    6
    Thanked 13 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: linux "Segmentation fault"

    Segmentation faults happen when a programme tries to access memory outside of that allocated to it.

    The result of such a fault is 'undefined' which generally means a crash of some description.

    They are normally caused by rogue pointers, over-running array bounds etc.

  3. #3
    Join Date
    Jan 2006
    Location
    Frankfurt
    Posts
    500
    Thanks
    1
    Thanked 52 Times in 52 Posts
    Platforms
    MacOS X Unix/X11

    Default Re: linux "Segmentation fault"

    Start your programm using a debugger, wait for the crash, invoke the "backtrace" function of the debugger and post the output here.
    It's nice to be important but it's more important to be nice.

  4. #4
    Join Date
    Mar 2010
    Posts
    6
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: linux "Segmentation fault"

    thank you
    so far I know why I was told "Segmentation fault",
    I just comment some "can not run" code which tie my hands and then I totally forgot
    now I uncomment those code, the red compile output come to me again

    ../build/debug/libMarkerDB.so: undefined reference to `void IndexerWrapper::write<QByteArray>(short, QByteArray const&) const'
    ../build/debug/libMarkerDB.so: undefined reference to `void IndexerWrapper::write<short>(short, short const&) const'
    make: Leaving directory `/home/pad/Source/4.8.0_marker/branches/Marker_Refact/Marker'
    ../build/debug/libMarkerDB.so: undefined reference to `void IndexerWrapper::write<QString>(short, QString const&) const'
    collect2: ld returned 1 exit status
    make: *** [../build/debug/Marker] Error 1
    Exited with code 2.
    Error while building project Marker
    When executing build step 'Make'


    due to the output above, I checked the file defined that template function.
    and I am sure that header file was included well.

    the template function was defined just like :
    template <typename T>
    void IndexerWrapper::write(short code, const T &value) const {}
    maybe I express myself not so clearly , my English is not so good
    hope all those message is enough for you to give me some tips...thanks
    Last edited by harrison; 3rd March 2010 at 05:08.

  5. #5
    Join Date
    Mar 2010
    Posts
    6
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: linux "Segmentation fault"

    so strange
    I moved that function definition from source file to header file, it built normally.
    but when it ran, "Segmentation fault" came again..
    I did as axeljaeger said, got things as follow:
    warning: (Internal error: pc 0x46e1a1 in read in psymtab, but not in symtab.)


    Program received signal SIGSEGV, Segmentation fault.
    0x02ac3f93 in strlen () from /lib/tls/i686/cmov/libc.so.6
    (gdb) backtrace
    #0 0x02ac3f93 in strlen () from /lib/tls/i686/cmov/libc.so.6
    #1 0x02c684ff in XSetCommand () from /usr/lib/libX11.so.6
    #2 0x02c6cf51 in XSetWMProperties () from /usr/lib/libX11.so.6
    #3 0x06d73134 in QWidgetPrivate::create_sys (this=0x83782d0, window=0, initializeWindow=true, destroyOldWindow=true)
    at /var/tmp/qt-src/src/gui/kernel/qwidget_x11.cpp:795
    #4 0x06d2bb21 in QWidget::create (this=0xbffff1ec, window=0, initializeWindow=true, destroyOldWindow=true)
    at /var/tmp/qt-src/src/gui/kernel/qwidget.cpp:1319
    #5 0x06d2e7b1 in QWidget::setVisible (this=0xbffff1ec, visible=true) at /var/tmp/qt-src/src/gui/kernel/qwidget.cpp:7353
    #6 0x081730f0 in QWidget::show (this=0xbffff1ec) at /usr/local/qt-4.6.2/qt/include/QtGui/qwidget.h:485
    #7 0x00bc827d in PadSystem::PadSplashScreen::show (this=0xbffff1ec) at src/PadSplashScreen.cpp:58
    #8 0x08223a46 in main (argc=1, argv=0xbffff304) at main.cpp:66
    (gdb)

  6. #6
    Join Date
    Oct 2009
    Posts
    151
    Thanks
    6
    Thanked 13 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: linux "Segmentation fault"

    The error seems to be generated by a strlen() call.

    Is the argument a proper ctype null terminated string?

Similar Threads

  1. why is there so strange "Segmentation fault" ?
    By lanmanck in forum Qt Programming
    Replies: 9
    Last Post: 2nd March 2010, 12:55
  2. why qstringlist *ps "Segmentation fault"?
    By lanmanck in forum Qt Programming
    Replies: 6
    Last Post: 23rd September 2009, 07:46
  3. Replies: 4
    Last Post: 19th February 2009, 16:56
  4. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:05
  5. QFile Problem~ "Unknow error" in "open(QIODevice::ReadWrite)"
    By fengtian.we in forum Qt Programming
    Replies: 3
    Last Post: 23rd May 2007, 15:58

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
  •  
Qt is a trademark of The Qt Company.