tags:

views:

51

answers:

2

I've written a Open Source program that I've released as GPL built using the Qt4 LGPL SDK. This program has the ability to search an optional Sqlite3 database for data.

Here is what is making me lose my mind. I compile the program on the development machine. When I try to run it, I can errors about missing DLLs. I copy those dlls into the same directory as the executable and it now works fine ( mingwm10.dll, libgcc_s_dw2-1.dll, QtCore4.dll, QtSql4.dll, QtGui4.dll ), including the database search.

Now, if I copy that folder with the executable and the DLLs to a new machine that has not had the SDK installed on it, it runs fine until I try to search. As soon as I hit the search button, I can the following error:

Title: Microsoft Visual C++ Runtime Library Runtime Error! This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.

I then download and install the SDK, doing nothing else, I can now run the program and search the sqlite3 file just fine!

What magic am I missing?

Thanks in advance.

P.S. Both machines are freshly installed Windows XP systems.

+2  A: 

You may have some libs or Qt plugins that are not deployed to the target machine. It most likely is the SQL driver plugin. Here's some info about it: http://doc.trolltech.com/latest/deployment-windows.html#qt-plugins

You'll need to copy the needed Qt plugins to a directory next to your executable. And add something like this in your main():

 QApplication::addLibraryPath(QCoreApplication::applicationDirPath() + "/plugins");

(Edited link and added code)

Stephen Chu
And you need http://www.dependencywalker.com/
Martin Beckett
I think you've hit on it right here. The plugin I need is qsqlite4.dll. How how the heck do I use it? Do I need to add code to my program to explicitly load it? I've been messing with putting it in different places and adding a qt.conf file for over an hour without luck.
Kyle
@Kyle: I edited my answer to what I think will work.
Stephen Chu
A: 

I found the problem.

Stephen Chu was correct in that I was missing the sqlite driver. However, I can into more complications along the way.

The SDK comes with two sets of dlls. One set resides in $BASEDIR/bin and the other in $BASEDIR/qt/bin. The former contains the dlls used by Qt Creator, while the latter are the dlls that you want to ship with your executable.

I needed to take the sqlite plugin ( qsqlite4.dll ) and copy it to APP_DIR/sqlplugins. My problem was I was using the wrong qsqlite4.dll file.

A big thanks to everyone who contributed to this question.

For future reference, this issue was also discussed here: http://www.qtforum.org/article/34639/qt4-program-crashing-unless-sdk-installed.html

Kyle