Build Qt in "Release with Debug Info" mode?
In Qt5, when calling configure
, just simply add option -force-debug-info
I use this in my qmake files to build my release versions with debuginfo:
QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO
QMAKE_CFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO
QMAKE_LFLAGS_RELEASE = $$QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO
This way you can at least check if the crash happens in your code. Building Qt with this mode is not supported, see this bug. You can only do it manually by changing vcproj-files or Makefiles like in the answer of Macke.
Old question, I know. But nowadays, you can simply use
CONFIG += force_debug_info
to get debug symbols even in release mode. When you use QMake
via the command line, I usually do this to get a release build with debug info:
qmake CONFIG+=release CONFIG+=force_debug_info path/to/sources
this will enable below conditions of Qt5/mkspecs/features/
default_post.prf:
force_debug_info|debug: CONFIG += debug_info
force_debug_info {
QMAKE_CFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO
QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO
QMAKE_LFLAGS_RELEASE = $$QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO
}
which would even work for Qt 4.x
but we would need to manually append above conditions into default_post.prf
for Qt 4.x