Results 1 to 7 of 7

Thread: Problems with static linking -->segmentation fault

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2010
    Posts
    7
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Problems with static linking -->segmentation fault

    Thank you for your reply, I need to make it static because it has been asked to me, it's not my decision .
    So if you know something about how to fix it i'll be very pleased. Every idea will be welcome

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problems with static linking -->segmentation fault

    Then you need to ensure you use the exact same libraries to statically link your app as are present on the target machine.

    and make sure you comply with the Qt license for statically compiled applications - it's not as flexible as the one for dynamically linked apps.

  3. #3
    Join Date
    Mar 2010
    Posts
    7
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Problems with static linking -->segmentation fault

    Yes, I know I need exactly the same libraries, but as I see in the trace, there is something strange happening and I don't know what. That's what I'm asking for.
    Thank you!

  4. #4
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problems with static linking -->segmentation fault

    Well, static linking with pthread is known to segfault (I'm not saying its the fault here, but it might be. It's known to cause people problems). You could try rebuilding gcc to allow for proper thread local storage in your libstdc++ library, but you will then have to update the libraries on the target to match with your recompiled libraries on the host.

    Much easier to just dynamically link

  5. #5
    Join Date
    Dec 2016
    Posts
    1
    Platforms
    Unix/X11

    Default Re: Problems with static linking -->segmentation fault

    The solution is to surround -lpthread by two more switches i.e.,
    -Wl,--whole-archive -lpthread -Wl,--no-whole-archive

    Ref:
    http://stackoverflow.com/questions/9...entation-fault

Similar Threads

  1. QWT - Segmentation Fault
    By Wojtek.wk in forum Newbie
    Replies: 0
    Last Post: 17th April 2010, 14:29
  2. segmentation fault
    By navid in forum Qt Programming
    Replies: 3
    Last Post: 20th December 2009, 11:40
  3. Static linking problems.
    By Unplugged in forum Newbie
    Replies: 8
    Last Post: 17th February 2008, 02:25
  4. segmentation fault
    By mattia in forum Newbie
    Replies: 22
    Last Post: 7th November 2007, 10:37
  5. segmentation fault
    By shamik in forum Qt Programming
    Replies: 3
    Last Post: 24th November 2006, 07:33

Tags for this Thread

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.