QT Deployment error

621 views Asked by At

I am trying to deploy a QT5.4.1 appplication on Windows 7 - x86.

As always, everything is working fine on my machine, but not in the end user's machine.

When I try to run the app, it gives me the following error:

enter image description here

After searching on the internet, most solutions say that I need to add a platforms folders containing some dlls (qminimal, qoffscreen, etc) to the deployment package. I tried that with no success.

The funny thing is that I copied QT installation folder to the end user machine and deleted everything except this folder (C:\Qt\Qt5.4.1\5.4\msvc2012_opengl\plugins\platforms) and it works fine.

So, somehow my app is looking for the platforms folders in QT installation folder instead of the deployment package folder.

Does anyone know how to solve it?

EDIT: I have managed to change all QT Dlls to the release version (without "d" sufix). However, when i compile my project I still get some vc++ dlls in debug mode. I checked all project configurations in both "linker" and "c/c++" sections and they all use "release" configurations. When I run the program, It gives me a "debug assertion failed". Why I am getting the debug versions of vc++ dlls?

Here is the dependency walker screenshot

dependecy walker

2

There are 2 answers

0
guilhermecgs On

I figure out what is wrong, although I don't have the solution yet. Even without the solution, I think this answer might be helpful.

My project output is a DLL that has a GUI made in QT.

Another program calls this DLL and during DLL_PROCESS_ATTACH a QT GUI is created.

According to the documentation, QT looks for the plugins in:

in the directory containing the application executable, i.e. > QCoreApplication::applicationDirPath() + QDir::separator() + "qt.conf"

That´s why the QCoreApplication::applicationDirPath() is not the deployment directory where the DLL is located, but the directory where the external program *.exe is running. I think QT is looking for the qt.conf file in this *.exe location

EDIT: there is nothing to do with debug or release versions

1
adlag On

The comments of Mezzo seem very relevant. We regularly deploy commercial Qt Windows applications. You could use dependency walker to find the dependencies or just double click on the executable and look at the Windows complaint about what dll's are missing. Just copy them to the deploy location, preferably with a qmake script.

The plugin dll's are more difficult to deal with. They do not show up as dependencies. The operating system could complain about their absence (dll's located in the subdir "platforms" for instance) or your application might just not use their functionality (dll's in the subdir "imageformats" for instance) without any complaint. To protect yourself against the latter case you have to test drive your application thoroughly.

Windows does not need a qt.conf file. Just create the subdirs "platforms", "imageformats", ... in the application dir and copy the plugin dll's there. As an example I show the full content of an (mingw) application dir that even when copied to a virtual machine runs without any problem.

snapshot of content of a deployed Qt Windows application

Qt5Btc1.dll is our own dll.