PDA

View Full Version : How to deal with jpeg deployment problem with Visual C++ compiler


nooky59
25th March 2008, 16:58
Hi everybody,

As I've banged hy head all the week-end with it, trying a lot of stuffs, reading a lot of stuffs too on this forum and in the Qt doc, I will post a little how-to.

With Visual C++, having jpeg working on another fresh computer is not as simple as copying the qtjpeg4.dll in a imageformats subfolder... It is really frustrating to discover that after discovering that jpeg is a plugin and that it should work this way.

It works perfectly with MinGW but not with Visual C++.

The first thing to do to have it working is to definitely forget about a local installation of the Microsoft Visual C++ run-time (so in the same folder than the app). In this way, the jpeg plugin won't work.

So, you will have to install the Visual C++ redist system wide with the installer vcredist_x86.exe that you can found on the Microsoft Website.

It is possible to install it silently : http://blogs.msdn.com/astebner/archive/2007/02/07/update-regarding-silent-install-of-the-vc-8-0-runtime-vcredist-packages.aspx

This is the way I do with the NSIS installer (but if someone know how to forbid or warn if the user wants to remove the Visual C++ redist separately, don't hesitate to post on the thread ;o)).

But this is not enough. Don't esperate to have the jpeg plugin working by putting it in the app subfolder.

You should write a qt.conf file in the app folder on the target machine :


[Paths]
Plugins = plugins


If you do like above, you should place the qtjpeg4.dll in the subfolder plugins\imageformats from the app folder.

Then, it will work !

Quite boring to spend lot of hours on that, hope it will help. Don't hesitate to add it in the FAQ

jacek
25th March 2008, 21:35
You should write a qt.conf file in the app folder on the target machine :


[Paths]
Plugins = plugins


If you do like above, you should place the qtjpeg4.dll in the subfolder plugins\imageformats from the app folder.
If you don't want to use qt.conf file, you can simply put the qjpeg4.dll plugin in imageformats subdirectory.

nooky59
25th March 2008, 23:16
No, it don't work with a program compiled with Visual C++.

To add it directly in the imageformats subfolder, I had to put Plugins = . in the qt.conf.

With MinGW, no problem, what you said works.

ChristianEhrlicher
26th March 2008, 07:42
It for sure works the way jacek said. There must be an error on your side. If it won't work that way, none of my programs would work on another computer and I doubt that :)

nooky59
26th March 2008, 12:11
With two advices, I couldn't resist to try again and it works ! I'm quite surprising cause I'm quite sure I have tested it with the run-time installed system-wide.

nooky59
27th March 2008, 12:20
I have new informations about how to deal with this issue.

If someone still want a dynamically build app with the plugin jpeg linked dynamically but without the need to install the Visual C++ runtime system-wide, you must recompile the jpeg (or other standard Qt plugin) like that :


cd qt\src\plugins\imagefomats\jpeg
nmake distclean
qmake "CONFIG-=embed_manifest_dll"
nmake


Et voilą... Now, you can bundle the Visual C++ runtime locally to the app rather than systemw-ide.

It's better cause with the system-wide approach :

- The user can remove it without removing from the add / remove programs panel. Then it will break your app that won't start

- You can't (at least easily) remove the system wide Visual C++ runtime when removing your app with an uninstaller without knowing if another app on the system need this system-wide runtime.

I really don't know why TrollTech didn't add the CONFIG-=embed_manifest_dll switch per default for its standard plugins.