Build Qt in “Release with Debug Info” mode?

后端 未结 7 1776
甜味超标
甜味超标 2020-12-30 21:32

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

相关标签:
7条回答
  • 2020-12-30 22:02

    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))
    
    0 讨论(0)
提交回复
热议问题