PDA

View Full Version : Devastating Deployment Issues



xtlc
22nd October 2013, 13:22
I really am totally clueless after reading http://qt-project.org/doc/qt-5.0/qtdoc/deployment-windows.html and many similar articles and googeling the last 4 hours. I cant deploy my app. I wrote it in QT5.1.0 and I am completely confused... please help me.

- I am using Qt5.1.0
- MS Visual Studio 2012
- QExtSerialPort
- QCustomPlot

I tried the static and the shared library approach, but failed on both - usually in the first line of the tutorial. For example where it says:

Now run qmake to create a new makefile for the application, and do a clean build to create the dynamically linked executable:

nmake clean
qmake -config release
nmake
So I do: WIN+R, Enter -> CMD -> Enter
If I type "nmake clean" I get:Microsoft Windows [Version 6.2.9200]
(c) 2012 Microsoft Corporation. Alle Rechte vorbehalten.

c:\Users\rt\Desktop\GUI>nmake clean
Der Befehl "nmake" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
Which means Command nmake cannot be found in english.

My program is called GUI and I can execute it just fine from inside the QT Creator. When I press STRG + R I see an folder being created in my programs directory, which is called build-GUI-Desktop_Qt_5_1_0_MSVC2012_64bit-Release - but I cant open the GUI.exe which is located there. It is only 383Kb big too. Which is awkwardly small I think, bc some of the to be included files are already bigger. I just want one big executable with all I need inside. I will update this thread if I try / find out more.

anda_skoa
22nd October 2013, 16:55
You will have to open a command shell that has the necessary paths set to include the path that contains nmake.

There is usually a link for that in the start menu folder of visual studio.

Cheers,
_

xtlc
22nd October 2013, 20:27
you mean the Visual Studio Developers CMD or however its named? I did try that. I got an error when I did "nmake clean" there.

wysota
22nd October 2013, 21:47
Google for "visual studio command prompt"

ChrisW67
22nd October 2013, 23:12
The "first line of the tutorial" is part of the instructions for building your Qt project from a command line. If you have already built your project from an IDE then start here.

Perhaps you can tell us what you files and directories you deployed for your dynamically linked Qt application and what "Devastating Deployment Issue" you experienced etc.

xtlc
23rd October 2013, 08:13
When I use the VS CMD I get:


c:\Users\rt\Desktop\GUI>nmake GUI.pro

Microsoft (R) Program Maintenance Utility, Version 11.00.50727.1
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.

GUI.pro(7) : fatal error U1036: Syntaxfehler: Zu viele Namen links von "="
Stop.

c:\Users\rt\Desktop\GUIWhich says sth like "Syntax error: Too many names left from "=" stop.".

9712
Here is also my GUI.pro file:

#-------------------------------------------------
#
# Project created by QtCreator 2013-07-25T11:53:23
#
#-------------------------------------------------

QT += core gui\ #<--- this would be line 7, is it where nmake throws an error?


greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport

TARGET = GUI
TEMPLATE = app

include(qextserialport-1.2rc/src/qextserialport.pri)

SOURCES += main.cpp\
mainwindow.cpp \
protokoll.cpp \
multireturn.cpp \
qcustomplot.cpp

HEADERS += mainwindow.h \
protokoll.h \
multireturn.h \
qcustomplot.h

FORMS += mainwindow.ui

DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0

#CONFIG += static

9713

The german words next to "error opening file" can be translated as "System can't find specified file".

ChrisW67
23rd October 2013, 09:29
When I use the VS CMD I get:

Which says sth like "Syntax error: Too many names left from "=" stop.".

I don't know why you did that. It certainly doesn't say to do that in the instructions. A PRO file is an input to qmake, qmake produces a Makefile which is the input to nmake.

In any case, as I said above, if your project builds in your IDE then you do not need to build it again from the command line.

Your Dependency Walker screen shot indicates that you made no progress following the Creating the Application Package. There are some difference with Qt5, so you should read the Qt5 version of the same document. You need to start by copying the missing Qt5 DLLs into a deployment folder along with your compiled program.

xtlc
23rd October 2013, 10:15
I will proceed with the *.dll thing :) But the other question I mentioned above: My GUI.exe I can find in the release folder is so tiny... 383kb. I think that is to small?

