Incremental linking not working

Added by Tim S about 4 years ago

Hi,

I just got all my projects working together and am really happy with JamPlus, except I can't seem to get incremental linking to work. For some background, I've generated a Visual Studio workspace with a bunch of 3rd-party static libraries and my main project source files. After building everything, I press F7 with no changes and the incremental build is really fast, i.e.

*** found 10079 target(s)...
*** finished in 0.89 sec

however if I make any changes to any of the source files to my main project and hit F7 to build, it takes a while for the one source file, then I get this message:

*** found 10079 target(s)...
*** updating 2 target(s)...
File.cpp
@  0% batched-C++ <APP>file.obj 
LINK : C:/Tim-Stuff/Projects/APP/build/temp-win32-debug/APP.debug.exe not found or not built by the last incremental link; performing full link
   Creating library C:/Tim-Stuff/Projects/APP/build/temp-win32-debug/APP.debug.lib and object C:/Tim-Stuff/Projects/APP/build/temp-win32-debug/APP.debug.exp

The strange thing is APP.debug.exe is in the build folder, so I'm not sure why the linker is saying it can't find it. I am using precompiled headers in my main project, so I'm thinking the non-incremental link is slowing things down. Any help would be greatly appreciated, thanks!


Replies (5)

RE: Incremental linking not working - Added by Tim S almost 4 years ago

I believe I made some headway on this issue. I notice that in the SharedLibraryFromObjects rule, there is this bit of code:

rule SharedLibraryFromObjects TARGET : OBJECTS : OPTIONS
{
   ...
  local linkRule = Link ;

  if $(COMPILER) in vs2005 vs2008 {
        if nomanifest in $(OPTIONS) {
            linkRule = LinkNoManifest ;
        } else if $(CONFIG) = debug {
            linkRule = LinkDebug ;
        }
    }

    $(linkRule) $(_linkTargets) : $(_s) ;

However, for the ApplicationFromObjects rule, there is no such check, and always the regular Link rule is used:

rule ApplicationFromObjects TARGET : OBJECTS : OPTIONS
{
 ...
  Link $(_linkTargets) : $(_s) ;

If I change Link to LinkDebug the incremental linking problem goes away. It seems the regular Link rule invokes the mt.exe tool which disturbes the exe such that incremental linking doesn't work. LinkDebug works around this. Can anyone comment on this? Thanks.

RE: Incremental linking not working - Added by Tim S almost 4 years ago

One more question, in the LinkDebug action, I can't determine the purpose of these lines:

if exist $(MANIFEST).intermediate.manifest "$(MT:\\)" -nologo -notify_update -manifest $(MANIFEST).intermediate.manifest -out:$(MANIFEST).embed.manifest &
    if "%ERRORLEVEL%" == "1090650113" echo $(MANIFEST_TYPE) 24 "$(MANIFEST).embed.manifest" > "$(MANIFEST).embed.rc" &
    "$(RC:\\)" /fo $(MANIFEST).embed.res $(MANIFEST).embed.rc &
    "$(LINK:\\)" /nologo /out:$(<[1]) $(UNDEFS) @@($(LINKFLAGS) $(>) $(NEEDLIBS:T) "$(LINKLIBS)")

I removed them and got linking just fine, are they needed? Also, is the ampersand at the end of the line used for anything? Thanks for the info.

RE: Incremental linking not working - Added by Joshua Jensen almost 4 years ago

I apologize for the late response. I had a number of issues come up last week that took me away from the computer.

The SharedLibraryFromObjects implementation is correct. I have made the same change to ApplicationFromObjects, as per your suggestion. It isn't checked in yet, but it will be soon. This was a terrible oversight, but given I've mostly been working with DLLs lately, it isn't surprising.

As far as the LinkDebug action goes, the complex action you posted above is necessary to allow the incremental linking of the executable with an embedded manifest. You can read more about it here: http://msdn.microsoft.com/en-us/library/ms235591%28VS.80%29.aspx

The ampersand at the end of the line runs all of the lines in the same DOS command. I believe it is necessary for proper errorlevel propagation.

Josh

RE: Incremental linking not working - Added by Tim S almost 4 years ago

No problem, I understand life happens. Thanks for the explanations, that makes sense.

RE: Incremental linking not working - Added by Joshua Jensen over 3 years ago

BTW, this is fixed in JamPlus 0.4.

Josh

(1-5/5)