Static Build Fails on Windows 7 Professional X64 with QTSDK
Hi everyone glad to be here. :) I'm having an issue with the QTSDK. I've never had a problem with the QT Creator 2.1 and QT Libraries for MinGW, but when I run the QT 4.7.3 for Desktop(MinGW) command line tool I get a mess of errors when trying to build the static library with configure -static through the QTSources4.7.3 directory. Here's the result error(post limit prevented me from posting all of it so let me know if you need it)
@mingw32-make: *** [project.o] Error 1
Building qmake failed, return code 2@
as this is only a small part of the error message, it says nothing.
Which library, which files were already processed.
Which configure parameters did you use?
What did you do to compile Qt statically. Did you follow "this guide":http://developer.qt.nokia.com/wiki/How_to_build_a_static_Qt_version_for_Windows_with_gcc ?
Building from QtSources requires Perl to be installed download and install "ActivePerl":http://www.activestate.com/activeperl/downloads it generally hangs when building qmake when Perl is missing.
If you don't want to install Perl, then download and use the source zip from "here":http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.7.3.zip.
Note: When running configure on QtSources it wants to run syncqt which requires Perl to work.
I installed ActivePerl which seemed to get me past the previous point it failed, but still not working. Guess I was using the older guide via a google search. Still quite confused on [url=http://developer.qt.nokia.com/wiki/How_to_build_a_static_Qt_version_for_Windows_with_gcc]this[/url] one
"First download the QtSDK you need, I took 4.7.0 and install it (incl. gcc).
Then copy the complete qt file tree from Path-To-Qt-SDK\qt to Path-To-Qt-SDK\qt-static (or whatever path you prefer).
copy Path-To-Qt-SDK\bin\qtenv.bat to static folder and adapt content —> replace xxx\qt with XXX\qt_static"
What do they mean by "complete qt file tree"? The 4.7.3 etc under the QTSources folder or the entire QTSDK folder?
I in your case you should do:
Copy C:\QtSDK\QtSources\4.7.3 to C:\QtSDK\Desktop\Qt\4.7.3-static
Edit the C:\QtSDK\Desktop\Qt\4.7.3-static\mkspecs\win32-g++\qmake.conf as mentioned add the bold marked items:
QMAKE_CFLAGS_RELEASE = -Os -momit-leaf-frame-pointer
QMAKE_LFLAGS = -static -static-libgcc …
DEFINES += QT_STATIC_BUILD
LFLAGS = -static -static-libgcc …
add CONFIG += staticlib at the top
At the dos prompt CD to C:\QtSDK\Desktop\Qt\4.7.3-static
Run: @> set PATH=C:\QtSDK\mingw\bin;%PATH%
configure.exe -static -debug-and-release -opensource -confirm-license -platform win32-g++ -no-exceptions -dont-process -no-qt3support -webkit -qt-sql-sqlite -qt-zlib -qt-libpng -qt-libjpeg@
Then accordin to the wiki run:
And at last you run mingw32-make.exe
@> C:\QtSDK\mingw\bin\mingw32-make.exe sub-src@
It has been a while since the last time I had Qt build statically, so I don't know if the wiki article is correct on all the settings... so don't blame me if it doesn't build correctly ;-)
Apart for the makespecs and make file editing and the configure options, the sameway I build Qt with openssl support from QtSources.
I got everything done up until the dos prompt. Everything except creating qmake went fine.
execute: File or path is not found (mingw32-make)
execute: File or path is not found (mingw32-make)
Cleaning qmake failed, return code -1@
Do @> set PATH=C:\QtSDK\mingw\bin;%PATH%@ and rerun configure with your arguments. Sorry my mistake, forgot to mention that part ;-). I edited my post accordingly.
Maybe you could update the wiki, if you succeed, with your findings?
Still not working. Unless I'm not setting the environmental variable for MinGW correctly?
@Variable Name %PATH%
Variable Value C:\QtSDK\mingw\bin@
If you posted the whole message you got and not just a part, it would be much easier to help you out.
Did you set, like I showed you, the path to mingw32-make at the prompt before rerunning configure?
The command prompt was cutting it off. Have it in a text file so I'll post it if I have an issue again.
Ah I misunderstood that. Seems like it's actually building now, but I don't know for sure so I'll post an update after a bit.:)
It failed again saying interrupt. Is there a way that when I'm about ready to release a program I can compile it against the libraries without having static set up? Nokia needs to provide better documentation on this.
Until now you only given incomplete error messages. As said before if you provide us with the full error message maybe someone will be able to help you.
[quote author="DarkSnake-Kobra" date="1309984350"]Is there a way that when I'm about ready to release a program I can compile it against the libraries without having static set up?[/quote]
Build your application as usual and redistribute the Qt libraries (.dlls) along with your application. (There are tons of threads on how to do this.)
If you really consider to link Qt statically to your application you should probably "consider":http://developer.qt.nokia.com/forums/viewthread/6749/ buying a commercial license too.
Was just thinking on that. I think it'll be easier to compress the libraries with UPX and redistribute them with the programs.:)
Everything resolved now.:)
please, how can I redistribute Qt dlls ?
I use Qt 5.2, I need to create Stand-Alone .exe file as a Release from my application, and till now static Qt build fails.
Even it completes, Qml and Quick doesn't known for Qt.
So, If there are any other solution to get stand-alone file, that will be very appreciated.