Having some difficulties with static compile of Qt!
First of all, I am very sorry if this topic has been discussed many times before, but I have now searched the web for like 8 hours straight and couldn't find fitting answer to my problem. I am very new to Qt and the concepts of how the whole program works so please, if you know "a solution to my problem" or something, would you kindly make your point very clear (I am also rather retarded sometimes).
I have had Qt Creator (4.7.4) for like two weeks now and I found out that if I wanted to make a "stand alone" program, I would need to recompile the whole Qt to use static libraries. Well first I followed some tutorials and they told me to download the source from "here":ftp://ftp.qt.nokia.com/qt/source/ I downloaded the "qt-everywhere-opensource-src-4.7.4.zip" and I extracted it to C:\QtSDK\QtSources in a new folder named 4.7.4. I also used the maintenance tool to download bunch of other versions, for example 4.8.0 and 4.8.1 but I have no idea why would I need them. I should use the 4.7.4 am I right?
Well, I continued the process and changed one line from: C:\QtSDK\QtSources\4.7.4\mkspecs\win32-g++\qmake . I changed the line QMAKE_LFLAGS to static as I was told to do. Then I opened the little command line tool "Qt 4.8.1 for Desktop (MinGW)" which came with the install of QtCreator. I navigated to C:\QtSDK\QtSources\4.7.4 and typed in "configure -platform win32-g++ -static -release -nomake demos -nomake examples -no-exceptions". I chose the opensource edition and accepted the TOS.
After that it runs well and after a few minutes it says "succeeded. run mingw32-make to continue" or something like that, and I ran "mingw32-make sub-src", again because I was told to do so in one tutorial. The whole process starts and ends well, it took like 50 minutes for my computer to end whatever it was doing.
The question now is: what did I do wrong or did I really miss something? Because whenever I now open the Qt Creator and create a new project, I still can't run my program from debug folder. It still misses those goddamn .dll's which should now be in the executable. So it seems like nothing has changed from what it was in the beginning. Note that I added "CONFIG += static" to my .pro file.
I wonder if someone has some tips for me? I'm getting kind of desperate since I have gone through the whole process for like ten times already and still couldn't fix the problem. It's frustrating. :)
Thank you for your time!
False alert. I somehow can now open the executable from the debug folder. But one thing I just don't get. Why is the size of my executable still like 880KB? Shouldn't it be like 8MB because all the .dll's are mashed in also?
Your executable can very well be smaller than the sum of the sizes of the libraries it uses when static building: The linker will remove symbols (functions, etc.) that you do not use.