xtlc
23rd October 2013, 14:08
9718I managed to remove all the warnings. So what would be the next step? I read in ChrisW67's link I have to insert the msvcp90.dll
(because I use VS) too. Is that correct? Or is this just for a VS 2008 version? I use VS 2012.

If I know double click my GUI.exe I get:9719Translated word by word this says "The application could not be started correctly (0xc000007b). Click Ok, to close ...".

EDIT: I copied the *.dll's in the folder "release" which is created, when I press STRG+R in QT.
This is what the folder looks like right now:9720. I just wanna have one big exe that I can move from PC to PC.

ChrisW67
23rd October 2013, 23:42
9718I managed to remove all the warnings. So what would be the next step? I read in ChrisW67's link I have to insert the msvcp90.dll
(because I use VS) too. Is that correct? Or is this just for a VS 2008 version? I use VS 2012.
You will need the Visual C++ 11 version of that file. I guess it is called msvcp110.dll but someone with the Microsoft tools would have to verify that.


If I know double click my GUI.exe I get: ... Translated word by word this says "The application could not be started correctly (0xc000007b). Click Ok, to close ...".
Have you created the "platforms" folder and copied "qwindows.dll" into it?
Have you copied the DLLs for the third-party libraries in to the folder or have you built their sources directly into your executable?


I just wanna have one big exe that I can move from PC to PC.
To get your "one big executable", that I assume you want to work without an installation step requires:

building Qt itself (and its dependencies) from source for static linking,
building your third-party libraries from source for static linking,
building your application to statically link against the libraries above after modifying it to account for any plugins it needs, and
complying with any license requirements when distributing the executable.


It is easier to create a folder with a dynamically linked executable that you either wrap into an installer (using NSIS, Innosetup or similar) or distribute as a zip file. In short, walk before you try to run.

xtlc
24th October 2013, 12:32
I am not quite curtain of what you mean with "platforms" folder? Have you seen the 9720 screenshot?

wysota
24th October 2013, 13:50
I am not quite curtain of what you mean with "platforms" folder? Have you seen the 9720 screenshot?

Qt5 requires a QPA plugin that resides in a subdirectory called "platforms".

ChrisW67
25th October 2013, 01:41
Your deployment folder for a release Qt5 widgets application using the distributed Qt bundle should contain (minimum):


Folder/
your.exe

mylibrary.dll // any DLLs you have built as part your project (maybe none)

qextserialport.dll // Any DLLs from third parties that your application depends on (I guessed names)
qcustomplot.dll
...

plugins/ // any plugins you have written and built for your project (maybe none)
myplugin.dll
myotherplugin.dll

Qt5Core.dll // Qt 5 libraries your program needs
Qt5Gui.dll
Qt5Core.dll
...

icudtXX.dll // Things the Qt5 libraries depend on
icuinXX.dll
icuucXX.dll
libEGL.dll
libGLESv2.dll
d3dcompiler_XX.dll

msvcr110.dll // Dependencies your compiler imposes, in this case MS VC 11
msvcp110.dll

platforms/ // Qt plugins required at run time to support platform
qwindows.dll

imageformats/ // Other Qt plugins your program may require
qjpeg.dll
...
iconengines/
qsvgicon.dll
...

The distributed packages are ICU and ANGLE-based.

xtlc
30th October 2013, 08:33
I succeded a little bit - after gathering all these files with the help of Dependency Walker and putting them all in my directory:


30.10.2013 09:24 <DIR> .
30.10.2013 09:24 <DIR> ..
16.06.2013 04:17 3.072 API-MS-Win-Core-Kernel32-Private-L1-1-1.dll
16.06.2013 04:17 3.072 api-ms-win-core-privateprofile-l1-1-1.dll
16.06.2013 04:17 3.584 api-ms-win-service-private-l1-1-1.dll
28.10.2013 14:21 391.680 GUI.exe
23.04.2013 10:45 22.317.056 icudt51.dll
23.04.2013 10:45 2.236.928 icuin51.dll
23.04.2013 10:45 1.690.112 icuuc51.dll
30.09.2013 02:46 346.624 IEShims.dll
02.07.2013 18:59 48.128 libEGL.dll
02.07.2013 09:00 329.216 libEGLd.dll
02.07.2013 09:00 860.160 libGLESv2.dll
02.07.2013 09:00 3.763.712 libGLESv2d.dll
26.07.2012 14:22 661.448 msvcp110.dll
26.07.2012 14:22 828.872 msvcr110.dll
28.10.2013 15:34 <DIR> platforms
24.07.2013 15:28 4.598.784 Qt5Core.dll
24.07.2013 15:28 10.124.800 Qt5Cored.dll
02.07.2013 09:05 3.678.720 Qt5Gui.dll
02.07.2013 09:06 7.675.904 Qt5Guid.dll
02.07.2013 09:11 528.896 Qt5PrintSupportd.dll
02.07.2013 18:59 4.269.568 Qt5Widgets.dll
02.07.2013 09:10 10.223.616 Qt5Widgetsd.dll
02.07.2013 09:12 1.043.456 qwindows.dll
02.07.2013 09:12 2.217.472 qwindowsd.dll
23 Datei(en), 77.844.880 Bytes
3 Verzeichnis(se), 38.681.681.920 Bytes frei
The only thing Dependency Walker shows right now (and I cant find these two dlls on my pc?):
9738
But when I double click my exe, just nothing happens. If I try to open it via comand prompt, it just does nothing too. No error, no reaction. Nothing. How shall I proceed now :)

ChrisW67
30th October 2013, 20:18
You are missing d3dcompiler_xx.dl.
Put qwindows.dll in the platforms folder where it came from.

Remove the debug libraries, e.g. Qt5Widgetsd.dll.
Remove IEShims.dll, it is a non redistributable part of Windows (if it exists at all on a machine) and typically is not required despite what Dependency Walker would indicate.
I do not know what the api-ms-* files are but I suspect they are not required. Try removing them after you get the program starting.

