[SOLVED] Qt 5.1.1. Win7. How to build an application statically
-
I typed this:
configure -static -opengl desktop -nomake examples -nomake tests
Output:
bq. process_begin: CreateProcess(NULL, rm -f project.o option.o property.o main.o io
utils.o proitems.o qmakeglobals.o qmakeparser.o qmakeevaluator.o qmakebuiltins.o
makefile.o unixmake2.o unixmake.o mingw_make.o winmakefile.o projectgenerator.o
meta.o makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o msvc_vcproj.o m
svc_vcxproj.o msvc_nmake.o msvc_objectmodel.o msbuild_objectmodel.o gbuild.o ces
dkhandler.o qtextcodec.o qutfcodec.o qstring.o qstringbuilder.o qtextstream.o qi
odevice.o qmalloc.o qglobal.o qarraydata.o qbytearray.o qbytearraymatcher.o qdat
astream.o qbuffer.o qlist.o qfiledevice.o qfile.o qfilesystementry.o qfilesystem
engine.o qfsfileengine.o qfsfileengine_iterator.o qregexp.o qvector.o qbitarray.
o qdir.o qdiriterator.o quuid.o qhash.o qfileinfo.o qdatetime.o qstringlist.o qa
bstractfileengine.o qtemporaryfile.o qmap.o qmetatype.o qsettings.o qsystemerror
.o qlibraryinfo.o qvariant.o qvsnprintf.o qlocale.o qlocale_tools.o qlinkedlist.
o qnumeric.o qcryptographichash.o qxmlstream.o qxmlutils.o qlogging.o qfilesyste
mengine_win.o qfilesystemiterator_win.o qfsfileengine_win.o qlocale_win.o qsetti
ngs_win.o qsystemlibrary.o registry.o, ...) failed.
make (e=2): The system cannot find the file specified.
Makefile:155: recipe for target 'clean' failed
mingw32-make: *** [clean] Error 2
Cleaning qmake failed, return code 2
C:\Qt\Qt5.1.1_static\5.1.1\Src\qtbase> -
Now I am building of Qt on my old computer with XP. It was configured successfully.
-
It was building on my old computer with XP successfully! It took 1 or 1.5 hour.
Please say me. Should I run this command: mingw32-make install
-
I compiled a simple project. But it was not build statically.
-
I ran this: mingw32-make install
It is installing now. But I see:
bq. can not be copied on top of itself
-
bq. xcopy /s /q /y /i C:\Qt\Qt5.1.1\5.1.1\Src\qtbase\doc\global C:\Qt\Qt5.1.1\5.1.1
Src\qtbase\doc\global -
I created the new folder with name C:/Qt5.1.1_static
And copied to it the content of the folder C:\Qt\Qt5.1.1_static\5.1.1\Src\qtbase
I ran this: cd C:/Qt5.1.1_static
And this: configure -static -opengl desktop -nomake examples -nomake tests
And I ran this: mingw32-make
And this: mingw32-make install
I open QtCreator -> and selected qmake.exe from C:/Qt5.1.1_static
I created a simple Dialog Project (Release)
But my Application-exe require the libgcc_s_dw2-1.dll
Why? I want to ran my Application on another computer. Please help me! What should I do?
-
This is right for installing:
configure -static -prefix "C:/Qt/Qt5.1.1_static" -opengl desktop -nomake examples -nomake tests
But my Application-exe require the libgcc_s_dw2-1.dll How to build all dll's to one exe-file?
-
Need I to change mkspecs file?
-
"Here":http://bit.ly/1bMwrbH
-
Thank you for reply. I am helped here: http://www.prog.org.ru/topic_26164_0.html
My "Step by Step" instruction how to build applications without libstdc++-6.dll, libgcc_s_dw2-1.dll, Qt5Core.dll, Qt5Gui.dll and so on.
Tools:
Version of Qt: Qt 5.2.0 for Windows 32-bit (MinGW 4.8, OpenGL, 689 MB)
OS: Window 7
-
download and install Qt 5.2.0 for Windows 32-bit (MinGW 4.8, OpenGL, 689 MB) (check Source Components) from here http://qt-project.org/downloads
-
move to C:\Qt\Qt5.2.0\5.2.0\Src\qtbase\mkspecs\win32-g++ and open qmake.conf
-
find QMAKE_LFLAGS in qmake.conf and rewrite it:
QMAKE_LFLAGS = -static -static-libgcc
- open console Start -> All Programs -> Qt 5.2.0 -> 5.2.0 -> MinGW 4.8 (32-bit) -> Qt 5.2.0 for Desktop (MinGW 4.8 32 bit)
cd c:\Qt\Qt5.2.0\5.2.0\Src\qtbase
configure -static -prefix "C:\Qt\Qt5.2.0_static" -opengl desktop -nomake examples -nomake tests
mingw32-make
mingw32-make install
-
run QtCreator
-
in menu Tools -> Options...
-
Build & Run -> Qt Versions -> click "Add..." button -> select "C:\Qt\Qt5.2.0_static\bin\qmake.exe" -> click "Apply" button
-
go to "Kits" tab -> click "Add" button
-
write in the field "Name": Desktop Qt 5.2.0 Static MinGW 32 bit
-
select in "Qt version": static Qt virsion
-
click Ok
-
create a test project, for this:
-
in menu "File" -> "New File or Project" -> "Applications" -> "Qt Widgets Application" -> click "Choose" button
-
enter the "Name": Hello_Static_Qt -> enter the "Create in": D:\QtProjects -> click "Next" -> select "Desktop Qt 5.2.0 Static MinGW 32 bit" -> click "Next" -> click "Next" -> click "Finish"
-
click "Projects" in the right panel
-
click "Desktop Qt 5.2.0 Static MinGW 32 bit" on the top
-
select "Edit build configuration": Release
-
in the "Build Steps" in "qmake" expend "Details"
-
select "qmake build configuration": Release
-
enter "Additional arguments": "CONFIG += release" (in double quotes)
-
in "Menu" -> click "Build" -> "Build Project 'Hello_static_Qt'"
-
go to "D:\QtProjects\build-Hello_Static_Qt-Desktop_Qt_5_2_0_Static_MinGW_32bit-Release\release"
-
run your static application: Hello_Static_Qt.exe
-