View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0010636CMakeCMakepublic2010-04-28 15:572016-06-10 14:31
ReporterEric Gross 
Assigned ToKitware Robot 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionmoved 
PlatformOSOS Version
Product VersionCMake-2-8 
Target VersionFixed in Version 
Summary0010636: Visual Studio 'Release' configuration should have usable PDBs generated
DescriptionI noticed that the 'Release' configuration has the compilation step not produce debug info (/Zi flag). The linker is still configured to produce a PDB but this contains pretty much no information since the compiled code had no debug info generated. This is a problem because any binaries that we produce and ship to customers always needs preserved symbol information for debugging crash dumps from the field or just doing live debugging with the released binaries.

I tried to use the 'ReleaseWithDebugInfo' configuration, but this is a far different configuration than the 'Release' configuration. It is built with incremental linking, inlining options, and unused symbol removal options. It might be useful for some people to debug issues that only appear in optimized code, but the differing compile/link options make these binaries unsuitable for actual release because they are around 50% larger than 'Release' configuration.

Since MSVC has the ability to generate external PDBs for fully-optimized code with no runtime size or performance penalty to the resulting binaries, it seems silly that there is no configuration that lets you do this. I think the default 'Release' configuration should always produce a usable PDB.
Additional InformationThe workaround I put in our configuration is the following:

###############################################################################
# Ensure all builds always have debug info built
###############################################################################
IF(WIN32)
    add_definitions("/Zi")
    #--------------------------------------------------------------------------
    # Since /Zi implies /OPT:NOREF, explicitly enable /OPT:REF on all
    # release builds (this ensures all unused symbols are stripped)
    #--------------------------------------------------------------------------
    set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /OPT:REF")
    set(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "${CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL} /OPT:REF")
    set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} /OPT:REF")
ENDIF()
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0024813)
Eric Gross (reporter)
2011-01-17 16:04

As an update, the workaround I listed previously was not quite correct as it generated warnings in some configurations. Someone else fixed this in our trunk to only add the /Zi flag during release builds rather than always. This is the workaround we use currently:

###############################################################################
# Ensure all builds always have debug info built
###############################################################################
IF(WIN32)
    # make the Release version create a PDB
    set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
    # minimize the size or the resulting DLLs
    set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /OPT:REF")
ENDIF()
(0034592)
Christian Bühler (reporter)
2013-11-27 11:39
edited on: 2013-11-27 11:43

I am using CMAKE_EXE_LINKER_FLAGS_RELEASE instead of CMAKE_SHARED_LINKER_FLAGS_RELEASE and added /DEBUG additonally

(0041688)
Kitware Robot (administrator)
2016-06-10 14:27

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2010-04-28 15:57 Eric Gross New Issue
2011-01-17 15:56 David Cole Assigned To => David Cole
2011-01-17 15:56 David Cole Status new => assigned
2011-01-17 16:04 Eric Gross Note Added: 0024813
2011-10-25 22:21 David Cole Assigned To David Cole =>
2011-10-25 22:21 David Cole Status assigned => backlog
2013-11-27 11:39 Christian Bühler Note Added: 0034592
2013-11-27 11:43 Christian Bühler Note Edited: 0034592
2016-06-10 14:27 Kitware Robot Note Added: 0041688
2016-06-10 14:27 Kitware Robot Status backlog => resolved
2016-06-10 14:27 Kitware Robot Resolution open => moved
2016-06-10 14:27 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team