Qt-interest Archive, November 2007
Deploying Qt + plugins on Vista
Message 1 in thread
Hi,
The scenario is as follows,
* service being deployed for Vista
* uses Qt + plugins
* uses MSVC80 so SxS
Now, SxS on Vista is not installed until after installation so
installing a service, that is then started by installer, requires that a
local install of the C runtime takes place. This is done by installing
the C runtime as,
[INSTALLLOCATION]
+ service.exe
+ Microsoft.MSVC.Crt
\---+ msvcr80.dll
\---+ ...
+ sqldrivers
\---+ qsqlodbc4.dll
Now, the problem is that the plugin cannot be loaded because the VC
runtime is not available. Clearly, it is available in the parent
directory. The simplest fix is to put sqlodbc4.dll in the same directory
as the service.exe, but of course there is no way to tell Qt to check
that directory for sqldrivers (or is there??)
Static linking is not really possible. Hacking Qt so plugins are
searched in the install location of the executable would be much better,
but I do not wish to patch the Qt 4 every version as I had to with Qt 3.
The ugliest fix is to deploy the C runtime in the plugin folder as well
- ugly hack to say the least.
Any suggestions?
- Adam
--
[ signature omitted ]
Message 2 in thread
Adam M wrote:
> Now, the problem is that the plugin cannot be loaded because the VC
> runtime is not available. Clearly, it is available in the parent
> directory. The simplest fix is to put sqlodbc4.dll in the same directory
> as the service.exe, but of course there is no way to tell Qt to check
> that directory for sqldrivers (or is there??)
Maybe this document will be useful in this case:
http://doc.trolltech.com/4.3/deployment-windows.html#qt-plugins
David
--
[ signature omitted ]
Message 3 in thread
Hello Adam,
I also spent a long time to solve that problems for me. First guilty is
Trolltech, they ship their commercial (this is, what I have) version
with link switch embed_manifest_dll for the plugins, but these will not
run on most systems with this switch set (documentation shows this, but
is hard to find, if you do not know the word deploy (I'm from germany).....
Solution is:
change the pro for your plugin and add
CONFIG -= embed_manifest_dll, then run QMake again and nmake. That will
do the first job.
Next copy all msvc*.dll from your compilers folder, this folder is named:
\visualstudio2005\VC\redist\x86\Microsoft.VC80.CRT
msvcm80.dll
msvcr80.dll
msvcp80.dll
Microsoft.VC80.CRT.manifest
Copy these files into the same directory as your service.exe
Trolltech stated, that the search for plugins added also
directory_of_executable to the search path, but this did not work for me
(QT 4.3.2), so I added the line to main.cpp:
QStringList List;
List << "dir1" << "dir2".....;
app.setLibraryPathes(List);
if you load QtDir::currentDirectory() in main.cpp and add a /plugins to
it and move it to "List", then you could create a subdir
plugins/sqldrivers under the folder, where your exe is.
This works for me. But the concept with that f**cking fixed pathes
inside the source code is not so professional and should be changed by
Trolltech and replaced by a better solution !
In my opinion, when I buy QT commercial, I do that not for playing
around, but for selling computer software based on QT, so QT
professional settings should reflect this....
I hope, it helps.
Regards,
Peter
Adam M schrieb:
> Hi,
>
> The scenario is as follows,
>
> * service being deployed for Vista
> * uses Qt + plugins
> * uses MSVC80 so SxS
>
> Now, SxS on Vista is not installed until after installation so
> installing a service, that is then started by installer, requires that a
> local install of the C runtime takes place. This is done by installing
> the C runtime as,
>
> [INSTALLLOCATION]
> + service.exe
> + Microsoft.MSVC.Crt
> \---+ msvcr80.dll
> \---+ ...
> + sqldrivers
> \---+ qsqlodbc4.dll
>
> Now, the problem is that the plugin cannot be loaded because the VC
> runtime is not available. Clearly, it is available in the parent
> directory. The simplest fix is to put sqlodbc4.dll in the same directory
> as the service.exe, but of course there is no way to tell Qt to check
> that directory for sqldrivers (or is there??)
>
> Static linking is not really possible. Hacking Qt so plugins are
> searched in the install location of the executable would be much better,
> but I do not wish to patch the Qt 4 every version as I had to with Qt 3.
> The ugliest fix is to deploy the C runtime in the plugin folder as well
> - ugly hack to say the least.
>
> Any suggestions?
>
> - Adam
--
[ signature omitted ]