I just made a program in QT, I would like to distribute it but I want a static build, not one that I need to ship all the libraries with it. I have been looking everywhere for a guide on it and they all describe things that I do not have. If someone could please help me out, I would greatly appreciate it.
-
[This](http://stackoverflow.com/questions/1011197/qt-static-linking-and-deployment) is for your reference – liuyi.luo Jul 21 '12 at 02:08
2 Answers
Here are my rough notes. I did this a few days ago.
Downloaded Mingw32 http://sourceforge.net/projects/mingw/files/latest/download?source=files
And I choose to add the msys package too. this is a cmd msys.bat file that sets up the env for you. I installed the above to c:\MinGW and double clicked the C:\MinGW\msys\1.0\msys.bat
Downloaded the QT Source http://releases.qt-project.org/qt4/source/qt-everywhere-opensource-src-4.8.2.zip
I unzipped the above to c:\qt-src-4.8.2
using the msys command line I changed directory to the above directory and typed this:
configure.exe -static -platform win32-g++ -release -exceptions
this took about 15 minutes
Then I typed:
mingw32-make sub-src
This took hours.
Installing QT Creator, Downloaded from: Installed to : C:\qtcreator-2.5.0 Run qtcreator Tools > Options QT Versions. Add > Browse to qmake.exe in the c:\qt-src-4.8.2 Tool Chain > Add MinGW > Browse to the g++.exe
Modify the makespecs Open C:\qt-src-4.8.2\mkspecs\win32-g++\qmake.conf add QMAKE_LFLAGS = -static -static-libgcc Then to test the static build, open the .pro file CONFIG += static

- 267
- 2
- 12
Don't bother doing static compilation with Qt. You are going to spend hours on it and you're not even sure to succeed. Use Qt as it's meant to be used - with separate DLLs.

- 88,262
- 77
- 290
- 428