[Interest] -MT and static QT
Sergey
sh0375 at gmail.com
Tue Apr 3 11:49:14 CEST 2012
Hello,
I've found this article:
http://qt-project.org/faq/answer/why_does_a_statically_built_qt_use_the_dynamic_visual_studio_runtime_librar
I'm using vs2005, QT 4.5.3
Built it statically, with QMAKE_CFLAGS_RELEASE = -O2 -MT
in mkspecs\win32-msvc2005\qmake.conf
But I didn't removed call to mt.exe in mkspecs/features and everything
works well.
I have such manifests in my dll/exe files:
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls"
version="6.0.0.0" publicKeyToken="6595b64144ccf1df" language="*"
processorArchitecture="*"></assemblyIdentity>
</dependentAssembly>
</dependency>
</assembly>
What does this phrase mean:
For Visual Studio 2005 it is also necessary to change the relevant files
in mkspecs/features to remove the call to mt.exe
If I search for phrase "mt.exe" in mkspecs\features, I find 2 files:
- embed_manifest_dll.prf
- embed_manifest_exe.prf
What changes are needed in this text of embed_manifest_dll.prf?:
MANIFEST_DIR = $$OBJECTS_DIR
isEmpty(MANIFEST_DIR):MANIFEST_DIR = .
!if(plugin:no_plugin_manifest):if(win32-msvc2005|win32-msvc2008):!static:!equals(TEMPLATE_PREFIX,
"vc"):equals(TEMPLATE, "lib") {
NOPATH_TARGET = $$TARGET
NOPATH_TARGET ~= s,\\ , ,q # Remove space escaping
(NOPATH_TARGET is quoted)
NOPATH_TARGET ~= s,\\,/,g # Change to single type separators
NOPATH_TARGET ~= s,^(.*/)+,, # Remove all paths
QMAKE_LFLAGS += /MANIFEST
$$quote(/MANIFESTFILE:\"$${MANIFEST_DIR}\\$${NOPATH_TARGET}.intermediate.manifest\")
QMAKE_PREV_POST_LINK = $$QMAKE_POST_LINK
QMAKE_POST_LINK = $$quote(mt.exe -nologo -manifest
\"$$replace(MANIFEST_DIR,/,\\)\\$${NOPATH_TARGET}.intermediate.manifest\" -outputresource:$(DESTDIR_TARGET);2$$escape_expand(\n\t))
QMAKE_POST_LINK += $$QMAKE_PREV_POST_LINK
QMAKE_CLEAN +=
\"$$replace(MANIFEST_DIR,/,\\)\\$${NOPATH_TARGET}.intermediate.manifest\"
}
And else one question: they write:
we have experienced memory problems when using anything but the -MD(d)
flag, and in general, it is recommended to use. You should not alter
this flag yourself for your application, because it conflicts with how
the Qt library is built if you change the flag to -MT. You should not
change it for Qt either, since it is likely to cause problems.
If I use -MT, how can I detect if there are problems with memory in my
app, they are writing about?
--
Sergey
More information about the Interest
mailing list