Search code examples
c++qtqt4qmake

Build Qt in "Release with Debug Info" mode?


Is there a way to build Qt in "Release with Debug info" mode ? My application crashes only in "release" mode (works fine in Debug mode) and seems the issue comes from Qt (may be a bug in Qt).So I want to see the debug info of Qt.

Qt docs has "debug" , "release" but not "release with debug" mode.

[Upate]

My application works fine with Mingw 32bit Release/Debug and VSC++ Compiler 64bit Debug.

Only crashes on VSC++ 64Bit Release

Any tips ?


Solution

  • Update: See @milanw's answer below. This is now supported directly in qmake

    We use qmake to generate vcproj files to build Qt. I wrote a python script (but sed is fine too) to change the vcproj-files to build with debug information in release too.

    Having debug info is indeed invaluable for stack traces that go back and forth between Qt and our app.

    Here's the relevant snippet:

    for root, dirs, files in os.walk( qt_build_dir ):
        for f in files:
          if not f.endswith('.vcproj'):
              continue
    
          output = []
          with open(pj(root, f), 'r') as file:
              for line in file.readlines():
                  line = line.strip()
                  if 'DebugInformationFormat="0"' == line:
                      output.append('\t\t\t\tDebugInformationFormat="3"')
                  elif 'GenerateDebugInformation="false"' == line:
                      output.append('\t\t\t\tGenerateDebugInformation="true"')
                  else:
                      output.append(line)
    
          with open(pj(root, f), 'w') as file:
              file.write('\n'.join(output))