Boost logo

Boost-Build :

From: Franz Schnyder (fschnyder_at_[hidden])
Date: 2006-09-29 03:20:44


Bojan Resnik <resnikb <at> gmail.com> writes:

>
> I encountered a strange problem where the .rsp file for the pch
> source was created without any usual options, such as /TP, /Zm,
> include files, defines, etc. It contained only the options to create
> the pch file. I managed to create a test case that reproduces this. I
> am attaching the Jamroot file, together with stub sources need to
> attempt to compile the project.
>
> I tested this with alll versions of MSVC and they all behave the
> same. Am I doing something wrong here, or is this a bug?

I encountered the same Problem just a couple days ago. I think it's a bug but
I'm not sure if the bug is in the rules or bjam itself.

I could fix the problem with the following patch:

Index: msvc.jam
===================================================================
--- msvc.jam (Revision 77)
+++ msvc.jam (Revision 135)
@@ -616,6 +616,7 @@
 {
     DEPENDS $(<) : [ on $(<) return $(PCH_SOURCE) ] ;
     get-rspline $(targets[1]) : -TP ;
+ get-rspline $(targets[2]) : -TP ;
     compile-pch $(targets) : $(sources) [ on $(<) return $(PCH_SOURCE) ] ;
 }

Here the details of what I figured out:

I think the problem just appears if the pch is not a main target.
 
The problem is that the the variable 'CC_RSPLINE' is empty in the action
although the set 'CC_RSPLINE on $(target)' is done.
 
I could reproduce the problem with the following project layout

pch
 +-lib_a (with pch)
 +-lib_b (with pch, depends on a)
 +-exe (uses b and a via use-project)

If I compile the lib a form the lib_a directory everything works fine
('CC_RSPLINE' is correct).
If I compile from exe and lib a needs to be build the 'compile-pch' fails
because 'CC_RSPLINE' is empty in the action.

'compile-pch' has two targts (x.obj and x.pch) but the 'CC_RSPLINE on $(target)'
is just done on the first one. I changed the 'compile.pch' rule to also set it
on the second target (see patch) and to my surprise now the 'CC_RSPLINE' isn't
empty anymore an anything works fine now ! I don't know if this i a bug in bjam
or if the set on target needs to be done on all targets of the action to ensure
that the variable is set correct for the action ?

- Franz

  


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