Build exe-file of Qt4-Project
-
Hi,
how can I deploy a Qt4-Project under Windows so I get a stand-alone exe-file? I tried already to build my Qt-installation static, as I read in different documentations on the internet. But this doesn't work and is very complicated. So does anybody know a way how I can get an exe-file of my project under Windows?
-
As you already found out you need Qt static libraries in order to obtain a single exe file. However, you need to be aware of the license issues involved especially the restrictions for distribution of your application.
There is no way around creating the static libraries yourself. I understand that some users consider it a bit annoying to have to wait depending on the CPU power available, but the configure process I can describe only as straightforward. I have done a couple of compilations of Qt 5 with MinGW 64 bit just before Christmas.
Also compilation of Qt 4 is basically the same as far as I remember.
-
Hi,
I followed these instructions:
http://doc.qt.io/archives/qt-4.8/deployment-windows.html
to build Qt statically. But at the step where nmake is invoked my system can't find the command nmake.
-
@magguz said in Build exe-file of Qt4-Project:
at the step where nmake is invoked my system can't find the command nmake.
How do you compile programs from the command line?
The document says, "...we have used nmake in all the examples, but if you use MinGW you must use mingw32-make instead."
-
You have to set the path environment variable to include the folder where your compiler is.
set PATH=C:\Users\blablabla\AppData\Local\Programs\Python\Python36-32\;c:\MinGW64\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin;%path%
I needed to add the path of MinGW and created a bat-file for this. When you start the bat in a command prompt it will be only available until you close the prompt. Checkout where your visual studio with nmake is installed. IIRC it should be also a bin folder. You need to replace the MinGW part. Above I have added also an entry to python.
-
@koahnig said in Build exe-file of Qt4-Project:
You have to set the path environment variable to include the folder where your compiler is.
set PATH=C:\Users\blablabla\AppData\Local\Programs\Python\Python36-32\;c:\MinGW64\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin;%path%
I needed to add the path of MinGW and created a bat-file for this. When you start the bat in a command prompt it will be only available until you close the prompt. Checkout where your visual studio with nmake is installed. IIRC it should be also a bin folder. You need to replace the MinGW part. Above I have added also an entry to python.
I added the path of MinGW to the path environment. Now it seems to work. But when I type this:
configure -static -release -no-exceptions
I get an error: Qmake failed
-
My compilations of Qt 4 are years back. Therefore my memory has significantly faded away and I do not remember what different other tools I had installed. The only I remember is that the configure stuff had be done and then the make.
For my fresh Qt 5 installation before Christmas I had to install versions of "perl" and "phyton" (both accessible through the path environment variable). Certainly I had to install the desired compiler which was MinGW 64 bit in my case. The path to python and MinGW are set through the statement already given in my last post.
I had picked the desired version of Qt from the archives. For windows you have to pick a .zip version tar-stuff can be used for linux only. Unzipped it to a folder and started from a command prompt in that folder.
Here is the configure command, which worked perfectly for me. However, I was compiling Qt 5.9.3 as you see.
configure -prefix c:\Qt64\Qt5.9.3 -confirm-license -debug-and-release -opensource -platform win32-g++ -opengl desktop -nomake examples -nomake tests
Those parameters are for Qt 5. You need to check the parameters with "configure --help" for your actual version. Within those 9 major release things might have checked. The configure parameters were also explained on web page Qt 4, but I cannot find it right away.
-
Hi,
qmake failed
doesn't say much, please provide the build log or at least the error messages that comes before this one. -
Hi,
I tried now nmake of my Visual Studio 2017 installation. Therefore I run this command in the VS command prompt:
configure -static -release -no-exceptions
This works. It shows at the end: "Qt is now configured for building. Just run nmake."
But when I runnmake sub-src
after 20 minutes of compiling it shows an error:
NMAKE : fatal error U1077: ""C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\bin\HostX86\x86\cl.EXE"": Rückgabe-Code "0x2"
Stop.
NMAKE : fatal error U1077: ""C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\bin\HostX86\x86\nmake.exe"": Rückgabe-Code "0x2"
Stop.
NMAKE : fatal error U1077: "cd": Rückgabe-Code "0x2"
Stop. -
These are the finales lines that just state the compilation failed. Above these are those that are containing what is currently failing to build.
-
@SGaist said in Build exe-file of Qt4-Project:
These are the finales lines that just state the compilation failed. Above these are those that are containing what is currently failing to build.
There is something like this:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include\cstdint(46): error C2039: "uintmax_t": Ist kein Element von "`global namespace'"
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include\cstdint(46): error C2873: "uintmax_t": Das Symbol kann nicht in einer using-Deklaration verwendet werden -
Ok... I didn't realised that you where using VS2017. The latest version of Visual Studio used to build Qt 4.8 was 2015. You will have to copy the 2015 mkspec and tweak it in order to build it.
MinGW might be a quicker choice depending on your needs.
-
@SGaist said in Build exe-file of Qt4-Project:
Ok... I didn't realised that you where using VS2017. The latest version of Visual Studio used to build Qt 4.8 was 2015. You will have to copy the 2015 mkspec and tweak it in order to build it.
MinGW might be a quicker choice depending on your needs.
I will try to build it with Visual Studio 2015 tomorrow. Thanks for your hint.
-
During which part of the build ?
-
So configure is successful ?
-
By the way, which version of 4.8 is it ?