I want to make my app without any dependancies for the users. It works well when I put the dll files into the same folder as my exe.
I’m trying to set all those libraries to static use the following code in my pro file (Qt 4.8.1):
QMAKE_LFLAGS += -static-libgcc
CONFIG += static
The previous code doesn’t change anything.
Here are the dll file I have included into my project folder:
- libgcc_s_dw2-1.dll
- mingwm10.dll
- QtCore4.dll
- QtGui4.dll
The fact is I don’t want my app be more than a file and I don’t want the users to download libs files, which are heavy (9mB for the last one).
Is there a way to compile a Qt project and use static libs?
I’ve tried to read some tutorials I’ve found on the Internet but they are all outdated. For what I read too, the solution would be to rebuild the Qt source code staticaly.
To be able to fully statically compile against Qt you need to rebuild the framework as static, using the pre-compiled framework isn’t enough – unless you have a commercial license and can get the static binaries.
See: http://www.formortals.com/how-to-statically-link-qt-4/, http://www.formortals.com/build-qt-static-small-microsoft-intel-gcc-compiler/ and http://doc.qt.nokia.com/4.7-snapshot/deployment.html#static-vs-shared-libraries for more information.