# How to compile QT with optimizations while producing debug symbols

• Hi,

I am looking for way to generate breakpad-compatible symbols for the QT libraries.

The configure script provided with the free version of QT 4.8 seems not to be able to compile on windows with optimizations enabled while producing .pdb files for each dll. Same with OSX, we can only get symbols in the binaries when building in debug mode.

CMake has a build type called "RelWithDebInfo" which has this behavior.

I want to compile the QT libs with symbols included and optimizations enabled, and then run dump_syms on the non-stripped binaries to produce the breakpad-compatible .sym files and finally strip out the debug symbols from the binaries.

Is there 1) some option I'm not aware of in the current configure script? 2) some simple way to patch the current build system to allow this? or 2) existing CMake files for the QT sources?

Thanks,
teemu

• Just note that in Qt5, libraries will not be stripped by default.

As for OSX, I don't know the flags, but you can definitely check available flags with:
@
man g++
man clang
@

• It seems one can define "-g" in addition to -O2 for the QMAKE_CFLAGS_RELEASE in mkspecs/common/gcc-base.conf. That will change the release mode building to include symbols for all unix-like platforms, like OSX, that use gcc or llvm.