Results 1 to 12 of 12

Thread: Qt, Windows 7, Dependency Walker and Deployment Problems

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2010
    Posts
    14
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Qt, Windows 7, Dependency Walker and Deployment Problems

    Good day all!

    Preliminaries:

    Qt Creator 2.0
    Qt 4.7.0 (32 bit)
    Windows 7 Professional

    I believe my issues are mostly Windows related, but seeing that my application was written and runs out of Qt without problems, I hoped that someone here might be able to offer some insight.

    The program runs and tested fine out of Qt Creator itself. No crashes, no bugs (yet?) and no problems. Happy Days! Now, I had to make this app deployable and went the route of Dependency Walker (v 2.2.6) + Visual Studio 2010 Pro. Profiling my app with Dependency Walker lists a number of warnings, most of which are only that, one or two that I've managed to eliminate as problems and none which stops the program from executing.

    Finally we get to the meat of the matter. The program works fine, everything runs smoothly up until the point where I spawn new threads to connect to a server and I get the following:

    First chance exception 0xC0000094 (Integer Divide by Zero) occurred in "c:\build\path\release\APP.EXE" at address 0x004028CF.
    Second chance exception 0xC0000094 (Integer Divide by Zero) occurred in "c:\build\path\release\APP.EXE" at address 0x004028CF.
    Nowhere do I do any calculations in my program so where does the integer division by zero come from? I'm willing to post code if required, but as it all works out of Qt, I'm not so sure it's a code issue.

    Any and all input will be greatly appreciated and please tell me if you'd like more of the Dependency Walker log before the crash happens.

    Thanks!
    Jits

  2. #2
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt, Windows 7, Dependency Walker and Deployment Problems

    Well these kind of errors get eliminated by doing some logging. put a qDebug() (or write to file ) before entering major functions of your app (such as mainwindow ctor) and this way you can reach the code which is doing the bad. BTW, i read somewhere that VS2010 has problems with some assembly and hence not recommended.

  3. #3
    Join Date
    Sep 2010
    Posts
    14
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Qt, Windows 7, Dependency Walker and Deployment Problems

    If it is a code issue, why would it run out of Qt without any problems? Surely a division by zero would be a division by zero regardless of whether I run it from the Qt Creator GUI or not? Or doesn't it necessarily work that way?

  4. #4
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt, Windows 7, Dependency Walker and Deployment Problems

    in Qt Creator, u run the debug exe or release exe? Furthurmore, are u using the correct dlls from the Qt SDK ?

  5. #5
    Join Date
    Sep 2010
    Posts
    14
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Qt, Windows 7, Dependency Walker and Deployment Problems

    I run in release. I can also run the .exe outside of Qt (running it from the \build\release folder or from a shortcut on my Desktop that points to the .exe within that folder).

    Which .dll's are you referring to?

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

    Default Re: Qt, Windows 7, Dependency Walker and Deployment Problems

    QtCore4.dll, QtGUI4.dll, etc.

  7. #7
    Join Date
    Sep 2010
    Posts
    14
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Qt, Windows 7, Dependency Walker and Deployment Problems

    I haven't deployed the app to vanilla machines yet so all the Qt dll's are available as I'm still running the app on the development box and, as I said, it runs fine there when run from Qt Creator or from the \build\release folder. However, the Dependency Walker issues appear on the same (dev) box so I'm not sure what these .dll's have to do with the issue...

    ...or are you referring to library includes in my project file? I'm sorry if I'm missing the obvious, but I don't think I'm on the same page as you guys.

  8. #8
    Join Date
    Sep 2010
    Posts
    14
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Qt, Windows 7, Dependency Walker and Deployment Problems [SOLVED]

    I found the problem.

    I had a typical

    Qt Code:
    1. #ifndef MYTHREAD_H
    2. #define MYTHREAD_H
    3.  
    4. #include <QThread>
    5.  
    6. class MyThread : public QThread
    7. {
    8. Q_OBJECT
    9.  
    10. public:
    11. MyThread(QObject *parent = 0);
    12. ~MyThread();
    13. void run();
    14.  
    15. };
    16.  
    17. #endif // MYTHREAD_H
    To copy to clipboard, switch view to plain text mode 

    setup and, as advised in the Qt documentation, I simply re-implemented the run() function. In my main thread, I had


    Qt Code:
    1. MyThread *thread = new MyThread();
    2. thread->start();
    To copy to clipboard, switch view to plain text mode 

    and this is where things went wrong, as I'd understood from the Qt docs that start() would automatically call run()

    void QThread::start ( Priority priority = InheritPriority ) [slot]
    Begins execution of the thread by calling run(), which should be reimplemented in a QThread subclass to contain your code. The operating system will schedule the thread according to the priority parameter. If the thread is already running, this function does nothing.

    The effect of the priority parameter is dependent on the operating system's scheduling policy. In particular, the priority will be ignored on systems that do not support thread priorities (such as on Linux, see http://linux.die.net/man/2/sched_setscheduler for more details).

    See also run() and terminate().
    I can't remember why I didn't just call run() from the beginning (I'm not sure if there even was a valid reason), but the problem went away as soon as I changed my thread execution call to

    Qt Code:
    1. MyThread *thread = new MyThread();
    2. thread->run();
    To copy to clipboard, switch view to plain text mode 

    I'm not sure why this worked (or, for that matter, why calling start() didn't), but I now have a complete profile in Dependency Walker and no more crashes.

    Fingers crossed that the deployment will go more smoothly than this did!

  9. #9
    Join Date
    Sep 2010
    Posts
    14
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Qt, Windows 7, Dependency Walker and Deployment Problems [SOLVED]

    Seems I got too excited, too soon.

    start() initiates the thread's event loop and one of my functions relied on the QThread::finished() signal to terminate a connection. This is now no longer emitted seeing that there is no event loop anymore. I've tried various combinations of exec() and quit() to "manually" start up and exit an event loop, but no luck to date. An explicit emission of finished() might be the way forward. Perhaps I'll also have to look at QThreadPool to manage all the startups...I don't know.

    Will report back here if I manage to find a solution.

  10. #10
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Qt, Windows 7, Dependency Walker and Deployment Problems [SOLVED]

    Dependency Walker, is that a program that just scans your program or does it actually run your program? Or do you get these errors from just running it outside Qt Creator.
    The problem you mention is on one and only one pc only, the develoment pc?

    These things aren't really clear at the moment.

    If this is on the same pc, but the program is being run in different environments, and it works in one and not in another, then the problem is in the environment.

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

    Default Re: Qt, Windows 7, Dependency Walker and Deployment Problems [SOLVED]

    Dependency Walker is a simple program that just lists the dependancies for your program (eg. QtGUI4.dll), so you can easily bundle the right libraries with your program for distribution.

    It can be found here: http://www.dependencywalker.com/

  12. #12
    Join Date
    Sep 2010
    Posts
    14
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Qt, Windows 7, Dependency Walker and Deployment Problems

    If you profile your program with Dependency Walker, it actually runs the application as it would normally, picking up all the run time dependencies as it does so (all your program's functionality is enabled and accessible during the profiling).

    Running the app on the development machine (outside Qt Creator) gives me no errors, running it from within Qt Creator (on the development machine) gives me no errors, profiling it in Dependency Walker (on the dev box) causes it to crash with the error messages I mention in the original post. I've tried deploying the program to vanilla machines but it crashes at the same point as the program does when profiled with Dependency Walker, deploying the app to machines with Qt Creator installed causes no problems. The crashing from within Dependency Walker and also when running on the vanilla machines ceases once I make the changes as listed in post #8 above, but introduces new problems as I mention in #9.

    I hope this is clearer (?)

    Having said all of this, it seems as if the Qt documentation on QThread is actually wrong and that it should be used completely different from what the documentation suggests. I haven't yet had time to delve into it, but here's why I make this bold statement:

    You're Doing It Wrong

    Threading Without The Headache

    So perhaps the problem lies with my subclassing of QThread and re-implementation of the run() function. I don't know yet.

    If there is anything else you'd like to know, please ask as I don't know what information may or may not be of use in solving this problem.

    Thanks for taking the time out to get involved!

Similar Threads

  1. Linux deployment issue, dependency not satisfiable.
    By skepticalgeek in forum General Programming
    Replies: 1
    Last Post: 29th November 2010, 14:23
  2. ssl problems on deployment
    By nomadscarecrow in forum Installation and Deployment
    Replies: 4
    Last Post: 20th July 2010, 17:24
  3. Deployment Procedure On Windows On Linux and Windows
    By Harshith J.V. in forum Installation and Deployment
    Replies: 4
    Last Post: 9th July 2009, 12:27
  4. Deployment problems on Windows...help
    By Hookem in forum Installation and Deployment
    Replies: 2
    Last Post: 11th December 2008, 10:21
  5. deployment of Qt 4.3.4 exe on Windows?
    By vishal.chauhan in forum Installation and Deployment
    Replies: 5
    Last Post: 1st April 2008, 13:30

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.