PDA

View Full Version : Empty window when running application on Windows XP 32 bits



athan_david
16th September 2013, 19:18
Hi,

I know that it's a long post, but I think it's the only way to explain what I did.

I want to deploy my application on Windows XP SP 3 32 bits to rename files in a spefic way which I need.
My development machine has Windows 8 Pro 64 bits and I'm using Qt 5.1 with MinGW 4.8 32 bits.
For UI I'm using qml, and for the back-end (application logic) I'm using Boost libraries (I know that I can rename files with Qt sdk, I used a library for learning purposes; and I was right, took me some time until I got it right).
On the deployment side I did:
- build application on release
- copy required .dll from <compiler>/bin/;
- copy folder <compiler>/plugins/platforms.
But this was not enough (I think), I could run the application but I was getting an empty small window. I read again the deployment page and I found that I was not using the Qt Resource System (I thought that .exe file couldn't file main.qml). I did refactoring to make use of Qt Resource System, build again, copy on the deployment machine and try again. And again empty window.
Lastly I used Dependency Walker to check If I am missing something, and here is what was showing:
9598
On deployment machine I did install VC Redistributable, but didn't solve the problem.
I tried to find other option on my friend Google, but didn't find an answer.

If you know or have an idea what's wrong, please spend 2 minutes to give me a hint!
Also, if there is other specific information which is required please tell me.

ChrisW67
17th September 2013, 06:34
Sorry, invalid attachment.

The Visual C++ redistributable is not necessary for a MingW executable.
You can ignore IESHIMS.DLL which is often listed as missing.
If your program is running but not functioning correctly then it is not missing any hard dependencies. It may be missing some or all of the Qt plugins required for image formats, etc.

Run the program with a console and see if any warnings are issued.

athan_david
17th September 2013, 18:01
Thanks for reply,
Firstly, I'm sorry for attachment. Here is a valid one 9601.
Forgot to mention that I did copy image plugins, they are located in plugins/imageformats.
Did open a cmd and ran app from there, sadly it did not help me with errors or warnings. Here is the results of cmd:
<prompt>:.\application.exe
"\n"(writen by app or sth else)
<prompt>: (here app is running with an empty window).

ChrisW67
17th September 2013, 20:55
The plugins should be in the folder "imageformats" relative to the location of the executable: i.e. no intervening "plugins" folder.

athan_david
18th September 2013, 19:02
I did move the folder as you said, but nothing changed.

I think it's better to tell you which files are in which folder:


C:\Program Files\Rename Files\
+ imagesformats
- qgif.dll
- qgifd.dll
- qico.dll
- qicod.dll
- qjpeg.dll
- qjpegd.dll
- qmng.dll
- qmngd.dll
- qsvg.dll
- qsvgd.dll
- qtga.dll
- qtgad.dll
- qtiff.dll
- qtiffd.dll
- qwbmp.dll
- qwbmpd.dll
+ platforms
- qwindows.dll
- qwindowsd.dll
- qminimal.dll
- qminimald.dll
- qoffscreen.dll
- qoffscreend.dll
+ images
- browser_icon.png
- rename_icon.png
+ qml
+ Rename_Files
- Button.qml
- main.qml
- icudt51.dll
- icuin51.dll
- icuuc51.dll
- libgcc_s_dw2-1.dll
- libstdc++6.dll
- libwinpthread-1.dll
- main.o
- moc_qtquick2applicationviewer.o
- moc_renamer.o
- qrc_resource_file.o
- Qt5CLucene.dll
- Qt5CLucened.dll
- Qt5Concurrent.dll
- Qt5Concurrentd.dll
- Qt5Core.dll
- Qt5Cored.dll
- Qt5Declarative.dll
- Qt5Declaratived.dll
- Qt5Designer.dll
- Qt5Designerd.dll
- Qt5Gui.dll
- Qt5Guid.dll
- Qt5Help.dll
- Qt5Helpd.dll
- Qt5Multimedia.dll
- Qt5Multimediad.dll
- Qt5MultimediaQuick_p.dll
- Qt5MultimediaQuick_pd.dll
- Qt5MultimediaWigets.dll
- Qt5MultimediaWigetsd.ll
- Qt5Network.dll
- Qt5Networkd.dll
- Qt5OpenGL.dll
- Qt5OpenGLd.dll
- Qt5PrintSupport.dll
- Qt5PrintSupportd.dll
- Qt5Qml.dll
- Qt5Qmld.dll
- Qt5Quick.dll
- Qt5Quickd.dll
- Qt5QuickParticles.dll
- Qt5QuickParticlesd.dll
- Qt5QuickTest.dll
- Qt5QuickTestd.dll
- Qt5Script.dll
- Qt5Scriptd.dll
- Qt5ScriptTools.dll
- Qt5ScriptToolsd.dll
- Qt5Sensors.dll
- Qt5Sensorsd.dll
- Qt5SerialPort.dll
- Qt5SerialPortd.dll
- Qt5Sql.dll
- Qt5Sqld.dll
- Qt5Svg.dll
- Qt5Svgd.dll
- Qt5Test.dll
- Qt5Testd.dll
- Qt5V8.dll
- Qt5V8d.dll
- Qt5WebKit.dll
- Qt5WebKitd.dll
- Qt5WebKitWidgets.dll
- Qt5WebKitWidgetsd.dll
- Qt5Widgets.dll
- Qt5Widgetsd.dll
- Qt5Xml.dll
- Qt5Xmld.dll
- Qt5XmlPatterns.dll
- Qt5XmlPatternsd.dll
- Rename_Files.exe
- renamer.o

And this is resource_file.qrc:

<RCC>
<qresource prefix="/">
<file>qml/Rename_Files/Button.qml</file>
<file>qml/Rename_Files/main.qml</file>
<file>images/file_browser_icon_32x32.png</file>
<file>images/file_renamer_icon_32x32.png</file>
</qresource>
</RCC>

Yet, when I'm running Rename_Files.exe I get a window like square with an edge of 100, white background and truncated title.
Also, why is Dependency Walker complaining about MPR.dll? I tried to cheat: download it from google and put in the C:\Program Files\Rename Files\, but did not have ant effect.

ChrisW67
18th September 2013, 21:15
What Qt libraries have you deployed with the exe?

Are you using the ANGLE build of Qt5 or an OpenGL build? The ANGLE build has issues on XP.
http://qt-project.org/wiki/Qt-5-on-Windows-ANGLE-and-OpenGL
I think that imposes some limits on QtQuick2.

athan_david
19th September 2013, 21:40
I'm using an Open GL build, but I did not any Open GL stuff directly.
Are you suggesting to use Qt Quick 1 for Windows Xp deployment?

ChrisW67
19th September 2013, 23:08
I am not a Qt QML or Quick user, so I have no direct experience. Perhaps someone who does is better qualified to answer.

Looking back at your file list:

You do not need to deploy the debug Qt libraries, e.g. QtCore5d.dll, for the typical release build. This also applies to the imageformats/ and platforms/ folders.
You only need to deploy the Qt DLL files (core or plugin) your program actually uses. Most of the imageformats and platforms DLLs are unnecessary.
Do not deploy the intermediate *.o files
You should not need the images/ or qml/ folders because these should be built into your executable by the Qt Resources system.


The image file names in your resource file do not match those in your directory structure. I cannot tell if that is significant.

How do you reference the QML file in your program? What path do you use to load it?

athan_david
23rd September 2013, 20:14
Sorry for late reply,
To reference main QML I'm using:


viewer.setSource(QUrl("qrc:/qml//Rename_Files/main.qml"));

and to reference images from qml:


"qrc:/images/file_browser_icon_32x32.png"
"qrc:/images/file_renamer_icon_32x32.png"


About unnecessary files: I knew some of them where unnecessary, but I didn't know which ones since I'm it's my first deploy, so I addeed them all. Sadly, didn't help at all.

ChrisW67
23rd September 2013, 23:24
Is the double "//" deliberate?

athan_david
24th September 2013, 20:57
This is a bit embarrassing, yes should have been only one "/".
It's just a typo. When I tried first the Qt Resource System I didn't know how to refer to files, and you'll my tries from main.cpp:


#include <QtGui/QGuiApplication>
#include <QQuickItem>
#include <QResource>
#include "qtquick2applicationviewer.h"
#include "renamer.h"

int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);

