locked
What combination of VC++ 14 options triggers “Fast Link Time Code Generation” RRS feed

  • Question

  • I am trying to test the new /LTCG:incremental option (VS2015 only) to reduce the pain of our incremental builds.

    I believe I should be seeing some .iobj and .ipdb files that hold the incremental link info. I do not see these. I suspect that my projects, having been migrated from VS2012, do not have all the correct settings. Can someone please list which options I should be setting for:

    • 3 static libraries
    • 2 DLLs
    • 1 EXE file

    The place where options must be set includes General/ Compiler/ Linker/ Librarian.

    Background on incremental build improvements can be found on the VC++ Team BLog from Nov 2014, but the VS2015 documents are not exactly crystal clear on how to turn this on.

    Monday, October 19, 2015 10:40 PM

Answers

  • Hi Steve,

    Currently, it seems that the issue you met is located on the legacy project, however because I can not reproduce the issue, so I am not sure if the issue is definitely due to migration. Maybe some other options impact.

    Due to the new function "Fast Link Time Code Generation" has not detailed introduction in MSDN document, I would suggest you see the blog in link below and write your issue in the blog comment, there should be MSFT from the product team to help you.

    http://blogs.msdn.com/b/vcblog/archive/2014/11/12/speeding-up-the-incremental-developer-scenario-with-visual-studio-2015.aspx

    And the fast tips for faster builds in link below for your reference.

    GoingNative 35: Fast Tips for Faster Builds!

    May


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Wednesday, October 28, 2015 7:59 AM

All replies

  • Hi,

    Thanks for posting here.

    What kind of build did you do? There is no Link Time Code Generation setting for debug build by default. The release build is set 'Use Fast Link Time Code Generation (/LTCG:incremental)'.

    When I build with release, I can see .iobj and .ipdb files in my release folder.

    More about /LTCG (Link-time Code Generation) in VS2015, you may refer to MSDN document in link below.

    https://msdn.microsoft.com/en-us/library/xbf3tbeh.aspx

    May


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, October 21, 2015 3:02 AM
  • Hi - thanks for the reply.

    Yes, I had that setting as you suggested, and also the one on the General page, and any others I could find that are supposed to trigger LTCG:incremental.  My build does not produce the files you noticed, and the link time still appears to involve full code generation on even the most trivial code change.

    The documentation link you posted (which is the one I mentioned in my post) does not mention LTCG:incremental anywhere as far as I can tell.  Is this an unsupported option, or is the documentation deficient?

    Your screenshot seems to be from a toy app created to demonstrate the correct settings. I wonder if my use case, which is migration of a large 6 project solution from an earlier version (VS2012), is causing some type of hidden failure to trigger LTCG:incremental even though I ostensibly have all the compiler and linker flags set correctly?  At this point, the interaction of all these General/Compiler/Librarian/Linker options is really hard to fathom, and revised documentation might go a ways towards helping with that.

    I am building Release. We also have the standard Debug (which we rarely use because its execution speed is so slow) and Release-NoOpt which is our own variation, using Release code with compiler optimization and LTCG turned off, to speed up the desktop incremental build.

    I made my own toy app and I do see that the LTCG:incremental setting is the default. So I think it's likely that this is an issue specific to my migration of existing projects.

    All 1 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.

    I noticed in the toy project that the Release|x86 and Release|x64 has an extra property sheet for "Whole Program Optimization".  This is (obviously I guess) not present in my migrated projects, since it was not present in the original versions.  Maybe if I can track down how to add this sheet to my migrated projects, the new LTCG:incremental support will work?

    I did manage to track this property sheet down, it's being include by default but does not result in expected behaviour.

    Wednesday, October 21, 2015 10:38 AM
  • Hi,

    >Yes, I had that setting as you suggested, and also the one on the General page, and any others I could find that are supposed to trigger LTCG:incremental.  My build does not produce the files you noticed, and the link time still appears to involve full code generation on even the most trivial code change.

    >I made my own toy app and I do see that the LTCG:incremental setting is the default. So I think it's likely that this is an issue specific to my migration of existing projects.

    Thanks for your feedback. Based on your testing, it seems that the issue is mainly located on the migration projects. So double check if the projects are enabled with incremental link. It seems that the projects are performing full link.

    • Open the project's Property Pages dialog box. For details, see Working with Project Properties.

    • Select the Linker folder.

    • Select the General property page.

    • Modify the Enable Incremental Linking property with  /INCREMENTAL

    When this option is selected, the linker issues a warning if it cannot link incrementally, and then links the program nonincrementally. Most programs can be linked incrementally. However, some changes are too great, and some options are incompatible with incremental linking. LINK performs a full link when some special scenarios. The detailed scenarios please go here to check.

    May


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, October 23, 2015 8:09 AM
  • HI May, thanks again for getting back to me.

    I did try this (as well as many other combinations) but /LTCG is incompatible with /INCREMENTAL.  LNK4075 results if you set this to /INCREMENTAL:YES

    Quote : "/LTCG is not valid for use with /INCREMENTAL."


    Friday, October 23, 2015 10:32 AM
  • Hi,

    Is it possible to provide the project or demo for me to reproduce your issue?

    May


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, October 27, 2015 9:52 AM
  • That's not really practical, it's many 1000s of lines of code and depends on several other libraries, one of which is a third-party licensed package.  I don't have time to try to reproduce in a smaller version, particularly since my guess is that this involves the project migration process from VS2012.

    Can you suggest some MSBuild or other diagnostics that would help the dev team understand why LTCG:/incremental is not being triggered?

    Does the dev team think that migrating via VS2013 rather than direct from VS2012 to VS2015 would be more likely to succeed?


    Tuesday, October 27, 2015 10:45 AM
  • Hi Steve,

    Currently, it seems that the issue you met is located on the legacy project, however because I can not reproduce the issue, so I am not sure if the issue is definitely due to migration. Maybe some other options impact.

    Due to the new function "Fast Link Time Code Generation" has not detailed introduction in MSDN document, I would suggest you see the blog in link below and write your issue in the blog comment, there should be MSFT from the product team to help you.

    http://blogs.msdn.com/b/vcblog/archive/2014/11/12/speeding-up-the-incremental-developer-scenario-with-visual-studio-2015.aspx

    And the fast tips for faster builds in link below for your reference.

    GoingNative 35: Fast Tips for Faster Builds!

    May


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Wednesday, October 28, 2015 7:59 AM
  • Thanks for your help May. I have done that.
    Wednesday, October 28, 2015 2:23 PM