Cannot make static application (Windows).
-
I successfully created static app with Qt4.5. Now I changed to 4.7 and I'm unable create it. I installed Qt on new machine and clearly followed all instructions from [url=http://developer.qt.nokia.com/wiki/How_to_build_a_static_Qt_version_for_Windows_with_gcc]this page[/url]. Qt assembled as static and I see libraries. Then I ported my project. It compiles as well but assembles as dynamically linked.
Project consists of 2 parts: static library subproject and main application subproject. Following are settings for each project:
Static library:
QtCreator settings:
[quote]Build configuration: Release
Build steps\qmake\Additional arguments: -spec i:/qt/2010.05s/qt/mkspecs/win32-g++ CONFIG+=release CONFIG+=create_prl CONFIG+=static[/quote]At .pro file beginning:
@
static {
CONFIG += staticlib
DEFINES += STATIC
message( "-----------STATIC-----------" )
QMAKE_LFLAGS += -static
}
@Main application
QtCreator settings:
[quote]Build configuration: Release
Build steps\qmake\Additional arguments: -spec i:/qt/2010.05s/qt/mkspecs/win32-g++ CONFIG+=link_prl CONFIG+=static (CONFIG+=release added automatically to effective qmake call)[/quote]At .pro file beginning:
@
static {
CONFIG += static
DEFINES += STATIC
message( "-----------STATIC-----------" )
QMAKE_LFLAGS += -static
}
@At the end of .pro file there is:
@
CONFIG( release, release|debug ) {
LIBS += <path and name of static library>
PRE_TARGETDEPS += <path and name of static library>
message( "------------RELEASE------------" )
}
@Projects create static library and application without debugging info. But application is dynamically linked and depends from mingwm10.dll, msvcrt.dll, QtCore4.dll, QtGui4.dll. What is wrong and how can I assemble static application without dependence from Qt libraries?
-
I found there was setting from older installation. When I removed it I've got error message about throw used but exceptions was prohibited. Now I remembered - I need exceptions allowed for this project. Have to rebuild Qt4 from source again...
I'd recommend add something in the article. If exceptions are strongly needed, than -no-exceptions options must not be used. But mingw32.dll will be mandatory distributed with application. Not so heavy task. This library is very small.