Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
I can't compile QT 5.11 Static using the same steps for QT 5.10
I download the latest version of QT which is 5.11 and i want to create a static version from it so i follow the same steps i made before on QT 5.10 which is:
1 - i go to C:\QT\5.11\Src\qtbase\mkspecs\win32-g++\ , open "qmake.conf" file, and add this lines before this line "load(qt_config)"
QMAKE_LFLAGS += -static -static-libgcc QMAKE_CFLAGS_RELEASE -= -O2 QMAKE_CFLAGS_RELEASE += -Os -momit-leaf-frame-pointer DEFINES += QT_STATIC_BUILD load(qt_config)
2 - i go to search for QT Mingw32 command prompt in windows search and go to qt source
3 - i use this config parameter
configure -static -platform win32-g++ -prefix "C:\Qt\Qt11_static" -release -opensource -confirm-license -nomake examples -nomake tests -nomake tools -opengl desktop -no-angle -make libs -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -openssl-linked -sql-odbc -sql-sqlite -openssl
and i got this problem
+ cd qtbase + C:\Qt\Qt5.11.0\5.11.0\Src\qtbase\configure.bat -top-level -static -platform win32-g++ -prefix "C:\Qt\Qt11_static" -release -opensource -confirm-license -nomake examples -nomake tests -nomake tools -opengl desktop -no-angle -make libs -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -openssl-linked -sql-odbc -sql-sqlite -openssl Bootstrapping qmake ... g++ -o "../bin/qmake.exe" main.o meta.o option.o project.o property.o ioutils.o proitems.o qmakebuiltins.o qmakeevaluator.o qmakeglobals.o qmakeparser.o qmakevfs.o pbuilder_pbx.o makefile.o makefiledeps.o metamakefile.o projectgenerator.o unixmake2.o unixmake.o mingw_make.o msbuild_objectmodel.o msvc_nmake.o msvc_objectmodel.o msvc_vcproj.o msvc_vcxproj.o winmakefile.o xmloutput.o qtextcodec.o qutfcodec.o qglobal.o qlogging.o qmalloc.o qnumeric.o qoperatingsystemversion.o qrandom.o qabstractfileengine.o qbuffer.o qdatastream.o qdebug.o qdir.o qdiriterator.o qfile.o qfiledevice.o qfileinfo.o qfilesystemengine.o qfilesystementry.o qfsfileengine.o qfsfileengine_iterator.o qiodevice.o qsettings.o qtemporaryfile.o qtextstream.o qjsonarray.o qjson.o qjsondocument.o qjsonobject.o qjsonparser.o qjsonvalue.o qmetatype.o qsystemerror.o qvariant.o quuid.o qarraydata.o qbitarray.o qbytearray.o qbytearraymatcher.o qcryptographichash.o qdatetime.o qhash.o qlinkedlist.o qlist.o qlocale.o qlocale_tools.o qmap.o qregexp.o qringbuffer.o qstringbuilder.o qstring_compat.o qstring.o qstringlist.o qversionnumber.o qvsnprintf.o qxmlstream.o qxmlutils.o qfilesystemengine_win.o qfilesystemiterator_win.o qfsfileengine_win.o qlocale_win.o qsettings_win.o qoperatingsystemversion_win.o qsystemlibrary.o registry.o qlibraryinfo.o -static -s -lole32 -luuid -ladvapi32 -lkernel32 -lnetapi32 -Wl,--gc-sections main.o: file not recognized: File format not recognized collect2.exe: error: ld returned 1 exit status Makefile:213: recipe for target '../bin/qmake.exe' failed mingw32-make: *** [../bin/qmake.exe] Error 1
i also notice strange thing that the qmake.conf i use it in the first step it's a little bit shorter than the QT 5.10 version i don't know if this will help, so now what i should do to pass this error? is it need different steps in QT 5.11 than QT 5.10?
after those steps i run the last 2 steps to make the qt static which is
mingw32-make -k -j4 then mingw32-make -k install
last thing i add CONFIG += static in the qmake.conf
also iam a worried if i go with the last 2 steps because it take a long time and if this an error iam worrie to not work.
Thanks in advance.
From where did you download which file to recompile?
There is already 5.11.1 out which could be an option to persue your trials.
I download an offline installer for the QT 5.11.0 a website i don't remember exactly but not from QT website as they did not provide an offline installer at this time.
something like here here
anyway, I found QT 5.11.1 offline installer on the qt official website maybe i will download and try now
AFAIK it is still not recommended to use the source distributed with installers shall used for recompilation of Qt libs.
Therefore I would recommend downloading the source freshly from the archives for recompilation. That might help.
Beware also that there differences between those archives. zip is for windows compilations and tar.xz is for linux
@Keidy Thank you for this link I will do that and download the source from the link you sent, my question now is on the steps I will follow is the same as I used before? or I need to do different steps?
most of the steps on the website does not mention editing the file which is in
so if you have a link that explains how to do the recompilation for windows in an easy way please share it also I want to try to build the qt statically with as many modules as I can without the need to link with externals such as OpenSSL and MySQL and all this, i want to know what parameter to give to the configure so i can build all the qt features in my static build.
and thank you very much for helping me.
Beware that static compilation has some license issues when you like to distribute your work.
Franckynos last edited by
I have exactly the same problem.
I have tried to compile 5.11.0 and 5.10.
I look a video here to try to modify QMAKE_LFLAGS = -static
but the file qmake.conf doesn't look like older verison 6.5**
Someone resolved the issue?