QResource::registerResource("resource_file.qrc");
QtQuick2ApplicationViewer viewer;
viewer.setSource(QUrl("qrc:/qml/Rename_Files/main.qml"));// .setMainQmlFile(QStringLiteral("qrc:///Rename_Files/main.qml"));//setSource(QUrl("qrc://qml/Rename_Files/main.qml"));// .setMainQmlFile(QStringLiteral(":/Rename_Files/main.qml"));
viewer.showExpanded();

Renamer renamer;
QObject *root = viewer.rootObject();
QObject::connect(root, SIGNAL(rename_signal(QString)), &renamer, SLOT(rename_filesSLOT(QString)));

return app.exec();
}



I did build the project as it is now. On Windows 8 works just fine:
9626
9627
Then tried my luck on Windows XP, here's the result:
9628
9629
9630
Also I tried with Dependency Walker, it shows the same as the image in the post above.
I did copy all required files, I did use Qt Resource System.
What am I doing wrong?

athan_david
25th September 2013, 20:45
I don't know how or what I did, but I don't have that plugin error anymore.
Anyway, I did again a release. I've put these files:
9634
and when I run it, the "magic" white rectangle appears.
I tried again to run it from cmd, as you suggested, Chris, and here is the result:
9635
and again Dependency Walker:
9636

That MPR.dll seems to be inside Qt5Core.dll. What's wrong with Qt5Core.dll? Is there a problem with the file on Windows XP?

