Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Generating debug symbols (pdb) for release



  • Hello,

    I'm trying to generate the pdb files on a release configuration of Qt 5.6.2. The compiler is Visual Studio 2008 on Windows 32b.

    First I executed jom after running this configure command:
    configure -opensource -platform win32-msvc2008 -debug-and-release -force-debug-info -opengl desktop -nomake examples -nomake tests

    But only the pdbs for the debug DLLs where generated (the *d.dll).

    So I tried removing the -force-debug-info, and adding to qtbase\mkspecs\win32-msvc2008\qmake.conf and qtbase\mkspecs\common\msvc-desktop.conf the following flags:
    MAKE_CFLAGS_RELEASE = -O2 -MD -Zi
    QMAKE_LFLAGS_RELEASE = /INCREMENTAL:NO /DEBUG

    More specifically, I overwrote those flags on msvc-desktop.conf, and also appended them to msvc2008\qmake.conf. Either way, only the pdbs for the debug DLLs were generated, as if these flags are being ignored.

    Could you give me some pointers?

    Thank you!


  • Moderators

    @jay_s
    For C++ (MSVC) you need to set the following in your .pro file (no need to alter any qmake config files):

    QMAKE_CXXFLAGS += /Zi
    QMAKE_LFLAGS += /DEBUG 
    

    depending if you want fully optimized Release build (read this) you can also add:

    QMAKE_LFLAGS += /OPT:REF /OPT:ICF
    

    Additionally you can use more specific QMAKE variables like QMAKE_CXXFLAGS_RELEASE and also scope them only to msvc compiler and release mode:

    msvc:release {
        ...
    }
    


  • Thanks for the quick reply!

    I appended the following block to the qt.pro in Qt5's root directory and re-executed the configure script just in case, but still only the *d.dll pdbs are being generated in qtbase/lib.

    msvc:release {
    QMAKE_CXXFLAGS_RELEASE += /Zi
    QMAKE_LFLAGS_RELEASE += /DEBUG
    }



  • @jay_s
    You did force a complete rebuild for sure after changing the flags in the .pro file, didn't you?



  • @JonB Yes, I started with newly unzipped Qt5.6.2 sources.

    I'm also using "jom -j 4 clean" before rebuilds.

    I've tried also appending only the flags without the guard to qt.pro, but the pdbs for the release DLLs are still not being generated.

    QMAKE_CXXFLAGS_RELEASE += /Zi
    QMAKE_LFLAGS_RELEASE += /DEBUG


  • Moderators

    @jay_s said in Generating debug symbols (pdb) for release:

    I appended the following block to the qt.pro in Qt5's root directory and re-executed the configure script just in case, but still only the *d.dll pdbs are being generated in qtbase/lib.
    msvc:release {
    QMAKE_CXXFLAGS_RELEASE += /Zi
    QMAKE_LFLAGS_RELEASE += /DEBUG
    }

    what about this:

    msvc:CONFIG(debug, debug|release) {
      QMAKE_CXXFLAGS_RELEASE += /Zi
      QMAKE_LFLAGS_RELEASE += /DEBUG
    }
    


  • @raven-worx said in Generating debug symbols (pdb) for release:

    what about this:
    msvc:CONFIG(debug, debug|release) {
    QMAKE_CXXFLAGS_RELEASE += /Zi
    QMAKE_LFLAGS_RELEASE += /DEBUG
    }

    I tried placing that block by the end of qt.pro, but still the release pdbs are not being created, after performing a clean command and rebuilding. I wonder what's missing...



  • @jay_s

    Have you tried adding -separate-debug-info with -force-debug-info to the configure option?



  • @Devopia53

    Hm same situation:

    The -separate-debug-info option results in this error on Win64, MSVC2008:
    ERROR: -separate-debug-info was requested but this binutils does not support it.

    So I did a 'jom clean' and reconfigure without that option, but now including the -force-debug-info:

    configure -opensource -platform win32-msvc2008 -debug-and-release -force-debug-info -opengl desktop -nomake examples -nomake tests
    

    But once again, only the debug DLL pdbs are generated in qtbase/lib:
    Qt5Concurrentd.pdb
    Qt5Cored.pdb
    Qt5DBusd.pdb
    Qt5Guid.pdb
    Qt5Networkd.pdb
    Qt5OpenGLd.pdb
    Qt5PrintSupportd.pdb
    Qt5Sqld.pdb
    Qt5Testd.pdb
    Qt5Widgetsd.pdb
    Qt5Xmld.pdb


  • Moderators

    @jay_s said in Generating debug symbols (pdb) for release:

    So I did a 'jom clean' and reconfigure without that option

    just a hint: if you the configuration changes you should execute the dist-clean make target.

    But once again, only the debug DLL pdbs are generated in qtbase/lib

    Why do you need pdb files for the executables?

    Beside that you can also specifiy MSVC linker options via an environment variable (similar for the compiler).


Log in to reply