Results 1 to 4 of 4

Thread: (SOLVED) Different compile sequence in Windows and Linux

  1. #1
    Join Date
    Dec 2009
    Posts
    26
    Thanks
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Lightbulb (SOLVED) Different compile sequence in Windows and Linux

    This is more of a reporting than a question! Hope somebody will find it useful.

    I have a project which produces a executable say pro (in Linux or pro.exe in Windows). This executable, when run, searches for its plugins in a predefined folder. Suppose that in that folder there is plugin say plu.so (in Linux or plu.dll in Windows). This plugin again linked with sqlite3.so (in Linux or sqlite3.dll in Windows). The plugin and the program have different pro files and compiler one after the other using a 3rd pro files which has

    Qt Code:
    1. SUBDIRS = pro plu
    To copy to clipboard, switch view to plain text mode 

    The plugin source code is divided in to two classes A (a.h and a.cpp) and B (b.h and b.cpp). class B wraps sqlite3 library to provide class A some sqlite3 functions in C++ way. So a.h starts with

    Qt Code:
    1. #include "b.h"
    To copy to clipboard, switch view to plain text mode 

    What happens is that for windows I have to set the sequence of cpp files in pro file of the plugin like

    Qt Code:
    1. SOURCES += a.cpp b.cpp
    To copy to clipboard, switch view to plain text mode 

    Whereas in Linux the sequence is

    Qt Code:
    1. SOURCES += b.cpp a.cpp
    To copy to clipboard, switch view to plain text mode 

    So, my QMake files has

    Qt Code:
    1. win32:SOURCES += a.cpp b.cpp
    2. unix:SOURCES += b.cpp a.cpp
    To copy to clipboard, switch view to plain text mode 

    The problem is if I change the sequence in a platform to the sequence of the other platform - the plugin as well as the program crash!!!

    Can anyone tell me why this is happening? My code is large so I can't post everything here, sorry for that.

    By the way - I am using Windows 7 32bit and Fedora LXDE 64bit both have Qt 5.2 installed.
    Last edited by rittchat; 27th June 2014 at 10:08.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Different compile sequence in Windows and Linux

    There is definitely something very wrong when the order of compilation matters.

    Do you get anything from the stack trace when it crashes?

    Cheers,
    _

  3. The following user says thank you to anda_skoa for this useful post:

    rittchat (27th June 2014)

  4. #3
    Join Date
    Dec 2009
    Posts
    26
    Thanks
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Different compile sequence in Windows and Linux

    Please tell me how to get the stack trace.

    _________

    @anda_skoa

    You are absolutely right. In class B's ctor I was clearing a global vector! So stupid of me! Thanks a million for pointing me on stack trace. I have fixed my problem.
    Last edited by rittchat; 27th June 2014 at 09:57.

  5. #4
    Join Date
    Oct 2012
    Posts
    132
    Thanks
    10
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Different compile sequence in Windows and Linux

    If you're using Qt Creator simply use its debugging feature: http://qt-project.org/doc/qtcreator-...debugging.html

    But if the "compile sequence" matters you're definitely something wrong, eg. the "static initialization order fiasco": http://www.parashift.com/c++-faq/sta...first-use.html
    Last edited by Infinity; 28th June 2014 at 01:46.

Similar Threads

  1. compile Windows for Linux
    By mergele in forum Newbie
    Replies: 1
    Last Post: 26th August 2013, 19:06
  2. How do I compile for linux on windows?
    By waitingforzion in forum Newbie
    Replies: 4
    Last Post: 28th December 2009, 07:51
  3. Project won't compile under Windows (works under Linux)
    By philski in forum Qt Programming
    Replies: 7
    Last Post: 14th September 2006, 15:29
  4. how to corss compile for windows in Linux
    By safknw in forum Qt Programming
    Replies: 24
    Last Post: 13th May 2006, 05:23
  5. Replies: 4
    Last Post: 12th January 2006, 04:16

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.