xtlc
4th November 2013, 09:10
Still the same: No error, no nothing :(

Dependency Walker now shows this (i deleted the IEShims.dll, put the qwindows.dll in the platforms folder (its empty except that one file, correct?) and removed the *d.dll files and/or replaced them with the *.dll's).

9749
The red C++ lines on the right side there make me nervous...
And this is how the folder looks like right now:
9750

EDIT: Ah and I used the d3dcompiler_47.dll - is that kinda correct?

xtlc
6th November 2013, 07:52
anyone got any idea?

ChrisW67
6th November 2013, 21:19
You said you were building your project with VS2012(VC11) yet the Qt5Widgets DLL you are deploying appears to be linked against the runtime for VS2010(VC10, msvcr100.dll). Are you sure you do not have mixed versions and that you are getting the correct Qt5 library binaries?

xtlc
7th November 2013, 13:49
no i am not. i am not sure about anything regarding deployment :(

How can I check this / undo my mistake?

ChrisW67
7th November 2013, 20:01
It is difficult because I cannot see your machine and do not have a VS2010 or 2012 install.

Exactly which version of Qt have you downloaded and installed?
What directories do you have in your Qt install directory?
Is there more than one Qt5Widgets.dll on your machine (other than the one in your deployment folder)? Which paths?

xtlc
11th November 2013, 10:10
Ok I will try to bring all the intel together :)

I have installed QT 5.1.0 in c:\5.1.0

Here is a screnie of the Visual Studio components:
9779
The Screenie of the QT5 dir:
9780
The QT5Widgets.dll's:
9781

Thx for your help!

xtlc
13th November 2013, 14:50
Anyone else some ideas please?

xtlc
17th November 2013, 19:15
pretty please?!

xtlc
20th November 2013, 08:56
Dependency Walker now shows these three Files missing:

API-MS-WIN-CORE-SHUTDOWN-L1-1-1.DLL
EXT-MS-WIN-NTUSER-UICONTEXT-EXT-L1-1-0.DLL
IESHIMS.DLL

Shall I put them in the deployment dir or not?

I still have no idea what to do with these red marked lines:
9801

ChrisW67
20th November 2013, 12:27
I will try to put together a blow-by-blow in the morning when I get a suitable Windows machine built up.

ChrisW67
20th November 2013, 20:59
OK. I will go through an entire build step by step. I have use the command prompt so I can be precise about what is copied, from where, and it is copy-n-paste ready.

I have the following:

A fresh Windows 7 machine
A fresh Windows SDK 7.1 install. This has the same compilers as VS2010, so you will have to substitute 2012 everywhere you see 2010.
A fresh install of Qt 5.1.1 using the online installer. This is a 32-bit ANGLE build in the default, C:\Qt, folder.

I created a test folder and placed two test files in it.
test.pro:


TEMPLATE = app
TARGET = test
INCLUDEPATH += .
QT += widgets
# Input
SOURCES += main.cpp

main.cpp:


#include <QApplication>
#include <QWidget>

int main(int argc, char **argv)
{
QApplication app(argc, argv);
QWidget w;
w.show();
return app.exec();
}

From the Start menu, All Programs, Qt, 5.1.1, "MSVC 2010" launch "Qt 5.1.1 for Desktop (MSVC 2010)"
From the command prompt run:
"C:\Program Files\Microsoft SDKs\Windows\v7.1\bin\SetEnv.cmd" /x86 /release (This path may differ depending on how you got your C++ compiler. The batch file may be called vcvarsall and may live under a Visual Studio folder.)
Then build and test the program which should launch a single empty window:


qmake CONFIG+=release
nmake
release\test.exe

Check that the release\test.exe program does not run if double-clicked from Windows Explorer.
Now, back in the command prompt:


mkdir deploy
xcopy release\test.exe deploy

xcopy c:\Qt\5.1.1\msvc2010\bin\Qt5Core.dll deploy
xcopy c:\Qt\5.1.1\msvc2010\bin\Qt5Gui.dll deploy
xcopy c:\Qt\5.1.1\msvc2010\bin\Qt5Widgets.dll deploy

xcopy c:\Qt\5.1.1\msvc2010\bin\libEGL.dll deploy
xcopy c:\Qt\5.1.1\msvc2010\bin\libGLESv2.dll deploy
xcopy c:\Qt\5.1.1\msvc2010\bin\D3DCompiler_43.dll deploy

xcopy c:\Qt\5.1.1\msvc2010\bin\icudt51.dll deploy
xcopy c:\Qt\5.1.1\msvc2010\bin\icuin51.dll deploy
xcopy c:\Qt\5.1.1\msvc2010\bin\icuuc51.dll deploy

mkdir deploy\platforms
xcopy c:\Qt\5.1.1\msvc2010\platforms\qwindows.dll deploy\platforms

Check that the "deploy\test.exe" program does run if double-clicked from Windows Explorer on the developer machine.

Back in the command prompt:


xcopy c:"\Program Files\Microsoft SDKs\Windows\v7.1\Redist\VC\vcredist_x86.exe" deploy

This path may be different on your machine: just find the VC redistributable that matches your compiler in the Windows SDK or Visual Studio folders.

Copy the "deploy" folder including subdirectory to another non-dev machine.
Run the "deploy\vcredist_x86.exe" on the target machine to install the VC runtime. (This exe is not required again after this)
Check that the "deploy\test.exe" program does run if double-clicked from Windows Explorer on the non-dev machine.

xtlc
21st November 2013, 16:37
Thank you very much. I will try this tomorrow first thing in the morning, when the coffeine still does its job.

xtlc
25th November 2013, 18:25
My PC is a win8, I already have some troubles in an early stage :(

Here is my *.pro file:

#-------------------------------------------------
#
# Project created by QtCreator 2013-07-25T11:53:23
#
#-------------------------------------------------

QT += core gui\
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport

TARGET = GUI
TEMPLATE = app

include(qextserialport-1.2rc\src\qextserialport.pri)

SOURCES += main.cpp\
mainwindow.cpp \
protokoll.cpp \
multireturn.cpp \
qcustomplot.cpp

HEADERS += mainwindow.h \
protokoll.h \
multireturn.h \
qcustomplot.h

FORMS += mainwindow.ui
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
Looks similar to yours ...

But I dont have your path - instead I could offer:


"C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\"
but in this directory, there is only a "NETFX 4.0 Tools" folder and no "SetEnv.cmd" in it - or on any other part on the HDD :( What shall I do now? I found a "SetEnv.c" tough.

ChrisW67
25th November 2013, 21:29
Microsoft, in their wisdom, removed the native compiler (cl.exe, link.exe and friends) from the Windows 8 SDK. They are part of Microsoft Visual Studio though.
Building on the Command Line (http://msdn.microsoft.com/en-us/library/vstudio/f35ctcxw%28v=vs.110%29.aspx)
Setting the Path and Environment Variables for Command-Line Builds (http://msdn.microsoft.com/en-us/library/vstudio/f2ccy3wt%28v=vs.110%29.aspx)
The environment setting scripts is "vcvars32.bat" according to the docs above.

If it is all too difficult to build from the command line you can use Qt Creator or VS to build my test project in release mode and continue from the command prompt.

xtlc
25th November 2013, 23:50
I did the "Setting the Path and Environment Variables for CMD Line Builds" - altough I tried the 64Bit version: http://msdn.microsoft.com/en-us/library/vstudio/x4d2c09s(v=vs.110).apx - so I executed VCVARSALL with no argument (so my output should become a 32Bit exe, right?)

Added after 17 minutes:

If I now do the cmd thingy thing:


c:\Program Files (x86)\Microsoft Visual Studio 11.0\VC>nmake "c:\Users\verena\De
sktop\build-GUI-Desktop_Qt_5_1_0_MSVC2012_64bit-Release\Makefile"

Microsoft (R) Program Maintenance Utility, Version 11.00.50727.1
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.

""c:\Users\verena\Desktop\build-GUI-Desktop_Qt_5_1_0_MSVC2012_
64bit-Release\Makefile"" ist aktuell"aktuell" means "up to date".

So if I then do the xcopy thing in my deployment folder and double click it -> nothing happens. I dont understand why this is such a big thing to do. I want to spend my time coding, not wondering what I do to bring my program to run. Thats something I would feel a SDK should take care of. I am obviously missing sth here... what is it?

ChrisW67
26th November 2013, 07:55
Running:


"c:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall"

without arguments will set up to run a 32-bit compiler. It does not compile anything.

The shadow build directory name "c:\Users\verena\Desktop\build-GUI-Desktop_Qt_5_1_0_MSVC2012_64bit-Release\Makefile" would indicate you have built using a 64-bit compiler and Qt library. Running nmake in an already built project directory will announce that that program is up-to-date: that is what a Make Utility (http://www.wikipedia.org/wiki/Make_%28software%29) does based on file timestamps.

The two must match. A 32-bit VS2012 C++ compiler with 32-bit VS2012 Qt libraries, or 64-bit VS2012 compiler with 64-bit VS2012 Qt libraries. Mix-n-match is not going to cut it.

Start with an EMPTY directory. Put my source files in it. Run through my process. Do you get a working result?

Exactly what have you got?

xtlc
2nd December 2013, 15:54
I installed this: http://msdn.microsoft.com/en-us/windows/hardware/hh852363.aspx

I made a new dir on desktop, copied your source in the two files.

I used "Qt 5.1.0 64-bit for Desktop (MSVC 2012)" and did try to give x86_amd64 as an argument. It didnt want the "/release" argument. When I did qmake then
-> worked. nmake
-> not set up for 32Bit system

So... how can I use this in 64Bit?

ChrisW67
2nd December 2013, 22:16
The Windows SDK no longer ships with a complete command-line build environment. You must install a compiler and build environment separately. If you require a complete development environment that includes compilers and a build environment, you can download Visual Studio Express, which includes the appropriate components of the Windows SDK.

Microsoft, in their wisdom, removed the native compiler (cl.exe, link.exe and friends) from the Windows 8 SDK. They are part of Microsoft Visual Studio though.

Do you have Visual Studio 2012 installed?
Do you have Qt 5.1.1 for MS VS2012 64-bit installed?

It does not matter how you build my sample sources, just that we have a known simple example program from which to build a deployment kit. The point is to compile a 64-bit release version of my test program and get the resulting test.exe file. Clearly using a command line is proving too difficult for you.
Use Qt Creator if that is what you have been using. Use Visual Studio if that is what you are comfortable with.

The remainder of my instructions are about copying the compiled program (test.exe) to a folder along with the necessary support files. You can do this copying from a command prompt or by doing the same steps manually. You need to adjust the paths to suit your specific versions of Qt and Visual Studio.

I know the steps as presented work.