ChrisW67
25th September 2013, 21:27
Mpr.dll is part of Windows and a Dependency Walker warning is typical on XP and can be ignored.
http://www.dependencywalker.com/faq.html

Remove the registerResource() call from your main(). The qrc file and the files it references are built into the exe when the qrc is listed in the RESOURCES qmake variable in your pro file.

Try a do-nothing QML example like the one on this page
http://qt-project.org/doc/qt-5.0/qtquick/qtquick-deployment.html

athan_david
30th September 2013, 20:16
Chris, as you did suggest, I created a project with this main.qml :


import QtQuick 2.0

Rectangle {
width: 100
height: 100
color: "red"
}

and this is the main.cpp:


#include <QtGui/QGuiApplication>
#include "qtquick2applicationviewer.h"

int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);

QtQuick2ApplicationViewer viewer;
viewer.setSource(QUrl("qrc:/qml/DeploymentProjectTest/main.qml"));
viewer.showExpanded();

return app.exec();
}

And these are the results:
Windows 8 Pro:
9655
Windows XP:
9654

athan_david
7th October 2013, 20:54
I did continue with research and install Windows 7 and XP on virtual machines.
As I found Qt Quick 2.0 is using Open GL to draw elements (but on deployment machine, Open GL 2.0 at least is required) and Qt Quick 1.0 is using QPainter (correct me if I am wrong).
I did create project as Qt Quick 2.0 project and also did check if deployment machine does have support for Open GL 2.0 at least video card driver is up to date. Everything is good.
Just in case I did create the project as Qt Quick 1.0 on Windows XP inside virtual machine and tried again. Big surprise same issue.

Somehow on Windows 8 I did manage to recreate de bug using Qt. When I ran the app, I was complaining about QtQuick module, folder list module module and that QtObject cannot connect signals with slots because rootObject is null.
Through a bit research I found that QML_IMPORT_PATH enviroment variable might be the issue. I did try to set it but no effect at all.

If you know what's wrong please give me a hint.
Or if you know a tutorial or topic about how to deploy an app please share it.

Thanks for your effort!

athan_david
20th October 2013, 13:52
Hi again guys,

Today in a few hours I finally solved this problem and I thought about sharing what information I got meanwhile.
I was always getting a blank white window because the app was searching for some files but couldn't find them.
It was strange that on development machine everything was working. So I came with idea to add an "_" to the Qt's folder name (like "C:\Qt_"), then rerun app. Voila! blank white window. Revert renaming and start "digging" for a specific folder by adding the "_". I found that app was looking for these 2 folders:
C:\Qt\Qt5.1.1\5.1.1\mingw48_32\qml\QtQuick.2 -- http://qt-project.org/doc/qt-5.1/qtdoc/deployment-windows.html didn't mention about this
C:\Qt\Qt5.1.1\5.1.1\mingw48_32\qml\Qt -- why this folder? because I am using folderlistmodel.

Now my app with these files works charm:

Rename Files
+ platforms
- qwindows.dll
+ Qt
+ labs
+ folderlistmodel
- plugins.qmltypes
- qmldir
- qmlfolderlistmodelplugin.dll
+ QtQuick.2
- plugins.qmltypes
- qmldir
- qtquick2plugin.dll
- icon_rc_res.o
- icudt52.dll
- icuin51.dll
- icuuc51.dll
- libgcc_s_dw2-1.dll
- libstdc++-6.dll
- libwinpthread-1.dll
- main.o
- moc_qtquick2applicationviewer.o
- moc_renamer.o
- qrc_resource_file.o
- Qt5Core.dll
- Qt5Gui.dll
- Qt5Network.dll
- Qt5Qml.dll
- Qt5Quick.dll
- Qt5Script.dll
- Qt5V8.dll
- qtquick2applicationviewer.o
- Rename Files.exe
- rename.o

On deployment "dig" method works!

Chris, Thanks a lot for your help!

JaegerBomb
30th December 2013, 12:37
I have been working a similar issue myself, and I'm not sure if it's QtQuick 2.0 related or not. Right now I can run stand alone on my development machine... however, I am using VirtualBox to run another Windows 7 32 Bit machine, and when I run the application there, it crashes. This is one step more than if the plugin dlls aren't loaded... at that point I simply get a white box (as does everyone else who doesn't have the plugins loaded and in the right spot).

I'm curious if anyone else has had this behavior? It's completely repeatable with a mingw or visual studio build. I haven't tested 64 bit as of yet, but I'm going to.

I'm using the openGL-desktop build, so I'm assuming (hopefully) that ANGLE isn't the problem. Or maybe openGL is the problem? Has anyone else been able to successfully run this scenario?

1) Qt 5.2.0 - OpenGL - MingW4.8.6 or visual studio 2010
2) Windows 7 32 bit virtual box machine
3) QtQuick 2.0

Crashes every time - with no warnings or output.

Thanks,
JaegerBomb