PDA

View Full Version : Deploying program with plugin on different computer



Tottish
18th December 2010, 15:50
Hello!
I'm trying to deploy an application on a computer other than my own and I seem to have some problem with loading the MySQL driver plugin.

Facts:
1. I'm using the 2010.05 SDK on a win7 x64 PC for developing. I'm using Qt Creator and MinGW.
2. I have successfully compiled and used the MySQL-driver on the machine mentioned above.
3. I have both a qsqlmysqld4.dll and a qsqlmysql4.dll in my C:\Qt\2010.05\qt\plugins\sqldrivers folder so I guess it is successfully built in both debug and release mode. Also I can compile my current "database-list-application" in both debug and release mode with full functionality.
4. When I use Dependency Walker on the built executable I get the compiler specific dll's (LIBGCC_S_DW2-1.dll and MINGWM10.dll) in the list along with the QtCore4, QtGUI4 and QtSQL4.dll. But I can't find anything about dependencies towards the mysql-plugin/driver dll.

Questions:
How do I deploy my application on a different computer?
I have another machine here using the same OS (with no Qt installs or programs) but I can't get the database connection to work on that one.
What I have tried is to put the executable (built in release-mode) and all the DLL's listed in dep-walker in the same folder on the target computer and put the qsqlmysql4.dll in a subfolder called 'plugins'. I also tried naming the subfolder 'sqldrivers' and putting the dll-file in 'plugins\sqldrivers' and also directly in the folder with the executable but it all ends up with the database connection not functioning properly.

I've read the docs about deploying qt plugins but I'm not sure what's wrong here.

Anyone have any ideas about how to further troubleshoot or, even better, solve this matter?

Thank you!
/Tottish

ChrisW67
18th December 2010, 21:21
This is the directory structure my deployed application uses:


C:\Program Files\
MyProgram\
MyProgram.exe
mingwm10.dll
libgcc_s_dw2-1.dll
QtCore4.dll
QtGui4.dll
...
sqldrivers\
qsqlite4.dll
imageformats\
...
iconengines\
...
So your general layout was OK. Your Mysql plugin has dependencies of its own on one or more Mysql DLLs that must also be present on the target system. Try running Depends.exe against the Mysql plugin.

ShapeShiftme
19th December 2010, 04:54
I use mysql drivers for my apps.

inside you program directory you need to have a directory called sqldrivers/
inside the put in your qsqlmysql4.dll.

but dont forget to add libmySQL.dll to the program base directory with your other dll's

You get the libmySQL.dll from your mysql directory. there might be 2 if i remember, so if one doesnt work try the other.

Hope this is of help to you

Regards
Donovan Hoare

Tottish
19th December 2010, 09:45
Howdy!
Thanks a lot for the pointers. It was the absent libmysql.dll that was the problem. Why doesn't dependency-walker list the plugin DLLs?... hmmm...

Tried my app on Win7 64-bit and Xp 32-bit (without recompiling the MySQL plugin) with seemingly full functionality so I guess that it should work on any platform in between which was my goal!
Thanks a lot guys, I really appreciate it!

Have a beautiful Sunday!
/Tottish

ChrisW67
19th December 2010, 21:10
Dependency Walker can only list the dependencies that are explicitly encoded in the executable. Plugins are designed to be on-demand loaded so there is nothing in the executable that the can be used to determine if they are actually dependencies or not.

Tottish
20th December 2010, 09:01
Ahhh, I see.
Thank you, Chris, for that very useful information!

Cheers and Merry Christmas!
/Tottish