Boost logo

Boost-Build :

From: David Abrahams (dave_at_[hidden])
Date: 2006-12-07 12:43:26


Misha Bergal <mbergal_at_[hidden]> writes:

> While writing a test suite for process_jam_log I've encountered the following
> problem:
>
>
> (HEAD) msvc.jam defines link actions as:
>
> actions link bind DEF_FILE
> {
> $(.LD) $(LINKFLAGS) /out:"$(<[1]:W)" /LIBPATH:"$(LINKPATH:W)" $(OPTIONS) @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)$(LIBRARIES_MENTIONED_BY_FILE) $(nl)$(LIBRARIES) $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST:S=.lib)" $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA:S=.lib)")"
> if exist "$(<[1]).manifest" (
> $(.MT) -manifest "$(<[1]).manifest" "-outputresource:$(<[1]);1"
> )
> }
>
>
> On my system (WinXP Pro SP2) the last line ("if exist ...") makes cmd to
> return 0 exit code instead of error code from linker, causing
> process_jam_log to incorrectly report this failure.
>
>
> The following workaround gets around this by explicitly exiting if link failed:
>
> actions link bind DEF_FILE
> {
> $(.LD) $(LINKFLAGS) /out:"$(<[1]:W)" /LIBPATH:"$(LINKPATH:W)" $(OPTIONS) @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)$(LIBRARIES_MENTIONED_BY_FILE) $(nl)$(LIBRARIES) $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST:S=.lib)" $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA:S=.lib)")"
> if errorlevel 1 exit %errorlevel%
> if exist "$(<[1]).manifest" (
> $(.MT) -manifest "$(<[1]).manifest" "-outputresource:$(<[1]);1"
> )
> }

Well, although I applied this patch, it doesn't seem to work at all.
I added an ECHO after the errorlevel test and it got executed despite
the fatal link error. Can you come up with a patch that works?

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk